Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

get SecretKey from String

public static SecretKey convertStringToSecretKeyto(String encodedKey) {
    byte[] decodedKey = Base64.getDecoder().decode(encodedKey);
    SecretKey originalKey = new SecretKeySpec(decodedKey, 0, decodedKey.length, "AES");
    return originalKey;
}
Source by www.baeldung.com #
 
PREVIOUS NEXT
Tagged: #SecretKey #String
ADD COMMENT
Topic
Name
2+2 =