Class: IdentityStorage

IdentityStorage

new IdentityStorage()

IdentityStorage is a base class for the storage of identity, public keys and certificates. Private keys are stored in PrivateKeyStorage. This is an abstract base class. A subclass must implement the methods.
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

getAllKeyNamesOfIdentity(identityName, nameList, isDefault)

Append all the key names of a particular identity to the nameList.
Parameters:
Name Type Description
identityName Name The identity name to search for.
nameList Array.<Name> Append result names to nameList.
isDefault boolean If true, add only the default key name. If false, add only the non-default key names.
Source:

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 a shared_ptr with a null pointer.
Type
IdentityCertificate

getDefaultCertificateNameForIdentity(identityName) → {Name}

Get the default certificate 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 or the default certificate name for the key name is not set.
Returns:
The default certificate name.
Type
Name

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

getNewKeyName(identityName, useKsk) → {Name}

Generate a name for a new key belonging to the identity.
Parameters:
Name Type Description
identityName Name The identity name.
useKsk boolean If true, generate a KSK name, otherwise a DSK name.
Source:
Returns:
The generated key name.
Type
Name

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: