Class PBECipher
- java.lang.Object
-
- org.sonatype.plexus.components.cipher.PBECipher
-
public class PBECipher extends java.lang.Object- Version:
- $Id$
-
-
Field Summary
Fields Modifier and Type Field Description protected java.security.MessageDigest_digesterprivate static java.security.SecureRandom_secureRandomprotected static intCHUNK_SIZEprotected static java.lang.StringCIPHER_ALGprotected static java.lang.StringDIGEST_ALGprotected static java.lang.StringKEY_ALGprotected static intPBE_ITERATIONSprotected static intSALT_SIZEprotected static intSPICE_SIZEprotected static java.lang.StringSTRING_ENCODINGprotected static byteWIPER
-
Constructor Summary
Constructors Constructor Description PBECipher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private javax.crypto.CiphercreateCipher(byte[] pwdAsBytes, byte[] salt, int mode)java.lang.Stringdecrypt64(java.lang.String encryptedText, java.lang.String password)java.lang.Stringencrypt64(java.lang.String clearText, java.lang.String password)private byte[]getSalt(int sz)
-
-
-
Field Detail
-
STRING_ENCODING
protected static final java.lang.String STRING_ENCODING
- See Also:
- Constant Field Values
-
SPICE_SIZE
protected static final int SPICE_SIZE
- See Also:
- Constant Field Values
-
SALT_SIZE
protected static final int SALT_SIZE
- See Also:
- Constant Field Values
-
CHUNK_SIZE
protected static final int CHUNK_SIZE
- See Also:
- Constant Field Values
-
WIPER
protected static final byte WIPER
- See Also:
- Constant Field Values
-
DIGEST_ALG
protected static final java.lang.String DIGEST_ALG
- See Also:
- Constant Field Values
-
KEY_ALG
protected static final java.lang.String KEY_ALG
- See Also:
- Constant Field Values
-
CIPHER_ALG
protected static final java.lang.String CIPHER_ALG
- See Also:
- Constant Field Values
-
PBE_ITERATIONS
protected static int PBE_ITERATIONS
-
_digester
protected java.security.MessageDigest _digester
-
_secureRandom
private static final java.security.SecureRandom _secureRandom
-
-
Constructor Detail
-
PBECipher
public PBECipher() throws PlexusCipherException- Throws:
PlexusCipherException
-
-
Method Detail
-
getSalt
private byte[] getSalt(int sz)
-
encrypt64
public java.lang.String encrypt64(java.lang.String clearText, java.lang.String password) throws PlexusCipherException- Throws:
PlexusCipherException
-
decrypt64
public java.lang.String decrypt64(java.lang.String encryptedText, java.lang.String password) throws PlexusCipherException- Throws:
PlexusCipherException
-
createCipher
private javax.crypto.Cipher createCipher(byte[] pwdAsBytes, byte[] salt, int mode) throws java.security.NoSuchAlgorithmException, javax.crypto.NoSuchPaddingException, java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException- Throws:
java.security.NoSuchAlgorithmExceptionjavax.crypto.NoSuchPaddingExceptionjava.security.InvalidKeyExceptionjava.security.InvalidAlgorithmParameterException
-
-