Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
common_pb2.NIST_P384,
ecdsa_pb2.IEEE_P1363)
ECDSA_P521_IEEE_P1363 = create_ecdsa_key_template(common_pb2.SHA512,
common_pb2.NIST_P521,
ecdsa_pb2.IEEE_P1363)
ED25519 = tink_pb2.KeyTemplate(
type_url=_ED25519_KEY_TYPE_URL, output_prefix_type=tink_pb2.TINK)
RSA_SSA_PKCS1_3072_SHA256_F4 = create_rsa_ssa_pkcs1_key_template(
common_pb2.SHA256, 3072, _RSA_F4)
RSA_SSA_PKCS1_4096_SHA512_F4 = create_rsa_ssa_pkcs1_key_template(
common_pb2.SHA512, 4096, _RSA_F4)
RSA_SSA_PSS_3072_SHA256_SHA256_32_F4 = create_rsa_ssa_pss_key_template(
common_pb2.SHA256, common_pb2.SHA256, 32, 3072, _RSA_F4)
RSA_SSA_PSS_4096_SHA512_SHA512_64_F4 = create_rsa_ssa_pss_key_template(
common_pb2.SHA512, common_pb2.SHA512, 64, 4096, _RSA_F4)
"""Creates a KeyTemplate containing an RsaSsaPssKeyFormat."""
params = rsa_ssa_pss_pb2.RsaSsaPssParams(
sig_hash=sig_hash, mgf1_hash=mgf1_hash, salt_length=salt_length)
key_format = rsa_ssa_pss_pb2.RsaSsaPssKeyFormat(
params=params,
modulus_size_in_bits=modulus_size,
public_exponent=_num_to_bytes(public_exponent))
key_template = tink_pb2.KeyTemplate(
value=key_format.SerializeToString(),
type_url=_RSA_PSS_KEY_TYPE_URL,
output_prefix_type=tink_pb2.TINK)
return key_template
ECDSA_P256 = create_ecdsa_key_template(common_pb2.SHA256, common_pb2.NIST_P256,
ecdsa_pb2.DER)
ECDSA_P384 = create_ecdsa_key_template(common_pb2.SHA512, common_pb2.NIST_P384,
ecdsa_pb2.DER)
ECDSA_P521 = create_ecdsa_key_template(common_pb2.SHA512, common_pb2.NIST_P521,
ecdsa_pb2.DER)
ECDSA_P256_IEEE_P1363 = create_ecdsa_key_template(common_pb2.SHA256,
common_pb2.NIST_P256,
ecdsa_pb2.IEEE_P1363)
ECDSA_P384_IEEE_P1363 = create_ecdsa_key_template(common_pb2.SHA512,
common_pb2.NIST_P384,
ecdsa_pb2.IEEE_P1363)
ECDSA_P521_IEEE_P1363 = create_ecdsa_key_template(common_pb2.SHA512,
common_pb2.NIST_P521,
ecdsa_pb2.IEEE_P1363)
key_template.value = key_format.SerializeToString()
key_template.type_url = _AES_CTR_HMAC_AEAD_KEY_TYPE_URL
key_template.output_prefix_type = tink_pb2.TINK
return key_template
AES128_EAX = create_aes_eax_key_template(key_size=16, iv_size=16)
AES256_EAX = create_aes_eax_key_template(key_size=32, iv_size=16)
AES128_GCM = create_aes_gcm_key_template(key_size=16)
AES256_GCM = create_aes_gcm_key_template(key_size=32)
AES128_CTR_HMAC_SHA256 = create_aes_ctr_hmac_aead_key_template(
aes_key_size=16,
iv_size=16,
hmac_key_size=32,
tag_size=16,
hash_type=common_pb2.SHA256)
AES256_CTR_HMAC_SHA256 = create_aes_ctr_hmac_aead_key_template(
aes_key_size=32,
iv_size=16,
hmac_key_size=32,
tag_size=32,
hash_type=common_pb2.SHA256)
XCHACHA20_POLY1305 = tink_pb2.KeyTemplate(
type_url=_XCHACHA20_POLY1305_KEY_TYPE_URL,
output_prefix_type=tink_pb2.TINK)
AES128_EAX = create_aes_eax_key_template(key_size=16, iv_size=16)
AES256_EAX = create_aes_eax_key_template(key_size=32, iv_size=16)
AES128_GCM = create_aes_gcm_key_template(key_size=16)
AES256_GCM = create_aes_gcm_key_template(key_size=32)
AES128_CTR_HMAC_SHA256 = create_aes_ctr_hmac_aead_key_template(
aes_key_size=16,
iv_size=16,
hmac_key_size=32,
tag_size=16,
hash_type=common_pb2.SHA256)
AES256_CTR_HMAC_SHA256 = create_aes_ctr_hmac_aead_key_template(
aes_key_size=32,
iv_size=16,
hmac_key_size=32,
tag_size=32,
hash_type=common_pb2.SHA256)
XCHACHA20_POLY1305 = tink_pb2.KeyTemplate(
type_url=_XCHACHA20_POLY1305_KEY_TYPE_URL,
output_prefix_type=tink_pb2.TINK)
key_format = ecies_aead_hkdf_pb2.EciesAeadHkdfKeyFormat()
key_format.params.kem_params.curve_type = curve_type
key_format.params.kem_params.hkdf_hash_type = hash_type
key_format.params.dem_params.aead_dem.CopyFrom(dem_key_template)
key_format.params.ec_point_format = ec_point_format
key_template = tink_pb2.KeyTemplate()
key_template.type_url = (
'type.googleapis.com/google.crypto.tink.EciesAeadHkdfPrivateKey')
key_template.value = key_format.SerializeToString()
key_template.output_prefix_type = tink_pb2.TINK
return key_template
ECIES_P256_HKDF_HMAC_SHA256_AES128_GCM = create_ecies_aead_hkdf_key_template(
curve_type=common_pb2.NIST_P256,
ec_point_format=common_pb2.UNCOMPRESSED,
hash_type=common_pb2.SHA256,
dem_key_template=aead_key_templates.AES128_GCM)
ECIES_P256_HKDF_HMAC_SHA256_AES128_CTR_HMAC_SHA256 = (
create_ecies_aead_hkdf_key_template(
curve_type=common_pb2.NIST_P256,
ec_point_format=common_pb2.UNCOMPRESSED,
hash_type=common_pb2.SHA256,
dem_key_template=aead_key_templates.AES128_CTR_HMAC_SHA256))
'type.googleapis.com/google.crypto.tink.EciesAeadHkdfPrivateKey')
key_template.value = key_format.SerializeToString()
key_template.output_prefix_type = tink_pb2.TINK
return key_template
ECIES_P256_HKDF_HMAC_SHA256_AES128_GCM = create_ecies_aead_hkdf_key_template(
curve_type=common_pb2.NIST_P256,
ec_point_format=common_pb2.UNCOMPRESSED,
hash_type=common_pb2.SHA256,
dem_key_template=aead_key_templates.AES128_GCM)
ECIES_P256_HKDF_HMAC_SHA256_AES128_CTR_HMAC_SHA256 = (
create_ecies_aead_hkdf_key_template(
curve_type=common_pb2.NIST_P256,
ec_point_format=common_pb2.UNCOMPRESSED,
hash_type=common_pb2.SHA256,
dem_key_template=aead_key_templates.AES128_CTR_HMAC_SHA256))