Skip to content

Commit

Permalink
Byte array encoding fix
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 f10d2b7 commit dbe0923
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import java.security.Principal;
import java.security.SecureRandom;
import java.util.Arrays;
import java.util.Map;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
Expand Down Expand Up @@ -132,10 +133,10 @@ public Principal extractPrincipal(PrincipalIdentifierToken token) throws Illegal
byte[] token_bytes = token_name.getBytes();

validateToken(token);
String[] parts = token.getToken().split(String.format("*{%d}", KEY_SIZE));
String pricipalNameEncoded = parts[0];
byte[] principalNameEncodedBytes = pricipalNameEncoded.getBytes();
String extensionNameEncoded = parts[1];


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


Cipher principalCipher = Cipher.getInstance(ALGORITHM);
Expand Down

0 comments on commit dbe0923

Please sign in to comment.