public class RSAUtils
extends java.lang.Object
构造器和说明 |
---|
RSAUtils() |
限定符和类型 | 方法和说明 |
---|---|
static java.security.KeyPair |
generateKeyPair(int keySize)
* 生成密钥对 *
|
static java.security.interfaces.RSAPrivateKey |
generateRSAPrivateKey(java.math.BigInteger modulus,
java.math.BigInteger privateExponent)
* 生成私钥 *
|
static java.security.interfaces.RSAPublicKey |
generateRSAPublicKey(java.math.BigInteger modulus,
java.math.BigInteger publicExponent)
* 生成公钥 *
|
static byte[] |
hexStringToBytes(java.lang.String hexString)
Convert hex string to byte[]
|
static void |
main(java.lang.String[] args)
* *
|
static byte[] |
sign(byte[] bytes,
java.security.PrivateKey prikey)
sign
|
static java.lang.String |
toHexString(byte[] b)
Convert byte[] to hex string
|
static boolean |
verify(byte[] bytes,
byte[] signbytes,
java.security.PublicKey pubkey)
varify
|
public static java.security.KeyPair generateKeyPair(int keySize) throws java.lang.Exception
java.lang.Exception
public static java.security.interfaces.RSAPublicKey generateRSAPublicKey(java.math.BigInteger modulus, java.math.BigInteger publicExponent) throws java.lang.Exception
modulus
- *publicExponent
- *java.lang.Exception
public static java.security.interfaces.RSAPrivateKey generateRSAPrivateKey(java.math.BigInteger modulus, java.math.BigInteger privateExponent) throws java.lang.Exception
modulus
- *privateExponent
- *java.lang.Exception
public static byte[] sign(byte[] bytes, java.security.PrivateKey prikey) throws java.lang.Exception
java.lang.Exception
public static boolean verify(byte[] bytes, byte[] signbytes, java.security.PublicKey pubkey) throws java.lang.Exception
java.lang.Exception
public static java.lang.String toHexString(byte[] b)
public static byte[] hexStringToBytes(java.lang.String hexString)
hexString
- the hex stringpublic static void main(java.lang.String[] args) throws java.lang.Exception
args
- *java.lang.Exception