class DecryptionManager
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
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 static java.math.BigInteger |
modulus__ |
|
private static byte[] |
modulusBytes__ |
|
private javax.crypto.spec.DHParameterSpec |
paramSpec_ |
|
private static int |
SECMEC_USRSSBPWD_SEED_LEN |
|
private static java.lang.String |
SHA_1_PRNG_ALGORITHM |
Constructor | Description |
---|---|
DecryptionManager() |
EncryptionManager constructor.
|
Modifier and Type | Method | Description |
---|---|---|
private byte[] |
calculateDecryptionToken(int securityMechanism,
byte[] initVector) |
This method is used to calculate the decryption token.
|
byte[] |
decryptData(byte[] cipherText,
int securityMechanism,
byte[] initVector,
byte[] sourcePublicKey) |
This method generates a secret key using the application requester's
public key, and decrypts the usreid/password with the middle 8 bytes of
the generated secret key and a decryption token.
|
protected static byte[] |
generateSeed() |
This method generates an 8-Byte random seed.
|
byte[] |
obtainPublicKey() |
This method generates the public key and returns it.
|
protected static byte[] |
toHexByte(java.lang.String str,
int offset,
int length) |
Convert a string into a byte array in hex format.
|
protected static java.lang.String |
toHexString(byte[] data,
int offset,
int length) |
Convert a byte array to a String with a hexidecimal format.
|
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 java.security.KeyPairGenerator keyPairGenerator_
private java.security.KeyPair keyPair_
private javax.crypto.KeyAgreement keyAgreement_
private javax.crypto.spec.DHParameterSpec paramSpec_
private static final java.lang.String SHA_1_PRNG_ALGORITHM
private static final int SECMEC_USRSSBPWD_SEED_LEN
private static char[] hex_table
DecryptionManager() throws java.sql.SQLException
java.sql.SQLException
- that wraps any errorpublic byte[] obtainPublicKey()
private byte[] calculateDecryptionToken(int securityMechanism, byte[] initVector)
securityMechanism
- security mechanisminitVector
- userid or server(this side)'s connection keypublic byte[] decryptData(byte[] cipherText, int securityMechanism, byte[] initVector, byte[] sourcePublicKey) throws java.sql.SQLException
cipherText
- The byte array form userid/password to decrypt.securityMechanism
- security mechanisminitVector
- The byte array which is used to calculate the
decryption token for initializing the ciphersourcePublicKey
- application requester (encrypter)'s public key.java.sql.SQLException
protected static byte[] generateSeed() throws java.sql.SQLException
java.sql.SQLException
protected static 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.protected static 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.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.