Skip to content

Commit

Permalink
fix server base64 (#244)
Browse files Browse the repository at this point in the history
Co-authored-by: TrongLB <btrongbkhn@live.com>
  • Loading branch information
bachtrong43 and TrongLB committed Sep 8, 2022
1 parent 42c6da0 commit 76bc5ff
Show file tree
Hide file tree
Showing 2 changed files with 267 additions and 100 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class Security {
*/
public static PublicKey generatePublicKey(String encodedPublicKey) {
try {
byte[] decodedKey = Base64Util.fromBase64(encodedPublicKey);
byte[] decodedKey = Base64Util.decode(encodedPublicKey);
KeyFactory keyFactory = KeyFactory.getInstance(KEY_FACTORY_ALGORITHM);
return keyFactory.generatePublic(new X509EncodedKeySpec(decodedKey));
} catch (NoSuchAlgorithmException e) {
Expand Down Expand Up @@ -66,7 +66,7 @@ public static boolean verify(PublicKey publicKey, String signedData, String sign
public static boolean verify(PublicKey publicKey, String signedData, String signature, SecurityLogger logger) {
byte[] signatureBytes;
try {
signatureBytes = Base64Util.fromBase64(signature);
signatureBytes = Base64Util.decode(signature);
Signature sig = Signature.getInstance(SIGNATURE_ALGORITHM);
sig.initVerify(publicKey);
sig.update(signedData.getBytes());
Expand Down
Loading

0 comments on commit 76bc5ff

Please sign in to comment.