List of usage examples for java.security MessageDigest digest
public byte[] digest(byte[] input)
From source file:it.smartcommunitylab.aac.oauth.AACOAuth2Utils.java
private static String getS256CodeChallenge(String codeVerifier) { MessageDigest md; try {// ww w . j av a 2 s. com md = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException("No such algorithm [SHA-256]"); } byte[] sha256 = md.digest(Utf8.encode(codeVerifier)); String codeChallenge = Base64.encodeBase64URLSafeString(sha256); return codeChallenge; }