public class EncryptionUtil
extends java.lang.Object
| Constructor and Description |
|---|
EncryptionUtil() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
getDigitalSignatureType(java.security.Key signingKey)
Returns the type of digital signature used with the specified signing key.
|
static java.math.BigInteger |
getRandomBigInteger(int bits)
Creates a random BigInteger greater than 0 with the specified number of bits.
|
static java.lang.String |
getSignatureAlgorithm(java.lang.String messageDigest,
java.security.Key signingKey)
Creates a signature algorithm string using the specified message digest and the encryption type corresponding
to the supplied signingKey.
|
static boolean |
isEcKey(java.security.Key key)
Returns true if the key is an elliptic curve public or private key.
|
static boolean |
isRsaKey(java.security.Key key)
Returns true if the key is an RSA public or private key.
|
static boolean |
isUnlimitedStrengthAllowed()
Determines if unlimited-strength cryptography is allowed, i.e.
|
static java.lang.String |
readPemStringFromFile(java.io.File file)
Convenience method to read PEM data from a file.
|
static void |
writePemStringToFile(java.io.File file,
java.lang.String pemDataToWrite)
Convenience method to write PEM data to a file.
|
public static java.lang.String getSignatureAlgorithm(java.lang.String messageDigest,
java.security.Key signingKey)
For example, if the root certificate has an RSA private key, and you wish to use the SHA256 message digest, this method will return the string "SHA256withRSA". See the "Signature Algorithms" section of http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html for a list of JSSE-supported signature algorithms.
messageDigest - digest to use to sign the certificate, such as SHA512signingKey - private key that will be used to sign the certificatepublic static java.lang.String getDigitalSignatureType(java.security.Key signingKey)
signingKey - private key that will be used to sign a certificate (or something else)public static java.math.BigInteger getRandomBigInteger(int bits)
bits - number of bits to generatepublic static boolean isRsaKey(java.security.Key key)
key - keypublic static boolean isEcKey(java.security.Key key)
key - keypublic static void writePemStringToFile(java.io.File file,
java.lang.String pemDataToWrite)
file - file to write topemDataToWrite - PEM data to write to the filepublic static java.lang.String readPemStringFromFile(java.io.File file)
file - file to read frompublic static boolean isUnlimitedStrengthAllowed()