Package org.apache.commons.vfs2.util
Class DefaultCryptor
- java.lang.Object
-
- org.apache.commons.vfs2.util.DefaultCryptor
-
-
Field Summary
Fields Modifier and Type Field Description private static int
BITS_IN_HALF_BYTE
private static char[]
HEX_CHARS
private static int
INDEX_NOT_FOUND
private static byte[]
KEY_BYTES
private static char
MASK
-
Constructor Summary
Constructors Constructor Description DefaultCryptor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private byte[]
decode(java.lang.String str)
Decodes Hex-Bytes.java.lang.String
decrypt(java.lang.String encryptedKey)
Decrypts the password.private java.lang.String
encode(byte[] bytes)
Hex-encode bytes.java.lang.String
encrypt(java.lang.String plainKey)
Encrypt the plain text password.private int
indexOf(char[] array, char valueToFind)
-
-
-
Field Detail
-
HEX_CHARS
private static final char[] HEX_CHARS
-
KEY_BYTES
private static final byte[] KEY_BYTES
-
INDEX_NOT_FOUND
private static final int INDEX_NOT_FOUND
- See Also:
- Constant Field Values
-
BITS_IN_HALF_BYTE
private static final int BITS_IN_HALF_BYTE
- See Also:
- Constant Field Values
-
MASK
private static final char MASK
- See Also:
- Constant Field Values
-
-
Method Detail
-
encrypt
public java.lang.String encrypt(java.lang.String plainKey) throws java.lang.Exception
Encrypt the plain text password.Warning: This uses AES128 with a fixed encryption key. This is only an obfuscation no cryptographic secure protection.
-
decrypt
public java.lang.String decrypt(java.lang.String encryptedKey) throws java.lang.Exception
Decrypts the password.
-
encode
private java.lang.String encode(byte[] bytes)
Hex-encode bytes.
-
decode
private byte[] decode(java.lang.String str)
Decodes Hex-Bytes.
-
indexOf
private int indexOf(char[] array, char valueToFind)
-
-