net.sf.zekr.common.util
Class CryptoUtils
java.lang.Object
net.sf.zekr.common.util.CryptoUtils
public class CryptoUtils
- extends java.lang.Object
- Author:
- Mohsen Saboorian
Method Summary |
static java.security.KeyPair |
generateKeyPair()
|
static byte[] |
sign(byte[] text,
byte[] prvKeyBytes)
|
static byte[] |
sign(java.lang.String datafile,
java.security.PrivateKey prvKey,
java.lang.String sigAlg)
|
static boolean |
verify(byte[] text,
byte[] sigBytes)
|
static boolean |
verify(byte[] text,
java.security.PublicKey pubKey,
byte[] sigBytes)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PUBLIC_KEY
public static final byte[] PUBLIC_KEY
CryptoUtils
public CryptoUtils()
sign
public static byte[] sign(java.lang.String datafile,
java.security.PrivateKey prvKey,
java.lang.String sigAlg)
throws java.lang.Exception
- Throws:
java.lang.Exception
verify
public static boolean verify(byte[] text,
java.security.PublicKey pubKey,
byte[] sigBytes)
throws java.security.NoSuchAlgorithmException,
java.security.InvalidKeyException,
java.security.SignatureException
- Throws:
java.security.NoSuchAlgorithmException
java.security.InvalidKeyException
java.security.SignatureException
verify
public static boolean verify(byte[] text,
byte[] sigBytes)
throws java.security.GeneralSecurityException
- Throws:
java.security.GeneralSecurityException
sign
public static byte[] sign(byte[] text,
byte[] prvKeyBytes)
throws java.security.GeneralSecurityException
- Throws:
java.security.GeneralSecurityException
generateKeyPair
public static java.security.KeyPair generateKeyPair()
throws java.security.NoSuchAlgorithmException
- Throws:
java.security.NoSuchAlgorithmException