Class User
-
Constructor Summary
ConstructorsConstructorDescriptionUser(EbicsPartner partner, ObjectInputStream ois, PasswordCallback passwordCallback) Reconstructs a persisted EBICS user.User(EbicsPartner partner, String userId, String name, File keystorePath, PasswordCallback passwordCallback) Reconstructs a an EBICS user by loading its certificate from a given key store.User(EbicsPartner partner, String userId, String name, String email, String country, String organization, PasswordCallback passwordCallback) First time constructor. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]authenticate(byte[] digest) EBICS Specification 2.4.2 - 11.1.1 Process:byte[]decrypt(byte[] encryptedData, byte[] transactionKey) EBICS IG CFONB VF 2.1.4 2012 02 24 - 2.1.3.2 Calcul de la signature:byte[]Returns the signature certificate.Returns the public part of the signature key.getDN()Returns the distinguished namebyte[]Returns the encryption certificate.Returns the public part of the encryption key.getName()Returns the user name.Returns the customer in whose name we operate.Returns the password callback handler for the current user.Returns the save name of this savable object.Returns the type to security medium used to store the A005 key.Returns the (bank provided) user id.byte[]Returns the authentication certificate.Return the public part of the transport authentication key.booleanHas the users signature key been sent to the bank?booleanHave the users authentication and encryption keys been sent to the bank?booleanDid any persistable attribute change since last load/save operation.static byte[]removeOSSpecificChars(byte[] buf) EBICS Specification 2.4.2 - 7.1 Process description:voidsave(ObjectOutputStream oos) Writes all persistable attributes to the given stream.voidsaveUserCertificates(File directory) Saves the user certificates in a given directoryvoidsetA005Certificate(X509Certificate a005Certificate) Sets the signature certificate.voidsetA005PrivateKey(PrivateKey a005PrivateKey) Sets the signature private keyvoidsetE002Certificate(X509Certificate e002Certificate) Sets the encryption certificate.voidsetE002PrivateKey(PrivateKey e002PrivateKey) Sets the encryption private keyvoidsetInitialized(boolean isInitialized) The users signature key has been sent to the bank.voidsetInitializedHIA(boolean isInitializedHIA) The users authentication and encryption keys have been sent to the bank.voidsetX002Certificate(X509Certificate x002Certificate) Sets the authentication certificate.voidsetX002PrivateKey(PrivateKey x002PrivateKey) Sets the authentication private keybyte[]sign(byte[] digest) EBICS Specification 2.4.2 - 14.1 Version A005/A006 of the electronic signature:voidupdateKeys(KeyManagement keymgmt, PasswordCallback passwordCallback) Generates new keys for this user and sends them to the bank.
-
Constructor Details
-
User
public User(EbicsPartner partner, String userId, String name, String email, String country, String organization, PasswordCallback passwordCallback) throws GeneralSecurityException, IOException First time constructor. Use this constructor, if you want to prepare the first communication with the bank. For further communications you should recover persisted objects. All required signature keys will be generated now.- Parameters:
partner- customer in whose name we operate.userId- UserId as obtained from the bank.name- the user name,email- the user emailcountry- the user countryorganization- the user organization or companypasswordCallback- a callback-handler that supplies us with the password. This parameter can be null, in this case no password is used.- Throws:
IOExceptionGeneralSecurityException
-
User
public User(EbicsPartner partner, ObjectInputStream ois, PasswordCallback passwordCallback) throws IOException, GeneralSecurityException, ClassNotFoundException Reconstructs a persisted EBICS user.- Parameters:
partner- the customer in whose name we operate.ois- the object streampasswordCallback- a callback-handler that supplies us with the password.- Throws:
IOExceptionGeneralSecurityException- if the supplies password is wrong.ClassNotFoundException
-
User
public User(EbicsPartner partner, String userId, String name, File keystorePath, PasswordCallback passwordCallback) throws GeneralSecurityException, IOException Reconstructs a an EBICS user by loading its certificate from a given key store.- Parameters:
partner- the customer in whose name we operate.userId- UserID as obtained from the bank.keystorePath- the key store pathpasswordCallback- a callback-handler that supplies us with the password.- Throws:
GeneralSecurityExceptionIOException
-
-
Method Details
-
saveUserCertificates
Saves the user certificates in a given directory- Throws:
GeneralSecurityExceptionIOException
-
save
Description copied from interface:SavableWrites all persistable attributes to the given stream.- Specified by:
savein interfaceSavable- Parameters:
oos- the given stream.- Throws:
IOException- save process failed
-
isInitialized
public boolean isInitialized()Has the users signature key been sent to the bank?- Returns:
- True if the users signature key been sent to the bank
-
setInitialized
public void setInitialized(boolean isInitialized) The users signature key has been sent to the bank.- Parameters:
isInitialized- transfer successful?
-
isInitializedHIA
public boolean isInitializedHIA()Have the users authentication and encryption keys been sent to the bank?- Returns:
- True if the users authentication and encryption keys been sent to the bank.
-
setInitializedHIA
public void setInitializedHIA(boolean isInitializedHIA) The users authentication and encryption keys have been sent to the bank.- Parameters:
isInitializedHIA- transfer successful?
-
updateKeys
public void updateKeys(KeyManagement keymgmt, PasswordCallback passwordCallback) throws EbicsException, IOException Generates new keys for this user and sends them to the bank.- Parameters:
keymgmt- the key management instance with the ebics session.passwordCallback- the password-callback for the new keys.- Throws:
EbicsException- Exception during server requestIOException- Exception during server request
-
removeOSSpecificChars
public static byte[] removeOSSpecificChars(byte[] buf) EBICS Specification 2.4.2 - 7.1 Process description:In particular, so-called “white-space characters” such as spaces, tabs, carriage returns and line feeds (“CR/LF”) are not permitted.
All white-space characters should be removed from entry buffer
buf.- Parameters:
buf- the given byte buffer- Returns:
- The byte buffer portion corresponding to the given length and offset
-
needsSave
public boolean needsSave()Did any persistable attribute change since last load/save operation.- Returns:
- True if the object needs to be saved.
-
getA005Certificate
Description copied from interface:EbicsUserReturns the signature certificate.- Specified by:
getA005Certificatein interfaceEbicsUser- Returns:
- the encryption certificate.
- Throws:
EbicsException
-
getE002Certificate
Description copied from interface:EbicsUserReturns the encryption certificate.- Specified by:
getE002Certificatein interfaceEbicsUser- Returns:
- the encryption certificate.
- Throws:
EbicsException
-
getX002Certificate
Description copied from interface:EbicsUserReturns the authentication certificate.- Specified by:
getX002Certificatein interfaceEbicsUser- Returns:
- the encryption certificate.
- Throws:
EbicsException
-
setA005Certificate
Description copied from interface:EbicsUserSets the signature certificate.- Specified by:
setA005Certificatein interfaceEbicsUser- Parameters:
a005Certificate- the signature certificate.
-
setE002Certificate
Description copied from interface:EbicsUserSets the encryption certificate.- Specified by:
setE002Certificatein interfaceEbicsUser- Parameters:
e002Certificate- the encryption certificate.
-
setX002Certificate
Description copied from interface:EbicsUserSets the authentication certificate.- Specified by:
setX002Certificatein interfaceEbicsUser- Parameters:
x002Certificate- the authentication certificate.
-
getA005PublicKey
Description copied from interface:EbicsUserReturns the public part of the signature key.- Specified by:
getA005PublicKeyin interfaceEbicsUser- Returns:
- the public part of the signature key.
-
getE002PublicKey
Description copied from interface:EbicsUserReturns the public part of the encryption key.- Specified by:
getE002PublicKeyin interfaceEbicsUser- Returns:
- the public part of the encryption key.
-
getX002PublicKey
Description copied from interface:EbicsUserReturn the public part of the transport authentication key.- Specified by:
getX002PublicKeyin interfaceEbicsUser- Returns:
- the public part of the transport authentication key.
-
setA005PrivateKey
Description copied from interface:EbicsUserSets the signature private key- Specified by:
setA005PrivateKeyin interfaceEbicsUser- Parameters:
a005PrivateKey- the signature private key
-
setX002PrivateKey
Description copied from interface:EbicsUserSets the authentication private key- Specified by:
setX002PrivateKeyin interfaceEbicsUser- Parameters:
x002PrivateKey- the authentication private key
-
setE002PrivateKey
Description copied from interface:EbicsUserSets the encryption private key- Specified by:
setE002PrivateKeyin interfaceEbicsUser- Parameters:
e002PrivateKey- the encryption private key
-
getSecurityMedium
Description copied from interface:EbicsUserReturns the type to security medium used to store the A005 key.- Specified by:
getSecurityMediumin interfaceEbicsUser- Returns:
- the type to security medium used to store the A005 key.
-
getPartner
Description copied from interface:EbicsUserReturns the customer in whose name we operate.- Specified by:
getPartnerin interfaceEbicsUser- Returns:
- the customer in whose name we operate.
-
getUserId
-
getName
-
getDN
-
getPasswordCallback
Description copied from interface:EbicsUserReturns the password callback handler for the current user.- Specified by:
getPasswordCallbackin interfaceEbicsUser- Returns:
- the password callback handler.
-
getSaveName
Description copied from interface:SavableReturns the save name of this savable object.- Specified by:
getSaveNamein interfaceSavable- Returns:
- the save name
-
authenticate
EBICS Specification 2.4.2 - 11.1.1 Process:Identification and authentication signatures are based on the RSA signature process. The following parameters determine the identification and authentication signature process:
- Length of the (secret) RSA key
- Hash algorithm
- Padding process
- Canonisation process.
For the identification and authentication process, EBICS defines the process “X002” with the following parameters:
- Key length in Kbit >=1Kbit (1024 bit) and lesser than 16Kbit
- Hash algorithm SHA-256
- Padding process: PKCS#1
- Canonisation process: http://www.w3.org/TR/2001/REC-xml-c14n-20010315
From EBICS 2.4 on, the customer system must use the hash value of the public bank key X002 in a request.
Notes:
- The key length is defined else where.
- The padding is performed by the
Signatureclass. - The digest is already canonized in the
sign(byte[])
- Specified by:
authenticatein interfaceEbicsUser- Parameters:
digest- the given digest- Returns:
- the signature.
- Throws:
GeneralSecurityException
-
sign
EBICS Specification 2.4.2 - 14.1 Version A005/A006 of the electronic signature:For the signature processes A005 an interval of 1536 bit (minimum) and 4096 bit (maximum) is defined for the key length.
The digital signature mechanisms A005 is both based on the industry standard [PKCS1] using the hash algorithm SHA-256. They are both signature mechanisms without message recovery.
A hash algorithm maps bit sequences of arbitrary length (input bit sequences) to byte sequences of a fixed length, determined by the Hash algorithm. The result of the execution of a Hash algorithm to a bit sequence is defined as hash value.
The hash algorithm SHA-256 is specified in [FIPS H2]. SHA-256 maps input bit sequences of arbitrary length to byte sequences of 32 byte length. The padding of input bit sequences to a length being a multiple of 64 byte is part of the hash algorithm. The padding even is applied if the input bit sequence already has a length that is a multiple of 64 byte.
SHA-256 processes the input bit sequences in blocks of 64 byte length. The hash value of a bit sequence x under the hash algorithm SHA-256 is referred to as follows: SHA-256(x).
The digital signature mechanism A005 is identical to EMSA-PKCS1-v1_5 using the hash algorithm SHA-256. The byte length H of the hash value is 32. According [PKCS1] (using the method EMSA-PKCS1-v1_5) the following steps shall be performed for the computation of a signature for message M with bit length m.
- The hash value HASH(M) of the byte length H shall be computed. In the case of A005 SHA-256(M) with a length of 32 bytes.
- The DSI for the signature algorithm shall be generated.
- A signature shall be computed using the DSI with the standard algorithm for the signature generation described in section 14.1.3.1 of the EBICS specification (V 2.4.2).
The
Signatureis a digital signature scheme with appendix (SSA) combining the RSA algorithm with the EMSA-PKCS1-v1_5 encoding method.The
digestwill be signed with the RSA user signature key using theSignaturethat will be instantiated with the SHA-256 algorithm. This signature is then put in aUserSignatureXML object that will be sent to the EBICS server.- Specified by:
signin interfaceEbicsUser- Parameters:
digest-- Returns:
- the signature
- Throws:
GeneralSecurityException
-
decrypt
public byte[] decrypt(byte[] encryptedData, byte[] transactionKey) throws EbicsException, GeneralSecurityException, IOException EBICS IG CFONB VF 2.1.4 2012 02 24 - 2.1.3.2 Calcul de la signature:Il convient d’utiliser PKCS1 V1.5 pour chiffrer la clé de chiffrement.
EBICS Specification 2.4.2 - 15.2 Workflows at the recipient’s end:
Decryption of the DES key
The leading 256 null bits of the EDEK are removed and the remaining 768 bits are decrypted with the recipient’s secret key of the RSA key system. PDEK is then present. The secret DES key DEK is obtained from the lowest-value 128 bits of PDEK, this is split into the individual keys DEKleft and DEKright.
- Specified by:
decryptin interfaceEbicsUser- Parameters:
encryptedData- the given secret keytransactionKey- a given transaction key- Returns:
- the decrypted key;
- Throws:
EbicsExceptionGeneralSecurityExceptionIOException
-