Java Code Example
public byte[] generateSignature(PrivateKey privateKey, String data) throws NoSuchAlgorithmException,
NoSuchProviderException, InvalidKeyException, SignatureException, UnsupportedEncodingException {
Signature signature = Signature.getInstance("SHA1withRSA");
signature.initSign(privateKey);
signature.update(data.getBytes("UTF-8"));
return signature.sign();
}
No comments:
Post a Comment