Skip to content

Instantly share code, notes, and snippets.

@lkdocs
Created September 11, 2013 17:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lkdocs/6526792 to your computer and use it in GitHub Desktop.
Save lkdocs/6526792 to your computer and use it in GitHub Desktop.
private byte[] signWithPrivateKey(byte[] bytes, String privateKey) throws Exception {
Signature signature = Signature.getInstance("SHA256withRSA", "SC");
signature.initSign(Crypto.getRSAPrivateKeyFromString(privateKey));
signature.update(bytes);
return signature.sign();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment