Package org.bouncycastle.util

Examples of org.bouncycastle.util.Store


            X509Certificate cert = (X509Certificate) readCert(args[2]);
            System.out.println("Certificate read sucessfully");

            ContentSigner sha256Signer = new JcaContentSignerBuilder("SHA256withRSA").setProvider("BC").build(key);

            Store certs = certToStore(cert);

            generator.addCertificates(certs);
            generator.addSignerInfoGenerator(
                          new JcaSignerInfoGeneratorBuilder(
                                new JcaDigestCalculatorProviderBuilder().setProvider("BC").build())
View Full Code Here


   */
  public boolean verify(CMSSignedData s, OutputStream originalData)
     throws Exception
  {
    boolean verified = false;
    Store certStore = s.getCertificates();
    SignerInformationStore signers = s.getSignerInfos();
    Collection c = signers.getSigners();
    Iterator it = c.iterator();

    while(it.hasNext())
    {
      SignerInformation signer = (SignerInformation) it.next();
      Collection certCollection = certStore.getMatches(signer.getSID());

      Iterator certIt = certCollection.iterator();
      X509CertificateHolder cert = (X509CertificateHolder) certIt.next();

      if(signer.verify(new JcaSimpleSignerInfoVerifierBuilder().setProvider("BC").build(cert)))
View Full Code Here

  CMSSignedDataGenerator gen = new CMSSignedDataGenerator();
  ContentSigner sha1Signer = new JcaContentSignerBuilder("SHA1withRSA")
    .build(pair.getPrivate());
  X509Certificate cert = X509Certificates.createEphemeral(
    new X500Principal("CN=client"), pair);
  Store certs = new JcaCertStore(Collections.singleton(cert));
  gen.addSignerInfoGenerator(new JcaSignerInfoGeneratorBuilder(
    new JcaDigestCalculatorProviderBuilder().build()).build(
    sha1Signer, cert));
  gen.addCertificates(certs);
  CMSTypedData msg = new CMSAbsentContent();
View Full Code Here

    sd = new CMSSignedData(body);
      } catch (CMSException e) {
    throw new ServletException(e);
      }

      Store reqStore = sd.getCertificates();
      Collection<X509CertificateHolder> reqCerts = reqStore
        .getMatches(null);

      CertificateFactory factory;
      try {
    factory = CertificateFactory.getInstance("X.509");
View Full Code Here

  LOGGER.debug("pkiMessage digest algorithm: {}",
    signerInfo.getDigestAlgorithmID().getAlgorithm());
  LOGGER.debug("pkiMessage encryption algorithm: {}",
    signerInfo.getEncryptionAlgOID());

  Store store = pkiMessage.getCertificates();
  Collection<?> certColl;
  try {
      certColl = store.getMatches(signerInfo.getSID());
  } catch (StoreException e) {
      throw new MessageDecodingException(e);
  }
  if (certColl.size() > 0) {
      X509CertificateHolder cert = (X509CertificateHolder) certColl
View Full Code Here

      factory = CertificateFactory.getInstance("X509");
  } catch (CertificateException e) {
      throw new RuntimeException(e);
  }

  Store certStore = signedData.getCertificates();
  Store crlStore = signedData.getCRLs();

  Collection<X509CertificateHolder> certs = certStore.getMatches(null);
  Collection<X509CRLHolder> crls = crlStore.getMatches(null);

  Collection<Object> certsAndCrls = new ArrayList<Object>();

  for (X509CertificateHolder cert : certs) {
      ByteArrayInputStream byteIn;
View Full Code Here

    if ((signedContent != null) && (signedContent.getClass().isArray())) {
      timeStamp.setContent((byte[]) signedContent);
    }

    Store certificatesStore = timeStampToken.getCertificates();
    Collection certificatesCollection = certificatesStore.getMatches(null);
    List<Certificate> certificates = new ArrayList<Certificate>();
    for (Object obj : certificatesCollection) {
      if (obj instanceof X509CertificateHolder) {
        X509CertificateHolder holder = (X509CertificateHolder) obj;
        byte[] encoded = holder.getEncoded();
View Full Code Here

    if ((signedContent != null) && (signedContent.getClass().isArray())) {
      timeStamp.setContent((byte[]) signedContent);
    }

    Store certificatesStore = timeStampToken.getCertificates();
    Collection certificatesCollection = certificatesStore.getMatches(null);
    List<Certificate> certificates = new ArrayList<Certificate>();
    for (Object obj : certificatesCollection) {
      if (obj instanceof X509CertificateHolder) {
        X509CertificateHolder holder = (X509CertificateHolder) obj;
        byte[] encoded = holder.getEncoded();
View Full Code Here

      CMSTypedData msg = new CMSProcessableByteArray(theBytes);

      X509Certificate signCert = (X509Certificate) myKeyStore.getCertificate(myKeyAlias);
      certList.add(signCert);

      Store certs = new JcaCertStore(certList);

      CMSSignedDataGenerator gen = new CMSSignedDataGenerator();
      ContentSigner sha1Signer = new JcaContentSignerBuilder(myAlgorithm).setProvider("BC").build(getPrivateKey());

      gen.addSignerInfoGenerator(new JcaSignerInfoGeneratorBuilder(new JcaDigestCalculatorProviderBuilder().setProvider("BC").build()).build(sha1Signer, signCert));
View Full Code Here

    if ((signedContent != null) && (signedContent.getClass().isArray())) {
      timeStamp.setContent((byte[]) signedContent);
    }

    Store certificatesStore = timeStampToken.getCertificates();
    Collection certificatesCollection = certificatesStore.getMatches(null);
    List<Certificate> certificates = new ArrayList<Certificate>();
    for (Object obj : certificatesCollection) {
      if (obj instanceof X509CertificateHolder) {
        X509CertificateHolder holder = (X509CertificateHolder) obj;
        byte[] encoded = holder.getEncoded();
View Full Code Here

TOP

Related Classes of org.bouncycastle.util.Store

Copyright © 2018 www.massapicom. 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.