| java.lang.Object org.apache.derby.impl.drda.DecryptionManager
DecryptionManager | class DecryptionManager (Code) | | This class is used to decrypt password and/or userid.
It uses Diffie_Hellman algorithm to get the publick key and secret key, and then
DES encryption is done using certain token (based on security mechanism) and
this side's own public key. Basically, this class is called when using a security
mechanism that encrypts user ID and password (eusridpwd). This class uses IBM JCE
to do Diffie_Hellman algorithm and DES encryption.
|
Method Summary | |
public 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. | public byte[] | obtainPublicKey() This method generates the public key and returns it. | protected static byte[] | toHexByte(String str, int offset, int length) Convert a string into a byte array in hex format.
For each character (b) two bytes are generated, the first byte
represents the high nibble (4 bits) in hexidecimal (b & 0xf0 ),
the second byte
represents the low nibble (b & 0x0f ).
The character at str.charAt(0) is represented by the first two bytes
in the returned String.
Parameters: str - string Parameters: offset - starting character (zero based) to convert. Parameters: length - number of characters to convert. | protected static String | toHexString(byte[] data, int offset, int length) Convert a byte array to a String with a hexidecimal format.
The String may be converted back to a byte array using fromHexString.
For each byte (b) two characaters are generated, the first character
represents the high nibble (4 bits) in hexidecimal (b & 0xf0 ),
the second character represents the low nibble (b & 0x0f ).
The byte at data[offset] is represented by the first two characters in the returned String.
Parameters: data - byte array Parameters: offset - starting byte (zero based) to convert. Parameters: length - number of bytes to convert. |
DecryptionManager | DecryptionManager() throws SQLException(Code) | | EncryptionManager constructor. In this constructor,DHParameterSpec,
KeyPairGenerator, KeyPair, and KeyAgreement are initialized.
throws: SQLException - that wraps any error |
decryptData | public byte[] decryptData(byte[] cipherText, int securityMechanism, byte[] initVector, byte[] sourcePublicKey) throws SQLException(Code) | | 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. Then it returns the
decrypted data in a byte array.
Parameters: cipherText - The byte array form userid/password to decrypt. Parameters: securityMechanism - security mechanism Parameters: initVector - The byte array which is used to calculate thedecryption token for initializing the cipher Parameters: sourcePublicKey - application requester (encrypter)'s public key. the decrypted data (plain text) in a byte array. |
generateSeed | protected static byte[] generateSeed() throws SQLException(Code) | | This method generates an 8-Byte random seed.
Required for the SECMEC_USRSSBPWD security mechanism
a random 8-Byte seed. |
obtainPublicKey | public byte[] obtainPublicKey()(Code) | | This method generates the public key and returns it. This
shared public key is the application server's connection key and will
be exchanged with the application requester's connection key. This connection
key will be put in the sectkn in ACCSECRD command and send to the application
requester.
a byte array that is the application server's public key |
toHexByte | protected static byte[] toHexByte(String str, int offset, int length)(Code) | | Convert a string into a byte array in hex format.
For each character (b) two bytes are generated, the first byte
represents the high nibble (4 bits) in hexidecimal (b & 0xf0 ),
the second byte
represents the low nibble (b & 0x0f ).
The character at str.charAt(0) is represented by the first two bytes
in the returned String.
Parameters: str - string Parameters: offset - starting character (zero based) to convert. Parameters: length - number of characters to convert. the byte[] (with hexidecimal format) form of the string (str) |
toHexString | protected static String toHexString(byte[] data, int offset, int length)(Code) | | Convert a byte array to a String with a hexidecimal format.
The String may be converted back to a byte array using fromHexString.
For each byte (b) two characaters are generated, the first character
represents the high nibble (4 bits) in hexidecimal (b & 0xf0 ),
the second character represents the low nibble (b & 0x0f ).
The byte at data[offset] is represented by the first two characters in the returned String.
Parameters: data - byte array Parameters: offset - starting byte (zero based) to convert. Parameters: length - number of bytes to convert. the String (with hexidecimal format) form of the byte array |
|
|