public class Crypto
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.security.KeyPair |
createKeyPair(byte[] encodedPublicKey,
byte[] encodedPrivateKey) |
static byte[] |
decrypt(byte[] encryptedMessage,
java.security.PrivateKey privateKey) |
static byte[] |
encrypt(byte[] message,
java.security.PublicKey publicKey) |
static java.security.KeyPair |
getNew() |
java.security.PrivateKey |
getPrivateKey() |
java.security.PublicKey |
getPublicKey() |
static java.security.PrivateKey |
priKeyFromBytes(byte[] bytes) |
static java.security.PublicKey |
pubKeyFromBytes(byte[] bytes) |
static byte[] |
sign(byte[] message,
java.security.PrivateKey privateKey) |
static byte[] |
unsign(byte[] signedMessage,
java.security.PublicKey publicKey) |
public static java.security.KeyPair getNew() throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmException
public java.security.PublicKey getPublicKey()
public java.security.PrivateKey getPrivateKey()
public static byte[] sign(byte[] message, java.security.PrivateKey privateKey)
public static byte[] encrypt(byte[] message, java.security.PublicKey publicKey)
public static byte[] unsign(byte[] signedMessage, java.security.PublicKey publicKey)
public static byte[] decrypt(byte[] encryptedMessage, java.security.PrivateKey privateKey)
public static java.security.PublicKey pubKeyFromBytes(byte[] bytes) throws java.security.NoSuchAlgorithmException, java.security.spec.InvalidKeySpecException
java.security.NoSuchAlgorithmException
java.security.spec.InvalidKeySpecException
public static java.security.PrivateKey priKeyFromBytes(byte[] bytes) throws java.security.NoSuchAlgorithmException, java.security.spec.InvalidKeySpecException
java.security.NoSuchAlgorithmException
java.security.spec.InvalidKeySpecException
public static java.security.KeyPair createKeyPair(byte[] encodedPublicKey, byte[] encodedPrivateKey)