Skip to content

Commit

Permalink
Fix incorrect values in Javadoc for setTagSizeBytes().
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 586921891
Change-Id: I460f9de8bc001008fdef381825d6b34d401cd018
  • Loading branch information
chuckx authored and copybara-github committed Dec 1, 2023
1 parent 01544fe commit c72826a
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/main/java/com/google/crypto/tink/aead/AesGcmParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,13 @@ public Builder setIvSizeBytes(int ivSizeBytes) throws GeneralSecurityException {
this.ivSizeBytes = ivSizeBytes;
return this;
}
/** Tag size must be one of the following five values: 128, 120, 112, 104 or 96 bytes */
/** Tag size must be between 12 and 16 bytes. */
@CanIgnoreReturnValue
public Builder setTagSizeBytes(int tagSizeBytes) throws GeneralSecurityException {
if (tagSizeBytes != 12
&& tagSizeBytes != 13
&& tagSizeBytes != 14
&& tagSizeBytes != 15
&& tagSizeBytes != 16) {
if (tagSizeBytes < 12 || tagSizeBytes > 16) {
throw new GeneralSecurityException(
String.format(
"Invalid tag size in bytes %d; value must be one of the following: 12, 13, 14, 15"
+ " or 16 bytes",
"Invalid tag size in bytes %d; value must be between 12 and 16 bytes",
tagSizeBytes));
}
this.tagSizeBytes = tagSizeBytes;
Expand Down

0 comments on commit c72826a

Please sign in to comment.