Class ProtoKey
- java.lang.Object
-
- com.google.crypto.tink.tinkkey.internal.ProtoKey
-
- All Implemented Interfaces:
TinkKey
@Immutable public final class ProtoKey extends java.lang.Object implements TinkKey
Wraps the protoKeyDataas an implementation of aTinkKey. The underlyingKeyDatadetermines whether this ProtoKey has a secret.ProtoKey is not intended for use outside of the Tink project.
-
-
Constructor Summary
Constructors Constructor Description ProtoKey(com.google.crypto.tink.proto.KeyData keyData, KeyTemplate.OutputPrefixType opt)Constructs a ProtoKey withhasSecret()returning true if the inputKeyDatahas key material of type UNKNOWN_KEYMATERIAL, SYMMETRIC, or ASYMMETRIC_PRIVATE.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KeyTemplategetKeyTemplate()ATinkKeyshould know theKeyTemplatefrom which it was generated, which in turn specifies the cryptographic algorithm in which theTinkKeyshould be used.KeyTemplate.OutputPrefixTypegetOutputPrefixType()com.google.crypto.tink.proto.KeyDatagetProtoKey()booleanhasSecret()Returns true if the key contains secret key material, and false otherwise.
-
-
-
Constructor Detail
-
ProtoKey
public ProtoKey(com.google.crypto.tink.proto.KeyData keyData, KeyTemplate.OutputPrefixType opt)Constructs a ProtoKey withhasSecret()returning true if the inputKeyDatahas key material of type UNKNOWN_KEYMATERIAL, SYMMETRIC, or ASYMMETRIC_PRIVATE.
-
-
Method Detail
-
getProtoKey
public com.google.crypto.tink.proto.KeyData getProtoKey()
-
getOutputPrefixType
public KeyTemplate.OutputPrefixType getOutputPrefixType()
-
hasSecret
public boolean hasSecret()
Description copied from interface:TinkKeyReturns true if the key contains secret key material, and false otherwise.
-
getKeyTemplate
public KeyTemplate getKeyTemplate()
Description copied from interface:TinkKeyATinkKeyshould know theKeyTemplatefrom which it was generated, which in turn specifies the cryptographic algorithm in which theTinkKeyshould be used. Throws UnsupportedOperationException to help ease rollout until it is possible to easily find the KeyTemplate associated to a key described in proto- Specified by:
getKeyTemplatein interfaceTinkKey- Returns:
- the
KeyTemplateused to generate the key. - Throws:
java.lang.UnsupportedOperationException- There is currently no direct way of getting aKeyTemplatefromKeyData.
-
-