org.jclouds.encryption.internal
Class JCECrypto

java.lang.Object
  extended by org.jclouds.encryption.internal.JCECrypto
All Implemented Interfaces:
Crypto
Direct Known Subclasses:
BouncyCastleCrypto

@Singleton
public class JCECrypto
extends Object
implements Crypto

Author:
Adrian Cole

Field Summary
static String HmacSHA1
           
static String HmacSHA256
           
static String MD5
           
static String SHA1
           
static String SHA256
           
static String SHA512
           
 
Constructor Summary
JCECrypto()
           
JCECrypto(Provider provider)
           
 
Method Summary
 CertificateFactory certFactory()
           
 Cipher cipher(String algorithm)
           
 MessageDigest digest(String algorithm)
           
 Mac hmac(String algorithm, byte[] key)
           
 Mac hmacSHA1(byte[] key)
           
 Mac hmacSHA256(byte[] key)
           
 MessageDigest md5()
           
 KeyFactory rsaKeyFactory()
           
 KeyPairGenerator rsaKeyPairGenerator()
           
 MessageDigest sha1()
           
 MessageDigest sha256()
           
 MessageDigest sha512()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MD5

public static final String MD5
See Also:
Constant Field Values

SHA1

public static final String SHA1
See Also:
Constant Field Values

SHA256

public static final String SHA256
See Also:
Constant Field Values

SHA512

public static final String SHA512
See Also:
Constant Field Values

HmacSHA256

public static final String HmacSHA256
See Also:
Constant Field Values

HmacSHA1

public static final String HmacSHA1
See Also:
Constant Field Values
Constructor Detail

JCECrypto

@Inject
public JCECrypto()
          throws NoSuchAlgorithmException,
                 CertificateException
Throws:
NoSuchAlgorithmException
CertificateException

JCECrypto

public JCECrypto(@Nullable
                 Provider provider)
          throws NoSuchAlgorithmException,
                 CertificateException
Throws:
NoSuchAlgorithmException
CertificateException
Method Detail

hmac

public Mac hmac(String algorithm,
                byte[] key)
         throws NoSuchAlgorithmException,
                InvalidKeyException
Specified by:
hmac in interface Crypto
Throws:
NoSuchAlgorithmException
InvalidKeyException

digest

public MessageDigest digest(String algorithm)
                     throws NoSuchAlgorithmException
Specified by:
digest in interface Crypto
Throws:
NoSuchAlgorithmException

cipher

public Cipher cipher(String algorithm)
              throws NoSuchAlgorithmException,
                     NoSuchPaddingException
Specified by:
cipher in interface Crypto
Throws:
NoSuchAlgorithmException
NoSuchPaddingException

md5

public MessageDigest md5()
Specified by:
md5 in interface Crypto

sha1

public MessageDigest sha1()
Specified by:
sha1 in interface Crypto

sha256

public MessageDigest sha256()
Specified by:
sha256 in interface Crypto

sha512

public MessageDigest sha512()
Specified by:
sha512 in interface Crypto

hmacSHA1

public Mac hmacSHA1(byte[] key)
             throws InvalidKeyException
Specified by:
hmacSHA1 in interface Crypto
Throws:
InvalidKeyException

hmacSHA256

public Mac hmacSHA256(byte[] key)
               throws InvalidKeyException
Specified by:
hmacSHA256 in interface Crypto
Throws:
InvalidKeyException

certFactory

public CertificateFactory certFactory()
Specified by:
certFactory in interface Crypto

rsaKeyFactory

public KeyFactory rsaKeyFactory()
Specified by:
rsaKeyFactory in interface Crypto

rsaKeyPairGenerator

public KeyPairGenerator rsaKeyPairGenerator()
Specified by:
rsaKeyPairGenerator in interface Crypto


Copyright © 2009-2012 jclouds. All Rights Reserved.