public abstract class TpmBackEnd extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
TpmBackEnd.Error
A TpmBackEnd.Error extends Exception and represents a non-semantic
error in backend TPM processing.
|
| Constructor and Description |
|---|
TpmBackEnd() |
| Modifier and Type | Method and Description |
|---|---|
TpmKeyHandle |
createKey(Name identityName,
KeyParams params)
Create a key for the identityName according to params.
|
void |
deleteKey(Name keyName)
Delete the key with name keyName.
|
protected abstract TpmKeyHandle |
doCreateKey(Name identityName,
KeyParams params)
Create a key for identityName according to params.
|
protected abstract void |
doDeleteKey(Name keyName)
Delete the key with name keyName.
|
protected Blob |
doExportKey(Name keyName,
ByteBuffer password)
Get the encoded private key with name keyName in PKCS #8 format, possibly
password-encrypted.
|
protected abstract TpmKeyHandle |
doGetKeyHandle(Name keyName)
Get the handle of the key with name keyName.
|
protected abstract boolean |
doHasKey(Name keyName)
Check if the key with name keyName exists in the TPM.
|
protected void |
doImportKey(Name keyName,
ByteBuffer pkcs8,
ByteBuffer password)
Import an encoded private key with name keyName in PKCS #8 format, possibly
password-encrypted.
|
Blob |
exportKey(Name keyName,
ByteBuffer password)
Get the encoded private key with name keyName in PKCS #8 format, possibly
password-encrypted.
|
TpmKeyHandle |
getKeyHandle(Name keyName)
Get the handle of the key with name keyName.
|
boolean |
hasKey(Name keyName)
Check if the key with name keyName exists in the TPM.
|
void |
importKey(Name keyName,
ByteBuffer pkcs8,
ByteBuffer password)
Import an encoded private key with name keyName in PKCS #8 format, possibly
password-encrypted.
|
boolean |
isTerminalMode()
Check if the TPM is in terminal mode.
|
boolean |
isTpmLocked()
Check if the TPM is locked.
|
protected static void |
setKeyName(TpmKeyHandle keyHandle,
Name identityName,
KeyParams params)
Set the key name in keyHandle according to identityName and params.
|
void |
setTerminalMode(boolean isTerminal)
Set the terminal mode of the TPM.
|
boolean |
unlockTpm(ByteBuffer password)
Unlock the TPM.
|
public final boolean hasKey(Name keyName) throws TpmBackEnd.Error
keyName - The name of the key.TpmBackEnd.Errorpublic final TpmKeyHandle getKeyHandle(Name keyName) throws TpmBackEnd.Error
keyName - The name of the key.TpmBackEnd.Errorpublic final TpmKeyHandle createKey(Name identityName, KeyParams params) throws TpmBackEnd.Error, Tpm.Error
identityName - The name if the identity.params - The KeyParams for creating the key.Tpm.Error - if params is invalid.TpmBackEnd.Error - if the key cannot be created.public final void deleteKey(Name keyName) throws TpmBackEnd.Error
keyName - The name of the key to delete.TpmBackEnd.Error - if the deletion fails.public final Blob exportKey(Name keyName, ByteBuffer password) throws TpmBackEnd.Error
keyName - The name of the key in the TPM.password - The password for encrypting the private key, which should
have characters in the range of 1 to 127. If the password is supplied, use
it to return a PKCS #8 EncryptedPrivateKeyInfo. If the password is null,
return an unencrypted PKCS #8 PrivateKeyInfo.TpmBackEnd.Error - if the key does not exist or if the key cannot be
exported, e.g., insufficient privileges.public final void importKey(Name keyName, ByteBuffer pkcs8, ByteBuffer password) throws TpmBackEnd.Error
keyName - The name of the key to use in the TPM.pkcs8 - The input byte buffer. If the password is supplied, this is a
PKCS #8 EncryptedPrivateKeyInfo. If the password is null, this is an
unencrypted PKCS #8 PrivateKeyInfo.password - The password for decrypting the private key, which should
have characters in the range of 1 to 127. If the password is supplied, use
it to decrypt the PKCS #8 EncryptedPrivateKeyInfo. If the password is null,
import an unencrypted PKCS #8 PrivateKeyInfo.TpmBackEnd.Error - if a key with name keyName already exists, or for
an error importing the key.public boolean isTerminalMode()
throws TpmBackEnd.Error
TpmBackEnd.Errorpublic void setTerminalMode(boolean isTerminal)
throws TpmBackEnd.Error
isTerminal - True to enable terminal mode.TpmBackEnd.Errorpublic boolean isTpmLocked()
throws TpmBackEnd.Error
TpmBackEnd.Errorpublic boolean unlockTpm(ByteBuffer password) throws TpmBackEnd.Error
password - The password to unlock TPM.TpmBackEnd.Errorprotected static void setKeyName(TpmKeyHandle keyHandle, Name identityName, KeyParams params) throws TpmBackEnd.Error
TpmBackEnd.Errorprotected abstract boolean doHasKey(Name keyName) throws TpmBackEnd.Error
keyName - The name of the key.TpmBackEnd.Errorprotected abstract TpmKeyHandle doGetKeyHandle(Name keyName) throws TpmBackEnd.Error
keyName - The name of the key.TpmBackEnd.Errorprotected abstract TpmKeyHandle doCreateKey(Name identityName, KeyParams params) throws TpmBackEnd.Error
identityName - The name if the identity.params - The KeyParams for creating the key.TpmBackEnd.Error - if the key cannot be created.protected abstract void doDeleteKey(Name keyName) throws TpmBackEnd.Error
keyName - The name of the key to delete.TpmBackEnd.Error - if the deletion fails.protected Blob doExportKey(Name keyName, ByteBuffer password) throws TpmBackEnd.Error
keyName - The name of the key in the TPM.password - The password for encrypting the private key, which should
have characters in the range of 1 to 127. If the password is supplied, use
it to return a PKCS #8 EncryptedPrivateKeyInfo. If the password is null,
return an unencrypted PKCS #8 PrivateKeyInfo.TpmBackEnd.Error - if the key does not exist or if the key cannot be
exported, e.g., insufficient privileges.protected void doImportKey(Name keyName, ByteBuffer pkcs8, ByteBuffer password) throws TpmBackEnd.Error
keyName - The name of the key to use in the TPM.pkcs8 - The input byte buffer. If the password is supplied, this is a
PKCS #8 EncryptedPrivateKeyInfo. If the password is null, this is an
unencrypted PKCS #8 PrivateKeyInfo.password - The password for decrypting the private key, which should
have characters in the range of 1 to 127. If the password is supplied, use
it to decrypt the PKCS #8 EncryptedPrivateKeyInfo. If the password is null,
import an unencrypted PKCS #8 PrivateKeyInfo.TpmBackEnd.Error - for an error importing the key.Copyright © 2019. All rights reserved.