org.apache.derby.client.am
Class EncryptionManager
- java.lang.Object
-
- org.apache.derby.client.am.EncryptionManager
-
public class EncryptionManager extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.StringSHA_1_DIGEST_ALGORITHM
-
Constructor Summary
Constructors Constructor and Description EncryptionManager(Agent agent)EncryptionManager(Agent agent, java.lang.String algorithm)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description byte[]decryptData(byte[] cipherText, int securityMechanism, byte[] initVector, byte[] targetPublicKey)byte[]encryptData(byte[] plainText, int securityMechanism, byte[] initVector, byte[] targetPublicKey)byte[]generateSeed()This method generates an 8-Byte random seed for the client (source).byte[]obtainPublicKey()voidresetSecurityKeys()byte[]substitutePassword(java.lang.String userName, java.lang.String password, byte[] sourceSeed_, byte[] targetSeed_)Strong Password Substitution (USRSSBPWD).
-
-
-
Field Detail
-
SHA_1_DIGEST_ALGORITHM
public static final java.lang.String SHA_1_DIGEST_ALGORITHM
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
EncryptionManager
public EncryptionManager(Agent agent) throws SqlException
- Throws:
SqlException
-
EncryptionManager
public EncryptionManager(Agent agent, java.lang.String algorithm) throws SqlException
- Throws:
SqlException
-
-
Method Detail
-
obtainPublicKey
public byte[] obtainPublicKey()
-
encryptData
public byte[] encryptData(byte[] plainText, int securityMechanism, byte[] initVector, byte[] targetPublicKey) throws SqlException- Throws:
SqlException
-
decryptData
public byte[] decryptData(byte[] cipherText, int securityMechanism, byte[] initVector, byte[] targetPublicKey) throws SqlException- Throws:
SqlException
-
resetSecurityKeys
public void resetSecurityKeys()
-
generateSeed
public byte[] generateSeed()
This method generates an 8-Byte random seed for the client (source).- Returns:
- a random 8-Byte seed.
-
substitutePassword
public byte[] substitutePassword(java.lang.String userName, java.lang.String password, byte[] sourceSeed_, byte[] targetSeed_) throws SqlExceptionStrong Password Substitution (USRSSBPWD). This method generates a password substitute to send to the target server. Substitution algorithm works as follow: PW_TOKEN = SHA-1(PW, ID) The password (PW) and user name (ID) can be of any length greater than or equal to 1 byte. The client generates a 20-byte password substitute (PW_SUB) as follows: PW_SUB = SHA-1(PW_TOKEN, RDr, RDs, ID, PWSEQs) w/ (RDs) as the random client seed and (RDr) as the server one. See PWDSSB - Strong Password Substitution Security Mechanism (DRDA Vol.3 - P.650)- Parameters:
userName- The user's namepassword- The user's passwordsourceSeed_- random client seed (RDs)targetSeed_- random server seed (RDr)- Returns:
- a password substitute.
- Throws:
SqlException
-
-
DataMelt 3.0 © DataMelt by jWork.ORG