Created
March 15, 2021 23:04
-
-
Save mkaraoz/a092c2e238c515fdf434d2a5069b8c53 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Supported signature algorithms: | |
| * https://developer.android.com/reference/java/security/Signature | |
| */ | |
| public byte[] sign(String message) throws Exception { | |
| KeyPair keyPair = getKeys(); | |
| Signature signature = Signature.getInstance("SHA256widthECDSA"); | |
| signature.initSign(keyPair.getPrivate()); | |
| signature.update(message.getBytes()); | |
| byte[] signedData = signature.sign(); | |
| Log.d("_MK", Base64.encodeToString(signedData, Base64.DEFAULT)); | |
| return signedData; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment