public final class SignService extends Object
# generate private key openssl genrsa -out mykey.pem 1024 # generate public key openssl rsa -in mykey.pem -pubout > mykey.pub # create der files for keys openssl rsa -in mykey.pub -inform PEM -pubin -outform DER -out development.pub.der openssl pkcs8 -nocrypt -in mykey.pem -inform PEM -topk8 -outform DER -out mykey.pem.derto generate certificates
User: Kirill, Date: 20.11.13 13:32
Modifier and Type | Field and Description |
---|---|
private static String |
CONSTANT_RSA |
private static String |
CONSTANT_SHA_512_WITH_RSA |
Modifier | Constructor and Description |
---|---|
private |
SignService()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static byte[] |
sign(byte[] data,
byte[] privKeyBytes) |
static boolean |
verifySignature(byte[] data,
byte[] pubKeyBytes,
byte[] signature) |
private static final String CONSTANT_RSA
private static final String CONSTANT_SHA_512_WITH_RSA
public static byte[] sign(byte[] data, byte[] privKeyBytes) throws NoSuchAlgorithmException, InvalidKeySpecException, InvalidKeyException, SignatureException
public static boolean verifySignature(byte[] data, byte[] pubKeyBytes, byte[] signature) throws NoSuchAlgorithmException, InvalidKeySpecException, InvalidKeyException, SignatureException
Copyright © 2016. All rights reserved.