public class EncryptionUtil extends Object
| Constructor and Description |
|---|
EncryptionUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getDigitalSignatureType(Key signingKey)
Returns the type of digital signature used with the specified signing key.
|
static BigInteger |
getRandomBigInteger(int bits)
Creates a random BigInteger greater than 0 with the specified number of bits.
|
static String |
getSignatureAlgorithm(String messageDigest,
Key signingKey)
Creates a signature algorithm string using the specified message digest and the encryption type corresponding
to the supplied signingKey.
|
static boolean |
isEcKey(Key key)
Returns true if the key is an elliptic curve public or private key.
|
static boolean |
isRsaKey(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 String |
readPemStringFromFile(File file)
Convenience method to read PEM data from a file.
|
static void |
writePemStringToFile(File file,
String pemDataToWrite)
Convenience method to write PEM data to a file.
|
public static String getSignatureAlgorithm(String messageDigest, Key signingKey)
messageDigest - digest to use to sign the certificate, such as SHA512signingKey - private key that will be used to sign the certificatepublic static String getDigitalSignatureType(Key signingKey)
signingKey - private key that will be used to sign a certificate (or something else)public static BigInteger getRandomBigInteger(int bits)
bits - number of bits to generatepublic static boolean isRsaKey(Key key)
public static boolean isEcKey(Key key)
public static void writePemStringToFile(File file, String pemDataToWrite)
file - file to write topemDataToWrite - PEM data to write to the filepublic static String readPemStringFromFile(File file)
file - file to read frompublic static boolean isUnlimitedStrengthAllowed()
Copyright © 2016. All rights reserved.