Search in sources :

Example 1 with EncryptionPubKeyInfoType

use of com.axelor.apps.account.ebics.schema.h003.EncryptionPubKeyInfoType in project axelor-open-suite by axelor.

the class EbicsXmlFactory method createHIARequestOrderDataType.

/**
 * Creates a new <code>HIARequestOrderDataType</code> XML object
 *
 * @param authenticationPubKeyInfo the <code>AuthenticationPubKeyInfoType</code> element
 * @param encryptionPubKeyInfo the <code>EncryptionPubKeyInfoType</code> element
 * @param partnerId the partner ID
 * @param userId the user ID
 * @return the <code>HIARequestOrderDataType</code> XML object
 */
public static HIARequestOrderDataType createHIARequestOrderDataType(AuthenticationPubKeyInfoType authenticationPubKeyInfo, EncryptionPubKeyInfoType encryptionPubKeyInfo, String partnerId, String userId) {
    HIARequestOrderDataType newHIARequestOrderDataType = HIARequestOrderDataType.Factory.newInstance();
    newHIARequestOrderDataType.setAuthenticationPubKeyInfo(authenticationPubKeyInfo);
    newHIARequestOrderDataType.setEncryptionPubKeyInfo(encryptionPubKeyInfo);
    newHIARequestOrderDataType.setPartnerID(partnerId);
    newHIARequestOrderDataType.setUserID(userId);
    return newHIARequestOrderDataType;
}
Also used : HIARequestOrderDataType(com.axelor.apps.account.ebics.schema.h003.HIARequestOrderDataType)

Example 2 with EncryptionPubKeyInfoType

use of com.axelor.apps.account.ebics.schema.h003.EncryptionPubKeyInfoType in project axelor-open-suite by axelor.

the class EbicsXmlFactory method createEncryptionPubKeyInfoType.

/**
 * Creates a new <code>EncryptionPubKeyInfoType</code> XML object
 *
 * @param encryptionVersion the encryption version
 * @param pubKeyValue the <code>com.axelor.apps.account.ebics.schema.h003.PubKeyValueType</code>
 *     element
 * @param x509Data the <code>X509DataType</code> element
 * @return the <code>EncryptionPubKeyInfoType</code> XML object
 */
public static EncryptionPubKeyInfoType createEncryptionPubKeyInfoType(String encryptionVersion, com.axelor.apps.account.ebics.schema.h003.PubKeyValueType pubKeyValue, X509DataType x509Data) {
    EncryptionPubKeyInfoType newEncryptionPubKeyInfoType = EncryptionPubKeyInfoType.Factory.newInstance();
    newEncryptionPubKeyInfoType.setEncryptionVersion(encryptionVersion);
    newEncryptionPubKeyInfoType.setX509Data(x509Data);
    newEncryptionPubKeyInfoType.setPubKeyValue(pubKeyValue);
    return newEncryptionPubKeyInfoType;
}
Also used : EncryptionPubKeyInfoType(com.axelor.apps.account.ebics.schema.h003.EncryptionPubKeyInfoType)

Example 3 with EncryptionPubKeyInfoType

use of com.axelor.apps.account.ebics.schema.h003.EncryptionPubKeyInfoType 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);
}
Also used : X509DataType(com.axelor.apps.account.ebics.schema.xmldsig.X509DataType) EbicsCertificate(com.axelor.apps.bankpayment.db.EbicsCertificate) AuthenticationPubKeyInfoType(com.axelor.apps.account.ebics.schema.h003.AuthenticationPubKeyInfoType) PubKeyValueType(com.axelor.apps.account.ebics.schema.h003.PubKeyValueType) BigInteger(java.math.BigInteger) HIARequestOrderDataType(com.axelor.apps.account.ebics.schema.h003.HIARequestOrderDataType) RSAKeyValueType(com.axelor.apps.account.ebics.schema.xmldsig.RSAKeyValueType) EncryptionPubKeyInfoType(com.axelor.apps.account.ebics.schema.h003.EncryptionPubKeyInfoType)

Aggregations

EncryptionPubKeyInfoType (com.axelor.apps.account.ebics.schema.h003.EncryptionPubKeyInfoType)2 HIARequestOrderDataType (com.axelor.apps.account.ebics.schema.h003.HIARequestOrderDataType)2 AuthenticationPubKeyInfoType (com.axelor.apps.account.ebics.schema.h003.AuthenticationPubKeyInfoType)1 PubKeyValueType (com.axelor.apps.account.ebics.schema.h003.PubKeyValueType)1 RSAKeyValueType (com.axelor.apps.account.ebics.schema.xmldsig.RSAKeyValueType)1 X509DataType (com.axelor.apps.account.ebics.schema.xmldsig.X509DataType)1 EbicsCertificate (com.axelor.apps.bankpayment.db.EbicsCertificate)1 BigInteger (java.math.BigInteger)1