Key instead.@Immutable @Deprecated public class KeyHandle extends Object
TinkKey and enforces access to the underlying TinkKey with KeyAccess. Specifically, if the underlying TinkKey has a secret, then one can only get
it with a SecretKeyAccess instance.| Modifier and Type | Class and Description |
|---|---|
static class |
KeyHandle.KeyStatusType
Deprecated.
KeyStatusType is metadata associated to a key which is only meaningful when the key is part of
a
Keyset. |
| Modifier | Constructor and Description |
|---|---|
protected |
KeyHandle(TinkKey key,
KeyHandle.KeyStatusType status,
int keyId)
Deprecated.
Constructor intended for Tink internal purposes; allows one to set all the member variables of
a
KeyHandle. |
| Modifier and Type | Method and Description |
|---|---|
static KeyHandle |
createFromKey(KeyData keyData,
KeyTemplate.OutputPrefixType opt)
Deprecated.
Use the KeyHandle(TinkKey, KeyAccess) constructor instead.
|
static KeyHandle |
createFromKey(TinkKey key,
KeyAccess access)
Deprecated.
|
static KeyHandle |
generateNew(KeyTemplate keyTemplate)
Deprecated.
Generates a new
KeyHandle that contains a fresh key generated according to keyTemplate. |
int |
getId()
Deprecated.
Returns the key ID of this key.
|
TinkKey |
getKey(KeyAccess access)
Deprecated.
Returns the underlying
TinkKey key if access is a SecretKeyAccess and
the key has a secret, or if the key does not have a secret, otherwise throws a GeneralSecurityException. |
KeyTemplate |
getKeyTemplate()
Deprecated.
Returns the
KeyTemplate of the underlying TinkKey. |
KeyHandle.KeyStatusType |
getStatus()
Deprecated.
Returns the status of the key.
|
boolean |
hasSecret()
Deprecated.
Returns
true if the underlying TinkKey has a secret. |
protected KeyHandle(TinkKey key, KeyHandle.KeyStatusType status, int keyId)
KeyHandle.public static KeyHandle createFromKey(TinkKey key, KeyAccess access) throws GeneralSecurityException
KeyHandle instance with key as the underlying TinkKey if the
caller provides the correct KeyAccess instance.GeneralSecurityException - if access does not grant access to key@Deprecated public static KeyHandle createFromKey(KeyData keyData, KeyTemplate.OutputPrefixType opt)
public static KeyHandle generateNew(KeyTemplate keyTemplate) throws GeneralSecurityException
KeyHandle that contains a fresh key generated according to keyTemplate.GeneralSecurityException - if the key template's type URL has not been registered with
the Registry.public boolean hasSecret()
true if the underlying TinkKey has a secret.public KeyHandle.KeyStatusType getStatus()
KeyHandle.KeyStatusType.public int getId()
public TinkKey getKey(KeyAccess access) throws GeneralSecurityException
TinkKey key if access is a SecretKeyAccess and
the key has a secret, or if the key does not have a secret, otherwise throws a GeneralSecurityException.GeneralSecurityExceptionpublic KeyTemplate getKeyTemplate()
KeyTemplate of the underlying TinkKey.UnsupportedOperationException - if the underlying TinkKey has not implemented
getKeyTemplate().