Search in sources :

Example 1 with XmlCertIDType

use of xades4j.xml.bind.xades.XmlCertIDType in project xades4j by luisgoncalves.

the class ToXmlUtils method getXmlCertRefList.

/**/
static XmlCertIDListType getXmlCertRefList(BaseCertRefsData certRefsData) {
    XmlCertIDListType xmlCertRefListProp = new XmlCertIDListType();
    List<XmlCertIDType> xmlCertRefList = xmlCertRefListProp.getCert();
    XmlDigestAlgAndValueType certDigest;
    XmlDigestMethodType certDigestMethod;
    XmlX509IssuerSerialType issuerSerial;
    XmlCertIDType certID;
    for (CertRef certRef : certRefsData.getCertRefs()) {
        certDigestMethod = new XmlDigestMethodType();
        certDigestMethod.setAlgorithm(certRef.digestAlgUri);
        certDigest = new XmlDigestAlgAndValueType();
        certDigest.setDigestMethod(certDigestMethod);
        certDigest.setDigestValue(certRef.digestValue);
        issuerSerial = new XmlX509IssuerSerialType();
        issuerSerial.setX509IssuerName(certRef.issuerDN);
        issuerSerial.setX509SerialNumber(certRef.serialNumber);
        certID = new XmlCertIDType();
        certID.setCertDigest(certDigest);
        certID.setIssuerSerial(issuerSerial);
        xmlCertRefList.add(certID);
    }
    return xmlCertRefListProp;
}
Also used : XmlDigestAlgAndValueType(xades4j.xml.bind.xades.XmlDigestAlgAndValueType) XmlCertIDType(xades4j.xml.bind.xades.XmlCertIDType) XmlX509IssuerSerialType(xades4j.xml.bind.xmldsig.XmlX509IssuerSerialType) XmlCertIDListType(xades4j.xml.bind.xades.XmlCertIDListType) CertRef(xades4j.properties.data.CertRef) XmlDigestMethodType(xades4j.xml.bind.xmldsig.XmlDigestMethodType)

Example 2 with XmlCertIDType

use of xades4j.xml.bind.xades.XmlCertIDType in project xades4j by luisgoncalves.

the class FromXmlUtils method createAndCertificateRefs.

static void createAndCertificateRefs(XmlCertIDListType xmlCertRefs, BaseCertRefsData certRefsData) {
    for (XmlCertIDType xmlCertIDType : xmlCertRefs.getCert()) {
        /* All the elements within Cert are marked with 'required' */
        XmlX509IssuerSerialType is = xmlCertIDType.getIssuerSerial();
        XmlDigestAlgAndValueType d = xmlCertIDType.getCertDigest();
        CertRef ref = new CertRef(is.getX509IssuerName(), is.getX509SerialNumber(), d.getDigestMethod().getAlgorithm(), // Digest value is already decoded.
        d.getDigestValue());
        certRefsData.addCertRef(ref);
    }
}
Also used : XmlDigestAlgAndValueType(xades4j.xml.bind.xades.XmlDigestAlgAndValueType) XmlCertIDType(xades4j.xml.bind.xades.XmlCertIDType) XmlX509IssuerSerialType(xades4j.xml.bind.xmldsig.XmlX509IssuerSerialType) CertRef(xades4j.properties.data.CertRef)

Aggregations

CertRef (xades4j.properties.data.CertRef)2 XmlCertIDType (xades4j.xml.bind.xades.XmlCertIDType)2 XmlDigestAlgAndValueType (xades4j.xml.bind.xades.XmlDigestAlgAndValueType)2 XmlX509IssuerSerialType (xades4j.xml.bind.xmldsig.XmlX509IssuerSerialType)2 XmlCertIDListType (xades4j.xml.bind.xades.XmlCertIDListType)1 XmlDigestMethodType (xades4j.xml.bind.xmldsig.XmlDigestMethodType)1