Examples of CMSProcessableByteArray


Examples of org.bouncycastle.cms.CMSProcessableByteArray

                byte[] signedData = baos.toByteArray();
                mOutputJar.write(signedData);

                // CERT.*
                mOutputJar.putNextEntry(new JarEntry("META-INF/CERT." + mKey.getAlgorithm()));
                writeSignatureBlock(new CMSProcessableByteArray(signedData), mCertificate, mKey);
            } catch (Exception e) {
                throw new SigningException(e);
            }
        }

View Full Code Here

Examples of org.bouncycastle.cms.CMSProcessableByteArray

        SignerInfoGenerator signerInfoGenerator = signerInfoGeneratorBuilder.build(contentSigner, (X509Certificate) certificate);
        cmsSignedDataGenerator.addSignerInfoGenerator(signerInfoGenerator);
      }

      cmsSignedDataGenerator.addCertificates(this.getCertificateStore());
      CMSTypedData content = new CMSProcessableByteArray(data);

      CMSSignedData signedData = cmsSignedDataGenerator.generate(content, true);

      if (timeStampClient != null) {
        SignerInformationStore signerInformationStore = signedData.getSignerInfos();
View Full Code Here

Examples of org.bouncycastle.cms.CMSProcessableByteArray

    public void testSHA1WithRSAEncapsulated()
        throws Exception
    {
        List certList = new ArrayList();
        CMSProcessable msg = new CMSProcessableByteArray(TEST_MESSAGE.getBytes());

        certList.add(keyCert);

        CertStore certsAndCrls = CertStore.getInstance("Collection",
                        new CollectionCertStoreParameters(certList), "SUN");
View Full Code Here

Examples of org.bouncycastle.cms.CMSProcessableByteArray

        CMSEnvelopedDataGenerator edGen = new CMSEnvelopedDataGenerator();

        edGen.addKeyTransRecipient(keyCert);

        CMSEnvelopedData ed = edGen.generate(
                                new CMSProcessableByteArray(data),
                                algorithm, "SunJCE");

        RecipientInformationStore recipients = ed.getRecipientInfos();

View Full Code Here

Examples of org.bouncycastle.cms.CMSProcessableByteArray

    }

    public void testEach()
        throws Exception
    {
        CMSProcessableByteArray testData = new CMSProcessableByteArray(
                "Hello world!".getBytes());
        CMSCompressedDataGenerator gen = new CMSCompressedDataGenerator();

        CMSCompressedData cd = gen.generate(testData,
                CMSCompressedDataGenerator.ZLIB);

        assertEquals(true, Arrays.equals((byte[])testData.getContent(), cd
                .getContent()));
    }
View Full Code Here

Examples of org.bouncycastle.cms.CMSProcessableByteArray

   
    public void testSHA1WithRSANoAttributes()
        throws Exception
    {
        List                certList = new ArrayList();
        CMSProcessable      msg = new CMSProcessableByteArray(TEST_MESSAGE.getBytes());
   
        certList.add(_origCert);
        certList.add(_signCert);
   
        CertStore           certs = CertStore.getInstance("Collection",
View Full Code Here

Examples of org.bouncycastle.cms.CMSProcessableByteArray

   
    public void testDSANoAttributes()
        throws Exception
    {
        List                certList = new ArrayList();
        CMSProcessable      msg = new CMSProcessableByteArray(TEST_MESSAGE.getBytes());
   
        certList.add(_origDsaCert);
        certList.add(_signCert);
   
        CertStore           certs = CertStore.getInstance("Collection",
View Full Code Here

Examples of org.bouncycastle.cms.CMSProcessableByteArray

        sigOut.write(TEST_MESSAGE.getBytes());
       
        sigOut.close();

        CMSSignedData sd = new CMSSignedData(new CMSProcessableByteArray(TEST_MESSAGE.getBytes()), bOut.toByteArray());

        assertEquals(1, sd.getSignerInfos().getSigners().size());

        verifyEncodedData(bOut);
    }
View Full Code Here

Examples of org.bouncycastle.cms.CMSProcessableByteArray

        //
        ByteArrayOutputStream newOut = new ByteArrayOutputStream();

        CMSSignedDataParser.replaceSigners(original, sd.getSignerInfos(), newOut);

        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());
View Full Code Here

Examples of org.bouncycastle.cms.CMSProcessableByteArray

        CMSEnvelopedDataGenerator edGen = new CMSEnvelopedDataGenerator();

        edGen.addKeyTransRecipient(_reciCert);

        CMSEnvelopedData ed = edGen.generate(
                                new CMSProcessableByteArray(data),
                                CMSEnvelopedDataGenerator.DES_EDE3_CBC, "BC");

        RecipientInformationStore  recipients = ed.getRecipientInfos();

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.