Package org.bouncycastle.cms

Examples of org.bouncycastle.cms.SignerInformation


      if (timeStampClient != null) {
        SignerInformationStore signerInformationStore = signedData.getSignerInfos();
        List list = new ArrayList();
        for (Object o : signerInformationStore.getSigners()) {
          SignerInformation signerInformation = (SignerInformation) o;
          TimeStamp timeStamp = timeStampClient.getTimeStamp(signerInformation.getSignature());
          ASN1Primitive asn1Primitive = BouncyCastleProviderHelper.toASN1Primitive(timeStamp.getEncoded());
          DERSet derSet = new DERSet(asn1Primitive);

          Hashtable hashtable = new Hashtable();
          Attribute attribute = new Attribute(PKCSObjectIdentifiers.id_aa_signatureTimeStampToken, derSet);
View Full Code Here


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

    SignerInformationStore signerInformationStore = signedData.getSignerInfos();
    boolean verified = true;
    for (Object o : signerInformationStore.getSigners()) {
      SignerInformation signerInformation = (SignerInformation) o;

      verified = BouncyCastleSignerHelper.verifySignature(signerInformation, certificatesStore, data, false);
      if (!verified) {
        break;
      }
View Full Code Here

    boolean verified = true;

    SignerInformationStore signerInformationStore = signedDataParser.getSignerInfos();
    for (Object o : signerInformationStore.getSigners()) {
      SignerInformation signerInformation = (SignerInformation) o;

      if (!BouncyCastleSignerHelper.verifySignature(signerInformation, certificatesStore, data, true)) {
        verified = false;
        break;
      }
View Full Code Here

   public boolean verify(PublicKey publicKey) throws Exception
   {
      SMIMESigned signed = new SMIMESigned(body);

      SignerInformationStore signers = signed.getSignerInfos();
      SignerInformation signer = (SignerInformation) signers.getSigners().iterator().next();
      return signer.verify(publicKey, "BC");

   }
View Full Code Here

   public boolean verify(X509Certificate certificate) throws Exception
   {
      for (Object info : data.getSignerInfos().getSigners())
      {
         SignerInformation signer = (SignerInformation)info;
         if (signer.verify(certificate, "BC"))
         {
            return true;
         }
      }
      return false;
View Full Code Here

   }
   public boolean verify(PublicKey publicKey) throws Exception
   {
      for (Object info : data.getSignerInfos().getSigners())
      {
         SignerInformation signer = (SignerInformation)info;
         if (signer.verify(publicKey, "BC"))
         {
            return true;
         }
      }
      return false;
View Full Code Here

      byte[] bytes = (byte[])data.getSignedContent().getContent();
      System.out.println("BYTES: " + new String(bytes));
      System.out.println("size:" + signed.length);
      System.out.println("Base64.size: " + Base64.encodeBytes(signed).length());

      SignerInformation signer = (SignerInformation)data.getSignerInfos().getSigners().iterator().next();
      System.out.println("valid: " + signer.verify(cert, "BC"));
      client.close();


   }
View Full Code Here

      SMIMESigned signed = new SMIMESigned(mm);

      SignerInformationStore signers = signed.getSignerInfos();
      Assert.assertEquals(1, signers.size());
      SignerInformation signer = (SignerInformation) signers.getSigners().iterator().next();
      Assert.assertTrue(signer.verify(cert.getPublicKey(), "BC"));
   }
View Full Code Here

      if (timeStampClient != null) {
        SignerInformationStore signerInformationStore = signedData.getSignerInfos();
        List list = new ArrayList();
        for (Object o : signerInformationStore.getSigners()) {
          SignerInformation signerInformation = (SignerInformation) o;
          TimeStamp timeStamp = timeStampClient.getTimeStamp(signerInformation.getSignature());
          DERObject derObject = new ASN1InputStream(timeStamp.getEncoded()).readObject();
          DERSet derSet = new DERSet(derObject);

          Hashtable hashtable = new Hashtable();
          Attribute unsignAtt = new Attribute(PKCSObjectIdentifiers.id_aa_signatureTimeStampToken, derSet);
View Full Code Here

      // CollectionStore crlStore = (CollectionStore) signedData.getCRLs();

      SignerInformationStore signerInformationStore = signedData.getSignerInfos();
      boolean verified = true;
      for (Object o : signerInformationStore.getSigners()) {
        SignerInformation signerInformation = (SignerInformation) o;

        Collection<Certificate> collection = certificatesStore.getMatches(null);
        if (!collection.isEmpty()) {
          for (Certificate cert : collection) {

            JcaContentVerifierProviderBuilder jcaContentVerifierProviderBuilder = new JcaContentVerifierProviderBuilder();
            jcaContentVerifierProviderBuilder.setProvider(BouncyCastleProviderHelper.PROVIDER_NAME);

            ContentVerifierProvider contentVerifierProvider = jcaContentVerifierProviderBuilder.build((X509Certificate) cert);

            JcaDigestCalculatorProviderBuilder digestCalculatorProviderBuilder = new JcaDigestCalculatorProviderBuilder();
            digestCalculatorProviderBuilder.setProvider(BouncyCastleProviderHelper.PROVIDER_NAME);
            DigestCalculatorProvider digestCalculatorProvider = digestCalculatorProviderBuilder.build();

            SignerInformationVerifier signerInformationVerifier = new SignerInformationVerifier(contentVerifierProvider, digestCalculatorProvider);

            if (!signerInformation.verify(signerInformationVerifier)) {
              verified = false;
            }
          }
        }
      }
View Full Code Here

TOP

Related Classes of org.bouncycastle.cms.SignerInformation

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.