use of com.axelor.apps.account.ebics.schema.xmldsig.X509DataType in project axelor-open-suite by axelor.
the class EbicsXmlFactory method createX509DataType.
/**
* Creates a new <code>X509DataType</code> XML object
*
* @param x509SubjectName the subject name
* @param x509Certificate the certificate
* @return the <code>X509DataType</code> XML object
*/
public static X509DataType createX509DataType(String x509SubjectName, byte[] x509Certificate) {
X509DataType newX509DataType = X509DataType.Factory.newInstance();
newX509DataType.setX509SubjectNameArray(new String[] { x509SubjectName });
newX509DataType.setX509CertificateArray(new byte[][] { x509Certificate });
return newX509DataType;
}
use of com.axelor.apps.account.ebics.schema.xmldsig.X509DataType in project axelor-open-suite by axelor.
the class EbicsXmlFactory method createX509DataType.
/**
* Creates a new <code>X509DataType</code> XML object
*
* @param x509SubjectName the subject name
* @param x509Certificate the certificate
* @return the <code>X509DataType</code> XML object
*/
public static X509DataType createX509DataType(String x509SubjectName, byte[] x509Certificate, String x509IssuerName, BigInteger x509SerialNumber) {
X509DataType newX509DataType = X509DataType.Factory.newInstance();
newX509DataType.setX509SubjectNameArray(new String[] { x509SubjectName });
newX509DataType.setX509CertificateArray(new byte[][] { x509Certificate });
X509IssuerSerialType x509IssuerSerialType = X509IssuerSerialType.Factory.newInstance();
x509IssuerSerialType.setX509IssuerName(x509IssuerName);
x509IssuerSerialType.setX509SerialNumber(x509SerialNumber);
X509IssuerSerialType[] x509IssuerSerialTypes = { x509IssuerSerialType };
newX509DataType.setX509IssuerSerialArray(x509IssuerSerialTypes);
return newX509DataType;
}
use of com.axelor.apps.account.ebics.schema.xmldsig.X509DataType in project axelor-open-suite by axelor.
the class HIARequestOrderDataElement method build.
@Override
public void build() {
HIARequestOrderDataType request;
AuthenticationPubKeyInfoType authenticationPubKeyInfo;
EncryptionPubKeyInfoType encryptionPubKeyInfo;
PubKeyValueType encryptionPubKeyValue;
X509DataType encryptionX509Data = null;
RSAKeyValueType encryptionRsaKeyValue;
PubKeyValueType authPubKeyValue;
X509DataType authX509Data = null;
RSAKeyValueType authRsaKeyValue;
EbicsCertificate certificate = session.getUser().getE002Certificate();
encryptionX509Data = EbicsXmlFactory.createX509DataType(session.getUser().getDn(), certificate.getCertificate());
// Include Certificate issuer and serial ?
// encryptionX509Data = EbicsXmlFactory.createX509DataType(session.getUser().getDn(),
// certificate.getCertificate(), certificate.getIssuer(), new
// BigInteger(certificate.getSerial(), 16));
encryptionRsaKeyValue = EbicsXmlFactory.createRSAKeyValueType(new BigInteger(certificate.getPublicKeyExponent(), 16).toByteArray(), new BigInteger(certificate.getPublicKeyModulus(), 16).toByteArray());
encryptionPubKeyValue = EbicsXmlFactory.createH003PubKeyValueType(encryptionRsaKeyValue, Calendar.getInstance());
encryptionPubKeyInfo = EbicsXmlFactory.createEncryptionPubKeyInfoType("E002", encryptionPubKeyValue, encryptionX509Data);
certificate = session.getUser().getX002Certificate();
authX509Data = EbicsXmlFactory.createX509DataType(session.getUser().getDn(), certificate.getCertificate());
// Include Certificate issuer and serial ?
// authX509Data = EbicsXmlFactory.createX509DataType(session.getUser().getDn(),
// certificate.getCertificate(), certificate.getIssuer(), new
// BigInteger(certificate.getSerial(), 16));
authRsaKeyValue = EbicsXmlFactory.createRSAKeyValueType(new BigInteger(certificate.getPublicKeyExponent(), 16).toByteArray(), new BigInteger(certificate.getPublicKeyModulus(), 16).toByteArray());
authPubKeyValue = EbicsXmlFactory.createH003PubKeyValueType(authRsaKeyValue, Calendar.getInstance());
authenticationPubKeyInfo = EbicsXmlFactory.createAuthenticationPubKeyInfoType("X002", authPubKeyValue, authX509Data);
request = EbicsXmlFactory.createHIARequestOrderDataType(authenticationPubKeyInfo, encryptionPubKeyInfo, session.getUser().getEbicsPartner().getPartnerId(), session.getUser().getUserId());
document = EbicsXmlFactory.createHIARequestOrderDataDocument(request);
}
use of com.axelor.apps.account.ebics.schema.xmldsig.X509DataType in project axelor-open-suite by axelor.
the class SignaturePubKeyOrderDataElement method build.
@Override
public void build() throws AxelorException {
SignaturePubKeyInfoType signaturePubKeyInfo;
X509DataType x509Data;
RSAKeyValueType rsaKeyValue;
PubKeyValueType pubKeyValue;
SignaturePubKeyOrderDataType signaturePubKeyOrderData;
EbicsCertificate certificate = session.getUser().getA005Certificate();
System.out.println("Certificate : " + new String(certificate.getCertificate()));
System.out.println("Certificate size : " + certificate.getCertificate().length);
EbicsCertificate ebicsEertificate = session.getUser().getA005Certificate();
// Include certificate issuer and serial (certificate information)
// x509Data = EbicsXmlFactory.createX509DataType(ebicsEertificate.getSubject(), certEncoded,
// ebicsEertificate.getIssuer(), new BigInteger(ebicsEertificate.getSerial(), 16));
x509Data = EbicsXmlFactory.createX509DataType(ebicsEertificate.getSubject(), ebicsEertificate.getCertificate());
rsaKeyValue = EbicsXmlFactory.createRSAKeyValueType(new BigInteger(ebicsEertificate.getPublicKeyExponent(), 16).toByteArray(), new BigInteger(ebicsEertificate.getPublicKeyModulus(), 16).toByteArray());
pubKeyValue = EbicsXmlFactory.createPubKeyValueType(rsaKeyValue, Calendar.getInstance());
signaturePubKeyInfo = EbicsXmlFactory.createSignaturePubKeyInfoType(x509Data, pubKeyValue, "A005");
signaturePubKeyOrderData = EbicsXmlFactory.createSignaturePubKeyOrderData(signaturePubKeyInfo, session.getUser().getEbicsPartner().getPartnerId(), session.getUser().getUserId());
document = EbicsXmlFactory.createSignaturePubKeyOrderDataDocument(signaturePubKeyOrderData);
}
Aggregations