|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfabric.common.Crypto
public final class Crypto
This is the clearing house for all things crypto.
Field Summary | |
---|---|
static java.lang.String |
ALG_HASH
|
static java.lang.String |
ALG_PUBLIC_KEY_GEN
|
static java.lang.String |
ALG_SECRET_CRYPTO
|
static java.lang.String |
ALG_SECRET_KEY_GEN
|
static java.lang.String |
ALG_SIGNATURE
|
static int |
SIZE_PUBLIC_KEY
|
static int |
SIZE_SECRET_KEY
|
Constructor Summary | |
---|---|
Crypto()
|
Method Summary | |
---|---|
static javax.crypto.Cipher |
cipherInstance(int opmode,
byte[] key,
byte[] iv)
Creates an initializes a new Cipher instance with the given parameters. |
java.security.cert.X509Certificate |
createCertificate(java.lang.String subjectName,
java.security.PublicKey subjectKey,
java.lang.String issuerName,
java.security.PrivateKey issuerKey)
generates a certificate, signed by the issuer, binding the subject's name to their public key. |
static java.security.MessageDigest |
digestInstance()
|
static void |
fillIV(byte[] iv)
Fills an initialization vector with random bytes. |
static java.security.KeyPair |
genKeyPair()
|
static javax.crypto.SecretKey |
genSecretKey()
|
static byte[] |
makeIV()
Creates a new initialization vector. |
static java.security.KeyPairGenerator |
publicKeyGenInstance()
|
static javax.crypto.KeyGenerator |
secretKeyGenInstance()
|
static java.security.Signature |
signatureInstance()
|
static boolean |
validateCertificateChain(java.security.cert.Certificate[] certificateChain,
java.security.KeyStore trustStore)
Validates the given certificate chain against the given trust store. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ALG_SIGNATURE
public static final java.lang.String ALG_SECRET_KEY_GEN
public static final int SIZE_SECRET_KEY
public static final java.lang.String ALG_SECRET_CRYPTO
public static final java.lang.String ALG_PUBLIC_KEY_GEN
public static final int SIZE_PUBLIC_KEY
public static final java.lang.String ALG_HASH
Constructor Detail |
---|
public Crypto()
Method Detail |
---|
public static java.security.MessageDigest digestInstance()
public static java.security.Signature signatureInstance()
public static javax.crypto.KeyGenerator secretKeyGenInstance()
public static javax.crypto.SecretKey genSecretKey()
public static java.security.KeyPairGenerator publicKeyGenInstance()
public static java.security.KeyPair genKeyPair()
public static void fillIV(byte[] iv)
public static byte[] makeIV()
public static javax.crypto.Cipher cipherInstance(int opmode, byte[] key, byte[] iv) throws java.security.NoSuchAlgorithmException, javax.crypto.NoSuchPaddingException, java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException
opmode
- The mode of operation. One of the mode constants in Cipher.key
- The secret key to use.iv
- The initialization vector to use. For encryption, this should be
randomly generated; for decryption, this should match the one used
during encryption.
java.security.NoSuchAlgorithmException
javax.crypto.NoSuchPaddingException
java.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
public static boolean validateCertificateChain(java.security.cert.Certificate[] certificateChain, java.security.KeyStore trustStore)
public java.security.cert.X509Certificate createCertificate(java.lang.String subjectName, java.security.PublicKey subjectKey, java.lang.String issuerName, java.security.PrivateKey issuerKey) throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |