Class: Key

Key

Key represents a cryptographic key. It can be symmetric or asymmetric. In the case of an asymmetric key, the key can be public or private. In the case of a private asymmetric key, the getPublicKey() method allows to retrieve the corresponding public-key. A key can be referenced via the Subject Key Identifier (SKI) and resolvable by the appropriate CryptoSuite implementation

new Key()

Methods


<abstract> getHandle()

Returns the key's HSM handle in string format
Returns:
The handle identifier of this key as a hexidecial encoded string
Type
string

<abstract> getPublicKey()

Returns the corresponding public key if this key is an asymmetric private key. If this key is already public, returns this key itself.
Returns:
the corresponding public key if this key is an asymmetric private key. If this key is already public, returns this key itself.
Type
module:api.Key

<abstract> getSKI()

Returns the subject key identifier of this key
Returns:
The subject key identifier of this key as a hexidecial encoded string
Type
string

<abstract> isPrivate()

Returns true if this key is an asymmetric private key, false otherwise.
Returns:
if this key is an asymmetric private key
Type
boolean

<abstract> isSymmetric()

Returns true if this key is a symmetric key, false is this key is asymmetric
Returns:
if this key is a symmetric key
Type
boolean

<abstract> toBytes()

Converts this key to its PEM representation, if this operation is allowed.
Returns:
the PEM string representation of the key
Type
string