|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.client.am.EncryptionManager
public class EncryptionManager
Field Summary | |
---|---|
(package private) Agent |
agent_
|
private static java.math.BigInteger |
base__
|
private static byte[] |
baseBytes__
|
private static int |
exponential_length__
|
private static char[] |
hex_table
RESOLVE: * The methods and static vars below should go into some 'shared' * package when the capability is put back in (StringUtil.java) |
private javax.crypto.KeyAgreement |
keyAgreement_
|
private java.security.KeyPair |
keyPair_
|
private java.security.KeyPairGenerator |
keyPairGenerator_
|
private java.security.MessageDigest |
messageDigest
|
private static java.math.BigInteger |
modulus__
|
private static byte[] |
modulusBytes__
|
private javax.crypto.spec.DHParameterSpec |
paramSpec_
|
private java.security.Provider |
provider
|
private java.lang.String |
providerName
|
private byte[] |
secKey_
|
private static byte[] |
SECMEC_USRSSBPWD_PWDSEQS
|
private static int |
SECMEC_USRSSBPWD_SEED_LEN
|
private javax.crypto.SecretKeyFactory |
secretKeyFactory_
|
private java.security.SecureRandom |
secureRandom
|
static java.lang.String |
SHA_1_DIGEST_ALGORITHM
|
private static java.lang.String |
SHA_1_PRNG_ALGORITHM
|
private byte[] |
token_
|
Constructor Summary | |
---|---|
EncryptionManager(Agent agent)
|
|
EncryptionManager(Agent agent,
java.lang.String algorithm)
|
Method Summary | |
---|---|
private byte[] |
calculateEncryptionToken(int securityMechanism,
byte[] initVector)
|
byte[] |
decryptData(byte[] cipherText,
int securityMechanism,
byte[] initVector,
byte[] targetPublicKey)
|
byte[] |
encryptData(byte[] plainText,
int securityMechanism,
byte[] initVector,
byte[] targetPublicKey)
|
private byte[] |
generatePrivateKey(byte[] targetPublicKey)
|
byte[] |
generateSeed()
This method generates an 8-Byte random seed for the client (source). |
private void |
keyParityCheck(byte[] key)
|
byte[] |
obtainPublicKey()
|
void |
resetSecurityKeys()
|
void |
setInitVector(byte[] initVector)
|
void |
setSecKey(byte[] secKey)
|
byte[] |
substitutePassword(java.lang.String userName,
java.lang.String password,
byte[] sourceSeed_,
byte[] targetSeed_)
Strong Password Substitution (USRSSBPWD). |
private byte[] |
toHexByte(java.lang.String str,
int offset,
int length)
Convert a string into a byte array in hex format. |
private java.lang.String |
toHexString(byte[] data,
int offset,
int length)
Convert a byte array to a String with a hexidecimal format. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
transient Agent agent_
private static final byte[] modulusBytes__
private static final java.math.BigInteger modulus__
private static final byte[] baseBytes__
private static final java.math.BigInteger base__
private static final int exponential_length__
private javax.crypto.spec.DHParameterSpec paramSpec_
private java.security.KeyPairGenerator keyPairGenerator_
private java.security.KeyPair keyPair_
private javax.crypto.KeyAgreement keyAgreement_
private byte[] token_
private byte[] secKey_
private javax.crypto.SecretKeyFactory secretKeyFactory_
private java.lang.String providerName
private java.security.Provider provider
private java.security.MessageDigest messageDigest
private java.security.SecureRandom secureRandom
private static final int SECMEC_USRSSBPWD_SEED_LEN
private static final byte[] SECMEC_USRSSBPWD_PWDSEQS
private static final java.lang.String SHA_1_PRNG_ALGORITHM
public static final java.lang.String SHA_1_DIGEST_ALGORITHM
private static final char[] hex_table
Constructor Detail |
---|
public EncryptionManager(Agent agent) throws SqlException
SqlException
public EncryptionManager(Agent agent, java.lang.String algorithm) throws SqlException
SqlException
Method Detail |
---|
public byte[] obtainPublicKey()
private byte[] calculateEncryptionToken(int securityMechanism, byte[] initVector)
private void keyParityCheck(byte[] key) throws SqlException
SqlException
private byte[] generatePrivateKey(byte[] targetPublicKey) throws SqlException
SqlException
public byte[] encryptData(byte[] plainText, int securityMechanism, byte[] initVector, byte[] targetPublicKey) throws SqlException
SqlException
public byte[] decryptData(byte[] cipherText, int securityMechanism, byte[] initVector, byte[] targetPublicKey) throws SqlException
SqlException
public void setInitVector(byte[] initVector)
public void setSecKey(byte[] secKey)
public void resetSecurityKeys()
public byte[] generateSeed()
public byte[] substitutePassword(java.lang.String userName, java.lang.String password, byte[] sourceSeed_, byte[] targetSeed_) throws SqlException
userName
- The user's namepassword
- The user's passwordsourceSeed_
- random client seed (RDs)targetSeed_
- random server seed (RDr)
SqlException
private java.lang.String toHexString(byte[] data, int offset, int length)
b & 0xf0
),
the second character represents the low nibble (b & 0x0f
).
data[offset]
is represented by the first two
characters in the returned String.
data
- byte arrayoffset
- starting byte (zero based) to convert.length
- number of bytes to convert.
private byte[] toHexByte(java.lang.String str, int offset, int length)
b & 0xf0
),
the second byte represents the low nibble (b & 0x0f
).
str.charAt(0)
is represented by the first two bytes
in the returned String.
str
- stringoffset
- starting character (zero based) to convert.length
- number of characters to convert.
|
Built on Thu 2011-03-10 11:54:14+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |