Skip to content

Commit

Permalink
Naming conventions
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Crawford <[email protected]>
  • Loading branch information
stephen-crawford committed Oct 11, 2022
1 parent 76e5af5 commit 06ff2e4
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,14 @@ public Principal extractPrincipal(PrincipalIdentifierToken token) throws Illegal
// check is token is valid, we don't do anything if it is valid
// else we re-throw the thrown exception

String token_name = token.getWriteableName();
byte[] token_bytes = token_name.getBytes();
String tokenName = token.getWriteableName();
byte[] tokenBytes = tokenName.getBytes();

validateToken(token);


byte[] principalNameEncodedBytes = Arrays.copyOfRange(token_bytes, 0, KEY_SIZE);
byte[] extensionNameEncodedBytes = Arrays.copyOfRange(token_bytes, KEY_SIZE, token_bytes.length);
byte[] principalNameEncodedBytes = Arrays.copyOfRange(tokenBytes, 0, KEY_SIZE);
byte[] extensionNameEncodedBytes = Arrays.copyOfRange(tokenBytes, KEY_SIZE, tokenBytes.length);

Cipher principalCipher = Cipher.getInstance(ALGORITHM);
principalCipher.init(Cipher.DECRYPT_MODE, this.secretKey, new GCMParameterSpec(TAG_LENGTH, this.initializationVector));
Expand Down Expand Up @@ -167,10 +167,10 @@ public void validateToken(PrincipalIdentifierToken token) throws IllegalArgument
throw new IllegalArgumentException(INVALID_TOKEN_MESSAGE);
}

String token_name = token.getWriteableName();
byte[] token_bytes = token_name.getBytes();
String tokenName = token.getWriteableName();
byte[] tokenBytes = tokenName.getBytes();
// Check whether token is correct length
if (token_bytes.length != KEY_SIZE*2) {
if (tokenBytes.length != KEY_SIZE*2) {
throw new IllegalArgumentException(INVALID_TOKEN_MESSAGE);
}

Expand Down

0 comments on commit 06ff2e4

Please sign in to comment.