Package com.vmware.security.credstore
Class CredentialStoreCipher
- java.lang.Object
-
- com.vmware.security.credstore.CredentialStoreCipher
-
public class CredentialStoreCipher extends java.lang.ObjectThis class uses the JVM provided classes in javax.crypto.* to encrypt and decrypt text. It uses the RC4 symmetric cipher by default allowing you to store text and decrypt the same text for review later.The SecretKey is a vital private key used for encrypting and decrypting the cipher text produced by this class. If you lose the secret key, then the data is lost.
See Appendix A in the Java Cryptography Extension Reference Guide for more information.
- See Also:
SecretKey,Cipher,CredentialStoreImpl
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringALGORITHMThe RC4 encryption algorithm is supplied by the JVM.
-
Constructor Summary
Constructors Constructor Description CredentialStoreCipher(javax.crypto.SecretKey secretKey)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]decrypt(byte[] input)byte[]encrypt(byte[] input)Uses the RC4 Encrypt and Decrypt routines found in the javax.crypto package.static javax.crypto.SecretKeygenerateSecretKey()This helper method will generate a fresh secret key for you to use.
-
-
-
Field Detail
-
ALGORITHM
public static final java.lang.String ALGORITHM
The RC4 encryption algorithm is supplied by the JVM. If your JVM does not support RC4 you may have to specify a different algorithm name here.See Appendix A in the Java Cryptography Extension Reference Guide for more information.
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CredentialStoreCipher
public CredentialStoreCipher(javax.crypto.SecretKey secretKey) throws java.security.NoSuchAlgorithmException, javax.crypto.NoSuchPaddingException, java.security.InvalidKeyException- Throws:
java.security.NoSuchAlgorithmExceptionjavax.crypto.NoSuchPaddingExceptionjava.security.InvalidKeyException
-
-
Method Detail
-
generateSecretKey
public static javax.crypto.SecretKey generateSecretKey() throws java.security.NoSuchAlgorithmExceptionThis helper method will generate a fresh secret key for you to use. If this key is lost, then the information encrypted with this cipher is also lost.- Returns:
- a key object for use with this class
- Throws:
java.security.NoSuchAlgorithmException- - thrown if your JVM does not support RC4 encryption
-
encrypt
public byte[] encrypt(byte[] input)
Uses the RC4 Encrypt and Decrypt routines found in the javax.crypto package.
-
decrypt
public byte[] decrypt(byte[] input)
-
-