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.
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 |
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. |
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. |
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. |
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 |
deleteCertificateInfo(certificateName)
Delete a certificate.
Parameters:
| Name | Type | Description |
|---|---|---|
certificateName |
Name | The certificate name. |
deleteIdentityInfo(identity)
Delete an identity and related public keys and certificates.
Parameters:
| Name | Type | Description |
|---|---|---|
identity |
Name | The identity name. |
deletePublicKeyInfo(keyName)
Delete a public key and related certificates.
Parameters:
| Name | Type | Description |
|---|---|---|
keyName |
Name | The key name. |
doesCertificateExist(certificateName) → {boolean}
Check if the specified certificate already exists.
Parameters:
| Name | Type | Description |
|---|---|---|
certificateName |
Name | The name of the certificate. |
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. |
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. |
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. |
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. |
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. |
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. |
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.
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. |
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. |
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. |
Returns:
The generated key name.
- Type
- Name
revokeIdentity() → {boolean}
Revoke the identity.
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. |
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. |
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. |