Class: Jpdfer::KeyStore

Inherits:
Object
  • Object
show all
Defined in:
lib/jpdfer/key_store.rb

Constant Summary collapse

JavaFileInputStream =
java.io.FileInputStream
JavaKeyStore =
java.security.KeyStore
JavaString =
java.lang.String

Instance Method Summary collapse

Constructor Details

#initialize(keystore_path, _alias, password) ⇒ KeyStore

Returns a new instance of KeyStore.



8
9
10
11
12
# File 'lib/jpdfer/key_store.rb', line 8

def initialize(keystore_path, _alias, password)
  @alias, @password = _alias, password
  @keystore = JavaKeyStore::getInstance(JavaKeyStore::getDefaultType())
  @keystore.load(JavaFileInputStream.new(keystore_path), JavaString.new(@password).toCharArray)
end

Instance Method Details

#certificate_chainObject



18
19
20
# File 'lib/jpdfer/key_store.rb', line 18

def certificate_chain
  @keystore.getCertificateChain(@alias)
end

#private_keyObject



14
15
16
# File 'lib/jpdfer/key_store.rb', line 14

def private_key
  @keystore.getKey(@alias, java.lang.String.new(@password).toCharArray)
end