SSE4E

Home

GPError
GPSystem
ByteString
ByteBuffer
TLV
TLVList
Card
Atr
Key
Crypto
Application GPApplication GPSecDomain

ASN1
CardFile
IsoSecureChannel
ApplFactory
GPXML
JsScript
CardSim

X509
CRL
KeyStore
CMSSignedData
CMSGenerator
XMLSignature
OCSPQuery
LDAP
SOAP
URLConnection

PKCS11Provider
PKCS11Session
PKCS11Object

OutlineNode

OpenSCDP

KeyStore - Reference Documentation

Class implementing access to Java key stores from JavaScript

Index of Methods

Constructor

Prototype

KeyStore(String provider, String type, String filename, String password)

KeyStore(String provider, String type, String filename)

KeyStore(String provider, String type)

KeyStore(String provider)

Description

Create and load key store

Arguments

TypeNameDescription
StringproviderProvider to use for key store access
StringtypeKey store type. Default is "jks".
StringfilenameName of file containing keys. Default is empty.
StringpasswordPassword used to access key store. Default is no password.

Exceptions

NameValueDescription
GPErrorGPError.ARGUMENTS_MISSINGToo few arguments in call
GPErrorGPError.INVALID_ARGUMENTSToo many arguments in call
GPErrorGPError.INVALID_TYPEType of argument is invalid for call
GPErrorGPError.CRYPTO_FAILEDAccessing key store failed

Example


var ks = new KeyStore("BC", "BKS", "sample.bks", "1234");

getAliases()

Prototype

String[] getAliases()

Description

Return list of aliases defined in key store.

Return

String[]Array containing alias names from key store

Exceptions

NameValueDescription
GPErrorGPError.ARGUMENTS_MISSINGToo few arguments in call
GPErrorGPError.INVALID_ARGUMENTSToo many arguments in call
GPErrorGPError.INVALID_TYPEType of argument is invalid for call
GPErrorGPError.CRYPTO_FAILEDAccessing key failed

Example


var aliases = ks.getAliases();
for (var i = 0; i < aliases.length; i++) {
	print(aliases[i]);
}

getKey()

Prototype

getKey(Key key)

getKey(Key key, String password)

Description

Link key object with key instance in key store using the key id.

Arguments

TypeNameDescription
KeykeyKey object
StringpasswordPassword to access key instance

Return

Exceptions

NameValueDescription
GPErrorGPError.ARGUMENTS_MISSINGToo few arguments in call
GPErrorGPError.INVALID_ARGUMENTSToo many arguments in call
GPErrorGPError.INVALID_TYPEType of argument is invalid for call
GPErrorGPError.CRYPTO_FAILEDAccessing key failed

Example


var k = new Key();
k.setType(Key.PRIVATE);
k.setID("openscdp");

ks.getKey(k, "1234");

getCertificate()

Prototype

getCertificate(String alias)

Description

Get named certificate from keystore.

Arguments

TypeNameDescription
StringaliasAlias name of certificate

Return

Exceptions

NameValueDescription
GPErrorGPError.ARGUMENTS_MISSINGToo few arguments in call
GPErrorGPError.INVALID_ARGUMENTSToo many arguments in call
GPErrorGPError.INVALID_TYPEType of argument is invalid for call

Example


var cert = ks.getCertificate("openscdp");
assert(cert.getSubjectDNString() == "E=support@openscdp.org,C=DE,L=Minden,O=CardContact,CN=OpenSCDP");