Example usage for java.security.cert X509CRL getSignature

List of usage examples for java.security.cert X509CRL getSignature

Introduction

In this page you can find the example usage for java.security.cert X509CRL getSignature.

Prototype

public abstract byte[] getSignature();

Source Link

Document

Gets the signature value (the raw signature bits) from the CRL.

Usage

From source file:eu.europa.ec.markt.dss.signature.pades.PAdESProfileLTV.java

private void integrateCRL(LTVSignatureValidationCallback callback, PdfStamper stamper,
        PdfDictionary dssDictionary, PdfDictionary sigVriDictionary, PdfDictionary vriDictionary)
        throws IOException {
    if (callback.getCrlsArray().size() > 0) {
        // Reference in the DSS dictionary
        PdfIndirectReference crlsRef = stamper.getWriter().getPdfIndirectReference();
        stamper.getWriter().addToBody(callback.getCrlsArray(), crlsRef, false);
        dssDictionary.put(new PdfName("CRLs"), crlsRef);

        // Array in the signature's VRI dictionary
        PdfIndirectReference sigVriCrlRef = stamper.getWriter().getPdfIndirectReference();
        stamper.getWriter().addToBody(callback.getCrlsArray(), sigVriCrlRef, false);
        sigVriDictionary.put(new PdfName("CRL"), sigVriCrlRef);

        // Build and reference a VRI dictionary for each CRL
        for (X509CRL crl : crlRefs.keySet()) {
            try {
                PdfIndirectReference vriRef = buildVRIDict(stamper, crl);
                MessageDigest md = MessageDigest.getInstance(DigestAlgorithm.SHA1.getName());
                String hexHash = Hex.encodeHexString(md.digest(crl.getSignature())).toUpperCase();
                vriDictionary.put(new PdfName(hexHash), vriRef);
            } catch (NoSuchAlgorithmException e) {
                throw new RuntimeException();
            }/*from   www. j  a  va  2  s. c  om*/
        }
    }
}