Examples of CMSTypedStream


Examples of org.bouncycastle.cms.CMSTypedStream

        sigOut.close();

        CMSSignedDataParser     sp = new CMSSignedDataParser(bOut.toByteArray());

        CMSTypedStream stream = sp.getSignedContent();

        assertEquals("1.2.3.4", stream.getContentType());

        stream.drain();

        //
        // compute expected content digest
        //
        MessageDigest md = MessageDigest.getInstance("SHA1", "BC");
View Full Code Here

Examples of org.bouncycastle.cms.CMSTypedStream

        sigOut.write(TEST_MESSAGE.getBytes());
       
        sigOut.close();
       
        CMSSignedDataParser     sp = new CMSSignedDataParser(
                new CMSTypedStream(new ByteArrayInputStream(TEST_MESSAGE.getBytes())), bOut.toByteArray());
   
        sp.getSignedContent().drain();
       
        verifySignatures(sp);
    }
View Full Code Here

Examples of org.bouncycastle.cms.CMSTypedStream

        sd = new CMSSignedData(new CMSProcessableByteArray(data), newOut.toByteArray());
        SignerInformation signer = (SignerInformation)sd.getSignerInfos().getSigners().iterator().next();

        assertEquals(signer.getDigestAlgOID(), CMSSignedDataStreamGenerator.DIGEST_SHA224);

        CMSSignedDataParser sp = new CMSSignedDataParser(new CMSTypedStream(new ByteArrayInputStream(data)), newOut.toByteArray());

        sp.getSignedContent().drain();

        verifySignatures(sp);
    }
View Full Code Here

Examples of org.bouncycastle.cms.CMSTypedStream

        ByteArrayInputStream original = new ByteArrayInputStream(bOut.toByteArray());
        ByteArrayOutputStream newOut = new ByteArrayOutputStream();

        CMSSignedDataParser.replaceCertificatesAndCRLs(original, certs, newOut);

        CMSSignedDataParser sp = new CMSSignedDataParser(new CMSTypedStream(new ByteArrayInputStream(data)), newOut.toByteArray());

        sp.getSignedContent().drain();

        verifySignatures(sp);
    }
View Full Code Here

Examples of org.bouncycastle.cms.CMSTypedStream

        sigOut.write(TEST_MESSAGE.getBytes());

        sigOut.close();

        CMSSignedDataParser sp = new CMSSignedDataParser(
                new CMSTypedStream(new ByteArrayInputStream(TEST_MESSAGE.getBytes())), bOut.toByteArray());

        sp.getSignedContent().drain();

        //
        // compute expected content digest
View Full Code Here

Examples of org.bouncycastle.cms.CMSTypedStream

  }

  private boolean verifyDetached(final byte[] data, final byte[] signature) throws CMSException, IOException, OperatorCreationException, GeneralSecurityException {
    InputStream inputStream = new ByteArrayInputStream(data);
    DigestCalculatorProvider digestCalculatorProvider = new BcDigestCalculatorProvider();
    CMSSignedDataParser signedDataParser = new CMSSignedDataParser(digestCalculatorProvider, new CMSTypedStream(inputStream), signature);
    CMSTypedStream signedContent = signedDataParser.getSignedContent();

    signedContent.drain();

    CollectionStore certificatesStore = (CollectionStore) signedDataParser.getCertificates();

    boolean verified = true;
View Full Code Here

Examples of org.bouncycastle.cms.CMSTypedStream

  }

  private boolean verifyDetached(final byte[] data, final byte[] signature) throws CMSException, IOException, OperatorCreationException, GeneralSecurityException {
    InputStream inputStream = new ByteArrayInputStream(data);
    DigestCalculatorProvider digestCalculatorProvider = new BcDigestCalculatorProvider();
    CMSSignedDataParser signedDataParser = new CMSSignedDataParser(digestCalculatorProvider, new CMSTypedStream(inputStream), signature);
    CMSTypedStream signedContent = signedDataParser.getSignedContent();

    signedContent.drain();

    CollectionStore certificatesStore = (CollectionStore) signedDataParser.getCertificates();

    boolean verified = true;
View Full Code Here

Examples of org.bouncycastle.cms.CMSTypedStream

    return verified;
  }

  private boolean verifyDetached(final byte[] data, final byte[] signature) throws CMSException, IOException, OperatorCreationException, GeneralSecurityException {
    InputStream inputStream = new ByteArrayInputStream(data);
    CMSSignedDataParser signedDataParser = new CMSSignedDataParser(new CMSTypedStream(inputStream), signature);
    CMSTypedStream signedContent = signedDataParser.getSignedContent();

    signedContent.drain();

    CollectionStore certificatesStore = (CollectionStore) signedDataParser.getCertificates();

    boolean verified = true;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.