Class: MemoryIdentityStorage

MemoryIdentityStorage

new MemoryIdentityStorage()

MemoryIdentityStorage extends IdentityStorage and implements its methods to store identity, public key and certificate objects in memory. The application must get the objects through its own means and add the objects to the MemoryIdentityStorage object. To use permanent file-based storage, see BasicIdentityStorage.
Source:

Methods

activateKey(keyName)

Activate a key. If a key is marked as inactive, its private part will not be used in packet signing.
Parameters:
Name Type Description
keyName Name name of the key
Source:

addCertificate(certificate)

Add a certificate to the identity storage.
Parameters:
Name Type Description
certificate IdentityCertificate The certificate to be added. This makes a copy of the certificate.
Source:

addIdentity(identityName)

Add a new identity. Do nothing if the identity already exists.
Parameters:
Name Type Description
identityName Name The identity name to be added.
Source:

addKey(keyName, keyType, publicKeyDer)

Add a public key to the identity storage. Also call addIdentity to ensure that the identityName for the key exists.
Parameters:
Name Type Description
keyName Name The name of the public key to be added.
keyType number Type of the public key to be added from KeyType, such as KeyType.RSA..
publicKeyDer Blob A blob of the public key DER to be added.
Source:

deactivateKey(keyName)

Deactivate a key. If a key is marked as inactive, its private part will not be used in packet signing.
Parameters:
Name Type Description
keyName Name name of the key
Source:

deleteCertificateInfo(certificateName)

Delete a certificate.
Parameters:
Name Type Description
certificateName Name The certificate name.
Source:

deleteIdentityInfo(identity)

Delete an identity and related public keys and certificates.
Parameters:
Name Type Description
identity Name The identity name.
Source:

deletePublicKeyInfo(keyName)

Delete a public key and related certificates.
Parameters:
Name Type Description
keyName Name The key name.
Source:

doesCertificateExist(certificateName) → {boolean}

Check if the specified certificate already exists.
Parameters:
Name Type Description
certificateName Name The name of the certificate.
Source:
Returns:
true if the certificate exists, otherwise false.
Type
boolean

doesIdentityExist(identityName) → {boolean}

Check if the specified identity already exists.
Parameters:
Name Type Description
identityName Name The identity name.
Source:
Returns:
true if the identity exists, otherwise false.
Type
boolean

doesKeyExist(keyName) → {boolean}

Check if the specified key already exists.
Parameters:
Name Type Description
keyName Name The name of the key.
Source:
Returns:
true if the key exists, otherwise false.
Type
boolean

getCertificate(certificateName, allowAny) → {IdentityCertificate}

Get a certificate from the identity storage.
Parameters:
Name Type Description
certificateName Name The name of the requested certificate.
allowAny boolean (optional) If false, only a valid certificate will be returned, otherwise validity is disregarded. If omitted, allowAny is false.
Source:
Returns:
The requested certificate. If not found, return null.
Type
IdentityCertificate

getDefaultCertificateNameForKey(keyName) → {Name}

Get the default certificate name for the specified key.
Parameters:
Name Type Description
keyName Name The key name.
Source:
Throws:
SecurityException if the default certificate name for the key name is not set.
Returns:
The default certificate name.
Type
Name

getDefaultIdentity() → {Name}

Get the default identity.
Source:
Throws:
SecurityException if the default identity is not set.
Returns:
The name of default identity.
Type
Name

getDefaultKeyNameForIdentity(identityName) → {Name}

Get the default key name for the specified identity.
Parameters:
Name Type Description
identityName Name The identity name.
Source:
Throws:
SecurityException if the default key name for the identity is not set.
Returns:
The default key name.
Type
Name

getKey(keyName) → {Blob}

Get the public key DER blob from the identity storage.
Parameters:
Name Type Description
keyName Name The name of the requested public key.
Source:
Returns:
The DER Blob. If not found, return a Blob with a null pointer.
Type
Blob

revokeIdentity() → {boolean}

Revoke the identity.
Source:
Returns:
true if the identity was revoked, false if not.
Type
boolean

setDefaultCertificateNameForKey(keyName, certificateName)

Set the default key name for the specified identity.
Parameters:
Name Type Description
keyName Name The key name.
certificateName Name The certificate name.
Source:

setDefaultIdentity(identityName)

Set the default identity. If the identityName does not exist, then clear the default identity so that getDefaultIdentity() throws an exception.
Parameters:
Name Type Description
identityName Name The default identity name.
Source:

setDefaultKeyNameForIdentity(keyName, identityNameCheck)

Set the default key name for the specified identity.
Parameters:
Name Type Description
keyName Name The key name.
identityNameCheck Name (optional) The identity name to check the keyName.
Source: