new TpmBackEnd()
TpmBackEnd is an abstract base class for a TPM backend implementation which
provides a TpmKeyHandle to the TPM front end. This class defines the
interface that an actual TPM backend implementation should provide, for
example TpmBackEndMemory.
- Source:
Classes
Methods
(static) setKeyName(keyHandle, identityName, params)
Set the key name in keyHandle according to identityName and params.
Parameters:
Name | Type | Description |
---|---|---|
keyHandle |
TpmKeyHandle | |
identityName |
Name | |
params |
KeyParams |
- Source:
createKeyPromise(identityName, params, useSync) → {Promise|SyncPromise}
Create a key for the identityName according to params.
Parameters:
Name | Type | Description |
---|---|---|
identityName |
Name | The name if the identity. |
params |
KeyParams | The KeyParams for creating the key. |
useSync |
boolean | (optional) If true then return a SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- Source:
Returns:
A promise which returns a TpmKeyHandle of the
created key, or a promise rejected with TpmBackEnd.Error if the key cannot be
created.
- Type
- Promise | SyncPromise
deleteKeyPromise(keyName, useSync) → {Promise|SyncPromise}
Delete the key with name keyName. If the key doesn't exist, do nothing.
Note: Continuing to use existing Key handles on a deleted key results in
undefined behavior.
Parameters:
Name | Type | Description |
---|---|---|
keyName |
Name | The name of the key to delete. |
useSync |
boolean | (optional) If true then return a SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- Source:
Returns:
A promise which fulfills when finished, or a
promise rejected with TpmBackEnd.Error if the deletion fails.
- Type
- Promise | SyncPromise
doCreateKeyPromise_(identityName, params, useSync) → {Promise|SyncPromise}
A protected method to create a key for identityName according to params. The
created key is named as: //[keyId]/KEY . The key name is set in
the returned TpmKeyHandle.
Parameters:
Name | Type | Description |
---|---|---|
identityName |
Name | The name if the identity. |
params |
KeyParams | The KeyParams for creating the key. |
useSync |
boolean | (optional) If true then return a SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- Source:
Returns:
A promise which returns the TpmKeyHandle of
the created key, or a promise rejected with TpmBackEnd.Error if the key
cannot be created.
- Type
- Promise | SyncPromise
doDeleteKeyPromise_(keyName, useSync) → {Promise|SyncPromise}
A protected method to delete the key with name keyName. If the key doesn't
exist, do nothing.
Parameters:
Name | Type | Description |
---|---|---|
keyName |
Name | The name of the key to delete. |
useSync |
boolean | (optional) If true then return a SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- Source:
Returns:
A promise which fulfills when finished, or a
promise rejected with TpmBackEnd.Error if the deletion fails.
- Type
- Promise | SyncPromise
doGetKeyHandlePromise_(keyName, useSync) → {Promise|SyncPromise}
A protected method to get the handle of the key with name keyName.
Parameters:
Name | Type | Description |
---|---|---|
keyName |
Name | The name of the key. |
useSync |
boolean | (optional) If true then return a SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- Source:
Returns:
A promise which returns a TpmKeyHandle of the
key, or returns null if the key does not exist.
- Type
- Promise | SyncPromise
doHasKeyPromise_(keyName, useSync) → {Promise|SyncPromise}
A protected method to check if the key with name keyName exists in the TPM.
Parameters:
Name | Type | Description |
---|---|---|
keyName |
Name | The name of the key. |
useSync |
boolean | (optional) If true then return a SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- Source:
Returns:
A promise which returns true if the key exists.
- Type
- Promise | SyncPromise
doImportKeyPromise_(keyName, pkcs8, password, useSync) → {Promise|SyncPromise}
A protected method to import an encoded private key with name keyName in
PKCS #8 format, possibly password-encrypted.
Parameters:
Name | Type | Description |
---|---|---|
keyName |
Name | The name of the key to use in the TPM. |
pkcs8 |
Buffer | The input byte buffer. If the password is supplied, this is a PKCS #8 EncryptedPrivateKeyInfo. If the password is none, this is an unencrypted PKCS #8 PrivateKeyInfo. |
password |
Buffer | The password for decrypting the private key. If the password is supplied, use it to decrypt the PKCS #8 EncryptedPrivateKeyInfo. If the password is null, import an unencrypted PKCS #8 PrivateKeyInfo. |
useSync |
boolean | (optional) If true then return a SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- Source:
Returns:
A promise which fulfills when finished, or a
promise rejected with TpmBackEnd.Error for an error importing the key.
- Type
- Promise | SyncPromise
getKeyHandlePromise(keyName, useSync) → {Promise|SyncPromise}
Get the handle of the key with name keyName. Calling getKeyHandle multiple
times with the same keyName will return different TpmKeyHandle objects that
all refer to the same key.
Parameters:
Name | Type | Description |
---|---|---|
keyName |
Name | The name of the key. |
useSync |
boolean | (optional) If true then return a SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- Source:
Returns:
A promise which returns a TpmKeyHandle of the
key, or returns null if the key does not exist.
- Type
- Promise | SyncPromise
hasKeyPromise(keyName, useSync) → {SyncPromise}
Check if the key with name keyName exists in the TPM.
Parameters:
Name | Type | Description |
---|---|---|
keyName |
Name | The name of the key. |
useSync |
boolean | (optional) If true then return a SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- Source:
Returns:
A promise which returns true if the key exists.
- Type
- SyncPromise
importKeyPromise(keyName, pkcs8, password, useSync) → {Promise|SyncPromise}
Import an encoded private key with name keyName in PKCS #8 format, possibly
password-encrypted.
Parameters:
Name | Type | Description |
---|---|---|
keyName |
Name | The name of the key to use in the TPM. |
pkcs8 |
Buffer | The input byte buffer. If the password is supplied, this is a PKCS #8 EncryptedPrivateKeyInfo. If the password is none, this is an unencrypted PKCS #8 PrivateKeyInfo. |
password |
Buffer | The password for decrypting the private key. If the password is supplied, use it to decrypt the PKCS #8 EncryptedPrivateKeyInfo. If the password is null, import an unencrypted PKCS #8 PrivateKeyInfo. |
useSync |
boolean | (optional) If true then return a SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- Source:
Returns:
A promise which fulfills when finished, or a
promise rejected with TpmBackEnd.Error for an error importing the key.
- Type
- Promise | SyncPromise