Skip to content

Commit

Permalink
Remove deprecation notices from KeyManager keyTemplate functions.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 509798165
Change-Id: I3f10e9a25c0ca920401a8e1a0f47662b63fc2ac1
  • Loading branch information
tholenst authored and copybara-github committed Feb 15, 2023
1 parent cafe434 commit 41e7486
Show file tree
Hide file tree
Showing 19 changed files with 1 addition and 148 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,7 @@ public static void register(boolean newKeyAllowed) throws GeneralSecurityExcepti
* <li>HMAC tag size: 16 bytes
* <li>HMAC hash function: SHA256
* </ul>
*
* @deprecated use {@code KeyTemplates.get("AES128_CTR_HMAC_SHA256")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate aes128CtrHmacSha256Template() {
return createKeyTemplate(16, 16, 32, 16, HashType.SHA256);
}
Expand All @@ -181,10 +178,7 @@ public static final KeyTemplate aes128CtrHmacSha256Template() {
* <li>HMAC tag size: 32 bytes
* <li>HMAC hash function: SHA256
* </ul>
*
* @deprecated use {@code KeyTemplates.get("AES256_CTR_HMAC_SHA256")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate aes256CtrHmacSha256Template() {
return createKeyTemplate(32, 16, 32, 32, HashType.SHA256);
}
Expand Down
12 changes: 0 additions & 12 deletions src/main/java/com/google/crypto/tink/aead/AesEaxKeyManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,7 @@ public static void register(boolean newKeyAllowed) throws GeneralSecurityExcepti
* <li>IV size: 16 bytes
* <li>Prefix type: {@link KeyTemplate.OutputPrefixType#TINK}
* </ul>
*
* @deprecated use {@code KeyTemplates.get("AES128_EAX")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate aes128EaxTemplate() {
return createKeyTemplate(16, 16, KeyTemplate.OutputPrefixType.TINK);
}
Expand All @@ -153,10 +150,7 @@ public static final KeyTemplate aes128EaxTemplate() {
* <li>IV size: 16 bytes
* <li>Prefix type: {@link KeyTemplate.OutputPrefixType#RAW} (no prefix)
* </ul>
*
* @deprecated use {@code KeyTemplates.get("AES128_EAX_RAW")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate rawAes128EaxTemplate() {
return createKeyTemplate(16, 16, KeyTemplate.OutputPrefixType.RAW);
}
Expand All @@ -169,10 +163,7 @@ public static final KeyTemplate rawAes128EaxTemplate() {
* <li>IV size: 16 bytes
* <li>Prefix type: {@link KeyTemplate.OutputPrefixType#TINK}
* </ul>
*
* @deprecated use {@code KeyTemplates.get("AES256_EAX")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate aes256EaxTemplate() {
return createKeyTemplate(32, 16, KeyTemplate.OutputPrefixType.TINK);
}
Expand All @@ -185,10 +176,7 @@ public static final KeyTemplate aes256EaxTemplate() {
* <li>IV size: 16 bytes
* <li>Prefix type: {@link KeyTemplate.OutputPrefixType#RAW} (no prefix)
* </ul>
*
* @deprecated use {@code KeyTemplates.get("AES256_EAX_RAW")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate rawAes256EaxTemplate() {
return createKeyTemplate(32, 16, KeyTemplate.OutputPrefixType.RAW);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,7 @@ public static void register(boolean newKeyAllowed) throws GeneralSecurityExcepti
* <p>On Android KitKat (API level 19), the {@link com.google.crypto.tink.Aead} instance
* generated by this key template does not support associated data. It might not work at all
* in older versions.
* @deprecated use {@code KeyTemplates.get("AES128_GCM")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate aes128GcmTemplate() {
return createKeyTemplate(16, KeyTemplate.OutputPrefixType.TINK);
}
Expand All @@ -166,9 +164,7 @@ public static final KeyTemplate aes128GcmTemplate() {
* <p>On Android KitKat (API level 19), the {@link com.google.crypto.tink.Aead} instance
* generated by this key template does not support associated data. It might not work at all
* in older versions.
* @deprecated use {@code KeyTemplates.get("AES128_GCM_RAW")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate rawAes128GcmTemplate() {
return createKeyTemplate(16, KeyTemplate.OutputPrefixType.RAW);
}
Expand All @@ -183,9 +179,7 @@ public static final KeyTemplate rawAes128GcmTemplate() {
* <p>On Android KitKat (API level 19), the {@link com.google.crypto.tink.Aead} instance
* generated by this key template does not support associated data. It might not work at all
* in older versions.
* @deprecated use {@code KeyTemplates.get("AES256_GCM")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate aes256GcmTemplate() {
return createKeyTemplate(32, KeyTemplate.OutputPrefixType.TINK);
}
Expand All @@ -202,9 +196,7 @@ public static final KeyTemplate aes256GcmTemplate() {
* <p>On Android KitKat (API level 19), the {@link com.google.crypto.tink.Aead} instance
* generated by this key template does not support associated data. It might not work at all
* in older versions.
* @deprecated use {@code KeyTemplates.get("AES256_GCM_RAW")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate rawAes256GcmTemplate() {
return createKeyTemplate(32, KeyTemplate.OutputPrefixType.RAW);
}
Expand Down
12 changes: 0 additions & 12 deletions src/main/java/com/google/crypto/tink/aead/AesGcmSivKeyManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,7 @@ public static void register(boolean newKeyAllowed) throws GeneralSecurityExcepti
* <li>Key size: 16 bytes
* <li>Prefix type: {@link KeyTemplate.OutputPrefixType#TINK}
* </ul>
*
* @deprecated use {@code KeyTemplates.get("AES128_GCM_SIV")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate aes128GcmSivTemplate() {
return createKeyTemplate(16, KeyTemplate.OutputPrefixType.TINK);
}
Expand All @@ -179,10 +176,7 @@ public static final KeyTemplate aes128GcmSivTemplate() {
* </ul>
*
* <p>Keys generated from this template should create ciphertexts compatible with other libraries.
*
* @deprecated use {@code KeyTemplates.get("AES128_GCM_SIV_RAW")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate rawAes128GcmSivTemplate() {
return createKeyTemplate(16, KeyTemplate.OutputPrefixType.RAW);
}
Expand All @@ -195,10 +189,7 @@ public static final KeyTemplate rawAes128GcmSivTemplate() {
* <li>Key size: 32 bytes
* <li>Prefix type: {@link KeyTemplate.OutputPrefixType#TINK}
* </ul>
*
* @deprecated use {@code KeyTemplates.get("AES256_GCM_SIV")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate aes256GcmSivTemplate() {
return createKeyTemplate(32, KeyTemplate.OutputPrefixType.TINK);
}
Expand All @@ -213,10 +204,7 @@ public static final KeyTemplate aes256GcmSivTemplate() {
* </ul>
*
* <p>Keys generated from this template should create ciphertexts compatible with other libraries.
*
* @deprecated use {@code KeyTemplates.get("AES256_GCM_SIV_RAW")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate rawAes256GcmSivTemplate() {
return createKeyTemplate(32, KeyTemplate.OutputPrefixType.RAW);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@ public static void register(boolean newKeyAllowed) throws GeneralSecurityExcepti

/**
* @return a {@link KeyTemplate} that generates new instances of ChaCha20Poly1305 keys.
* @deprecated use {@code KeyTemplates.get("CHACHA20_POLY1305")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate chaCha20Poly1305Template() {
return KeyTemplate.create(
new ChaCha20Poly1305KeyManager().getKeyType(),
Expand All @@ -143,9 +141,7 @@ public static final KeyTemplate chaCha20Poly1305Template() {
* @return a {@link KeyTemplate} that generates new instances of ChaCha20Poly1305 keys. Keys
* generated from this template create ciphertexts compatible with libsodium and other
* libraries.
* @deprecated use {@code KeyTemplates.get("CHACHA20_POLY1305_RAW")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate rawChaCha20Poly1305Template() {
return KeyTemplate.create(
new ChaCha20Poly1305KeyManager().getKeyType(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,7 @@ public static void register(boolean newKeyAllowed) throws GeneralSecurityExcepti

/**
* @return a {@link KeyTemplate} that generates new instances of XChaCha20Poly1305 keys.
* @deprecated use {@code KeyTemplates.get("XCHACHA20_POLY1305")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate xChaCha20Poly1305Template() {
return KeyTemplate.create(
new XChaCha20Poly1305KeyManager().getKeyType(),
Expand All @@ -165,9 +163,7 @@ public static final KeyTemplate xChaCha20Poly1305Template() {
* @return a {@link KeyTemplate} that generates new instances of XChaCha20Poly1305 keys. Keys
* generated from this template create ciphertexts compatible with libsodium and other
* libraries.
* @deprecated use {@code KeyTemplates.get("XCHACHA20_POLY1305_RAW")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate rawXChaCha20Poly1305Template() {
return KeyTemplate.create(
new XChaCha20Poly1305KeyManager().getKeyType(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,15 @@ public static void register(boolean newKeyAllowed) throws GeneralSecurityExcepti

/**
* @return a {@code KeyTemplate} that generates new instances of AES-SIV-CMAC keys.
* @deprecated use {@code KeyTemplates.get("AES256_SIV")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate aes256SivTemplate() {
return createKeyTemplate(KEY_SIZE_IN_BYTES, KeyTemplate.OutputPrefixType.TINK);
}

/**
* @return A {@code KeyTemplate} that generates new instances of AES-SIV-CMAC keys. Keys generated
* from this template create ciphertexts compatible with other libraries.
* @deprecated use {@code KeyTemplates.get("AES256_SIV_RAW")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate rawAes256SivTemplate() {
return createKeyTemplate(KEY_SIZE_IN_BYTES, KeyTemplate.OutputPrefixType.RAW);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,7 @@ public static void registerPair(boolean newKeyAllowed) throws GeneralSecurityExc
* <p>Unlike other key templates that use AES-GCM, the instances of {@link HybridDecrypt}
* generated by this key template has no limitation on Android KitKat (API level 19). They
* might not work in older versions though.
* @deprecated use {@code KeyTemplates.get("ECIES_P256_HKDF_HMAC_SHA256_AES128_GCM")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate eciesP256HkdfHmacSha256Aes128GcmTemplate() {
return createKeyTemplate(
EllipticCurveType.NIST_P256,
Expand All @@ -307,10 +305,7 @@ public static final KeyTemplate eciesP256HkdfHmacSha256Aes128GcmTemplate() {
* <p>Unlike other key templates that use AES-GCM, the instances of {@link HybridDecrypt}
* generated by this key template has no limitation on Android KitKat (API level 19). They
* might not work in older versions though.
* @deprecated use {@code
* KeyTemplates.get("ECIES_P256_COMPRESSED_HKDF_HMAC_SHA256_AES128_GCM_RAW")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate rawEciesP256HkdfHmacSha256Aes128GcmCompressedTemplate() {
return createKeyTemplate(
EllipticCurveType.NIST_P256,
Expand All @@ -337,10 +332,7 @@ public static final KeyTemplate rawEciesP256HkdfHmacSha256Aes128GcmCompressedTem
* <li>EC Point Format: Uncompressed
* <li>Prefix type: {@link KeyTemplate.OutputPrefixType#TINK}
* </ul>
*
* @deprecated use {@code KeyTemplates.get("ECIES_P256_HKDF_HMAC_SHA256_AES128_CTR_HMAC_SHA256")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate eciesP256HkdfHmacSha256Aes128CtrHmacSha256Template() {
return createKeyTemplate(
EllipticCurveType.NIST_P256,
Expand All @@ -367,11 +359,7 @@ public static final KeyTemplate eciesP256HkdfHmacSha256Aes128CtrHmacSha256Templa
* <li>EC Point Format: Compressed
* <li>Prefix type: {@link KeyTemplate.OutputPrefixType#RAW} (no prefix)
* </ul>
*
* @deprecated use {@code
* KeyTemplates.get("ECIES_P256_COMPRESSED_HKDF_HMAC_SHA256_AES128_CTR_HMAC_SHA256_RAW")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate
rawEciesP256HkdfHmacSha256Aes128CtrHmacSha256CompressedTemplate() {
return createKeyTemplate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,7 @@ public static void register(boolean newKeyAllowed) throws GeneralSecurityExcepti
* <li>Tag size: 16 bytes
* <li>Prefix type: {@link KeyTemplate.OutputPrefixType#TINK}
* </ul>
*
* @deprecated use {@code KeyTemplates.get("AES256_CMAC")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate aes256CmacTemplate() {
AesCmacKeyFormat format =
AesCmacKeyFormat.newBuilder()
Expand All @@ -206,10 +203,7 @@ public static final KeyTemplate aes256CmacTemplate() {
* <li>Tag size: 16 bytes
* <li>Prefix type: {@link KeyTemplate.OutputPrefixType#RAW} (no prefix)
* </ul>
*
* @deprecated use {@code KeyTemplates.get("AES256_CMAC_RAW")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate rawAes256CmacTemplate() {
AesCmacKeyFormat format =
AesCmacKeyFormat.newBuilder()
Expand Down
12 changes: 0 additions & 12 deletions src/main/java/com/google/crypto/tink/mac/HmacKeyManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,7 @@ public static void register(boolean newKeyAllowed) throws GeneralSecurityExcepti
* <li>Hash function: SHA256
* <li>Prefix type: {@link KeyTemplate.OutputPrefixType#TINK}
* </ul>
*
* @deprecated use {@code KeyTemplates.get("HMAC_SHA256_128BITTAG")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate hmacSha256HalfDigestTemplate() {
return createTemplate(32, 16, HashType.SHA256);
}
Expand All @@ -270,10 +267,7 @@ public static final KeyTemplate hmacSha256HalfDigestTemplate() {
* <li>Hash function: SHA256
* <li>Prefix type: {@link KeyTemplate.OutputPrefixType#TINK}
* </ul>
*
* @deprecated use {@code KeyTemplates.get("HMAC_SHA256_256BITTAG")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate hmacSha256Template() {
return createTemplate(32, 32, HashType.SHA256);
}
Expand All @@ -287,10 +281,7 @@ public static final KeyTemplate hmacSha256Template() {
* <li>Hash function: SHA512
* <li>Prefix type: {@link KeyTemplate.OutputPrefixType#TINK}
* </ul>
*
* @deprecated use {@code KeyTemplates.get("HMAC_SHA512_256BITTAG")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate hmacSha512HalfDigestTemplate() {
return createTemplate(64, 32, HashType.SHA512);
}
Expand All @@ -304,10 +295,7 @@ public static final KeyTemplate hmacSha512HalfDigestTemplate() {
* <li>Hash function: SHA512
* <li>Prefix type: {@link KeyTemplate.OutputPrefixType#TINK}
* </ul>
*
* @deprecated use {@code KeyTemplates.get("HMAC_SHA512_512BITTAG")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate hmacSha512Template() {
return createTemplate(64, 64, HashType.SHA512);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,15 @@ public static void register(boolean newKeyAllowed) throws GeneralSecurityExcepti
* <li>Prefix type: {@link KeyTemplate.OutputPrefixType#RAW}
* </ul>
*
* .
*
*
* @return A {@link KeyTemplate} that generates new instances of AES-CMAC keys with the following
* parameters:
* <ul>
* <li>Key size: 32 bytes
* <li>Prefix type: {@link KeyTemplate.OutputPrefixType#RAW}
* </ul>
*
* @deprecated use {@code KeyTemplates.get("AES256_CMAC_PRF")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate aes256CmacTemplate() {
AesCmacPrfKeyFormat format = AesCmacPrfKeyFormat.newBuilder().setKeySize(32).build();
return KeyTemplate.create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,7 @@ public static String staticKeyType() {
* <li>HMAC key size: 32 bytes
* <li>Salt: empty
* </ul>
*
* @deprecated use {@code KeyTemplates.get("HKDF_SHA256")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate hkdfSha256Template() {
HkdfPrfKeyFormat format =
HkdfPrfKeyFormat.newBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,7 @@ public TinkFipsUtil.AlgorithmFipsCompatibility fipsStatus() {
* <li>Hash function: SHA256
* <li>Prefix type: {@link KeyTemplate.OutputPrefixType#RAW}
* </ul>
*
* @deprecated use {@code KeyTemplates.get("HMAC_SHA256_PRF")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate hmacSha256Template() {
return createTemplate(32, HashType.SHA256);
}
Expand All @@ -217,10 +214,7 @@ public static final KeyTemplate hmacSha256Template() {
* <li>Hash function: SHA512
* <li>Prefix type: {@link KeyTemplate.OutputPrefixType#RAW}
* </ul>
*
* @deprecated use {@code KeyTemplates.get("HMAC_SHA512_PRF")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate hmacSha512Template() {
return createTemplate(64, HashType.SHA512);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,7 @@ public static void registerPair(boolean newKeyAllowed) throws GeneralSecurityExc
* <li>Signature encoding: DER (this is the encoding that Java uses).
* <li>Prefix type: {@link KeyTemplate.OutputPrefixType#TINK}.
* </ul>
*
* @deprecated use {@code KeyTemplates.get("ECDSA_P256")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate ecdsaP256Template() {
return createKeyTemplate(
HashType.SHA256,
Expand All @@ -294,9 +291,7 @@ public static final KeyTemplate ecdsaP256Template() {
* </ul>
* Keys generated from this template create raw signatures of exactly 64 bytes. It is
* compatible with JWS and most other libraries.
* @deprecated use {@code KeyTemplates.get("ECDSA_P256_RAW")}
*/
@Deprecated /* Deprecation under consideration */
public static final KeyTemplate rawEcdsaP256Template() {
return createKeyTemplate(
HashType.SHA256,
Expand Down
Loading

0 comments on commit 41e7486

Please sign in to comment.