Skip to content

Commit

Permalink
Change sha256 to SHA-256
Browse files Browse the repository at this point in the history
  • Loading branch information
AnuGayan committed Oct 17, 2024
1 parent 9be03b4 commit 98abc4a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;

import static org.wso2.carbon.apimgt.impl.APIConstants.SHA_256;

/**
* Global API Manager configuration. This is generally populated from a special XML descriptor
* file at system startup. Once successfully populated, this class does not allow more parameters
Expand Down Expand Up @@ -136,7 +138,7 @@ public class APIManagerConfiguration {
private static Map<String, String> analyticsMaskProps;
private TokenValidationDto tokenValidationDto = new TokenValidationDto();
private boolean enableAiConfiguration;
private String hashingAlgorithm = "sha256";
private String hashingAlgorithm = SHA_256;

public Map<String, List<String>> getRestApiJWTAuthAudiences() {
return restApiJWTAuthAudiences;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;

import static org.wso2.carbon.apimgt.impl.APIConstants.SHA_256;

/**
* This class contains the utility methods used by the implementations of APIManager, APIProvider
* and APIConsumer interfaces.
Expand Down Expand Up @@ -346,7 +348,7 @@ public final class APIUtil {
private static Schema tenantConfigJsonSchema;
private static Schema operationPolicySpecSchema;
private static final String contextRegex = "^[a-zA-Z0-9_${}/.;()-]+$";
private static String hashingAlgorithm = "sha256";
private static String hashingAlgorithm = SHA_256;

private APIUtil() {

Expand Down Expand Up @@ -10512,7 +10514,7 @@ public static String generateCodeVerifier () {
public static String generateCodeChallenge(String codeVerifier) throws UnsupportedEncodingException,
NoSuchAlgorithmException {
byte[] bytes = codeVerifier.getBytes(APIConstants.US_ASCII);
MessageDigest messageDigest = MessageDigest.getInstance(APIConstants.SHA_256);
MessageDigest messageDigest = MessageDigest.getInstance(SHA_256);
messageDigest.update(bytes, 0, bytes.length);
byte[] digest = messageDigest.digest();
return java.util.Base64.getUrlEncoder().withoutPadding().encodeToString(digest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"apim.jwt.enable_tenant_based_signing": false,
"apim.jwt.gateway_generator.enable_claim_retrieval": false,
"apim.jwt.binding_federated_user_claims": false,
"apim.hashing.hashing_algorithm": "sha256",
"apim.hashing.hashing_algorithm": "SHA-256",
"apim.cache.gateway_token.enable": true,
"apim.cache.resource.enable": true,
"apim.cache.km_token.enable": false,
Expand Down

0 comments on commit 98abc4a

Please sign in to comment.