public final class SignatureKeyTemplates extends Object
KeyTemplate for PublicKeySign and PublicKeyVerify.
We recommend to avoid this class in order to keep dependencies small.
Instead, we recommend to use KeysetHandle.generateEntryFromParametersName or KeysetHandle.generateEntryFromParameters.
One can use these templates to generate new Keyset with
KeysetHandle. To generate a new keyset that contains a single
EcdsaPrivateKey, one can do:
Config.register(SignatureConfig.TINK_1_1_0);
KeysetHandle handle = KeysetHandle.generateNew(SignatureKeyTemplates.ECDSA_P256);
PublicKeySign signer = handle.getPrimitive(PublicKeySign.class);
PublicKeyVerify verifier = handle.getPublicKeyset().getPrimitive(PublicKeyVerify.class);
| Modifier and Type | Field and Description |
|---|---|
static KeyTemplate |
ECDSA_P256
A
KeyTemplate that generates new instances of EcdsaPrivateKey with the following parameters:
Hash function: SHA256
Curve: NIST P-256
Signature encoding: DER (this is the encoding that Java uses). |
static KeyTemplate |
ECDSA_P256_IEEE_P1363
A
KeyTemplate that generates new instances of EcdsaPrivateKey with the following parameters:
Hash function: SHA256
Curve: NIST P-256
Signature encoding: IEEE_P1363 (this is the encoding that JWS and WebCrypto use). |
static KeyTemplate |
ECDSA_P256_IEEE_P1363_WITHOUT_PREFIX
A
KeyTemplate that generates new instances of EcdsaPrivateKey with the following parameters:
Hash function: SHA256
Curve: NIST P-256
Signature encoding: DER (this is the encoding that Java uses). |
static KeyTemplate |
ECDSA_P384
A
KeyTemplate that generates new instances of EcdsaPrivateKey with the following parameters:
Hash function: SHA512
Curve: NIST P-384
Signature encoding: DER (this is the encoding that Java uses). |
static KeyTemplate |
ECDSA_P384_IEEE_P1363
A
KeyTemplate that generates new instances of EcdsaPrivateKey with the following parameters:
Hash function: SHA512
Curve: NIST P-384
Signature encoding: IEEE_P1363 (this is the encoding that JWS and WebCrypto use). |
static KeyTemplate |
ECDSA_P521
A
KeyTemplate that generates new instances of EcdsaPrivateKey with the following parameters:
Hash function: SHA512
Curve: NIST P-521
Signature encoding: DER (this is the encoding that Java uses). |
static KeyTemplate |
ECDSA_P521_IEEE_P1363
A
KeyTemplate that generates new instances of EcdsaPrivateKey with the following parameters:
Hash function: SHA512
Curve: NIST P-521
Signature encoding: IEEE_P1363 (this is the encoding that JWS and WebCrypto use). |
static KeyTemplate |
ED25519
A
KeyTemplate that generates new instances of Ed25519PrivateKey. |
static KeyTemplate |
ED25519WithRawOutput
A
KeyTemplate that generates new instances of com.google.crypto.tink.proto.ED25519PrivateKey. |
static KeyTemplate |
RSA_SSA_PKCS1_3072_SHA256_F4
A
KeyTemplate that generates new instances of RsaSsaPkcs1PrivateKey with the following parameters:
Hash function: SHA256. |
static KeyTemplate |
RSA_SSA_PKCS1_3072_SHA256_F4_WITHOUT_PREFIX
A
KeyTemplate that generates new instances of RsaSsaPkcs1PrivateKey with the following parameters:
Hash function: SHA256. |
static KeyTemplate |
RSA_SSA_PKCS1_4096_SHA512_F4
A
KeyTemplate that generates new instances of RsaSsaPkcs1PrivateKey with the following parameters:
Hash function: SHA512. |
static KeyTemplate |
RSA_SSA_PSS_3072_SHA256_SHA256_32_F4
A
KeyTemplate that generates new instances of RsaSsaPssPrivateKey with the following parameters:
Signature hash: SHA256. |
static KeyTemplate |
RSA_SSA_PSS_4096_SHA512_SHA512_64_F4
A
KeyTemplate that generates new instances of RsaSsaPssPrivateKey with the following parameters:
Signature hash: SHA512. |
| Modifier and Type | Method and Description |
|---|---|
static KeyTemplate |
createEcdsaKeyTemplate(HashType hashType,
EllipticCurveType curve,
EcdsaSignatureEncoding encoding,
OutputPrefixType prefixType) |
static KeyTemplate |
createRsaSsaPkcs1KeyTemplate(HashType hashType,
int modulusSize,
BigInteger publicExponent,
OutputPrefixType prefixType) |
static KeyTemplate |
createRsaSsaPssKeyTemplate(HashType sigHash,
HashType mgf1Hash,
int saltLength,
int modulusSize,
BigInteger publicExponent) |
public static final KeyTemplate ECDSA_P256
KeyTemplate that generates new instances of EcdsaPrivateKey with the following parameters:
OutputPrefixType.TINK
public static final KeyTemplate ECDSA_P384
KeyTemplate that generates new instances of EcdsaPrivateKey with the following parameters:
OutputPrefixType.TINK
public static final KeyTemplate ECDSA_P521
KeyTemplate that generates new instances of EcdsaPrivateKey with the following parameters:
OutputPrefixType.TINK
public static final KeyTemplate ECDSA_P256_IEEE_P1363
KeyTemplate that generates new instances of EcdsaPrivateKey with the following parameters:
OutputPrefixType.TINK
public static final KeyTemplate ECDSA_P384_IEEE_P1363
KeyTemplate that generates new instances of EcdsaPrivateKey with the following parameters:
OutputPrefixType.TINK
public static final KeyTemplate ECDSA_P256_IEEE_P1363_WITHOUT_PREFIX
KeyTemplate that generates new instances of EcdsaPrivateKey with the following parameters:
public static final KeyTemplate ECDSA_P521_IEEE_P1363
KeyTemplate that generates new instances of EcdsaPrivateKey with the following parameters:
OutputPrefixType.TINK
public static final KeyTemplate ED25519
KeyTemplate that generates new instances of Ed25519PrivateKey.public static final KeyTemplate ED25519WithRawOutput
KeyTemplate that generates new instances of com.google.crypto.tink.proto.ED25519PrivateKey.
The difference between ED25519WithRawOutput and ED25519 is the format of
signatures generated. ED25519WithRawOutput generates signatures of
OutputPrefixType.RAW format, which is 64 bytes long.public static final KeyTemplate RSA_SSA_PKCS1_3072_SHA256_F4
KeyTemplate that generates new instances of RsaSsaPkcs1PrivateKey with the following parameters:
OutputPrefixType.TINK
public static final KeyTemplate RSA_SSA_PKCS1_3072_SHA256_F4_WITHOUT_PREFIX
KeyTemplate that generates new instances of RsaSsaPkcs1PrivateKey with the following parameters:
public static final KeyTemplate RSA_SSA_PKCS1_4096_SHA512_F4
KeyTemplate that generates new instances of RsaSsaPkcs1PrivateKey with the following parameters:
OutputPrefixType.TINK
public static final KeyTemplate RSA_SSA_PSS_3072_SHA256_SHA256_32_F4
KeyTemplate that generates new instances of RsaSsaPssPrivateKey with the following parameters:
public static final KeyTemplate RSA_SSA_PSS_4096_SHA512_SHA512_64_F4
KeyTemplate that generates new instances of RsaSsaPssPrivateKey with the following parameters:
public static KeyTemplate createEcdsaKeyTemplate(HashType hashType, EllipticCurveType curve, EcdsaSignatureEncoding encoding, OutputPrefixType prefixType)
KeyTemplate containing a EcdsaKeyFormat with some specified
parameters.public static KeyTemplate createRsaSsaPkcs1KeyTemplate(HashType hashType, int modulusSize, BigInteger publicExponent, OutputPrefixType prefixType)
KeyTemplate containing a RsaSsaPkcs1KeyFormat with some specified
parameters.public static KeyTemplate createRsaSsaPssKeyTemplate(HashType sigHash, HashType mgf1Hash, int saltLength, int modulusSize, BigInteger publicExponent)
KeyTemplate containing a RsaSsaPssKeyFormat with some specified
parameters.