public class EncryptionManager
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
(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 and Description |
|---|
EncryptionManager(Agent agent) |
EncryptionManager(Agent agent,
java.lang.String algorithm) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
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
public EncryptionManager(Agent agent) throws SqlException
SqlExceptionpublic EncryptionManager(Agent agent, java.lang.String algorithm) throws SqlException
SqlExceptionpublic byte[] obtainPublicKey()
private byte[] calculateEncryptionToken(int securityMechanism,
byte[] initVector)
private void keyParityCheck(byte[] key)
throws SqlException
SqlExceptionprivate byte[] generatePrivateKey(byte[] targetPublicKey)
throws SqlException
SqlExceptionpublic byte[] encryptData(byte[] plainText,
int securityMechanism,
byte[] initVector,
byte[] targetPublicKey)
throws SqlException
SqlExceptionpublic byte[] decryptData(byte[] cipherText,
int securityMechanism,
byte[] initVector,
byte[] targetPublicKey)
throws SqlException
SqlExceptionpublic 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)SqlExceptionprivate 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.Apache Derby V10.10 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.