Package org.bouncycastle.cms

Examples of org.bouncycastle.cms.SignerInformation.verify()


   {
      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

      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"));
   }

   @Test
   public void testOutput() throws Exception
   {
View Full Code Here

            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

            Collection          certCollection = certs.getCertificates(signer.getSID());

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

            assertEquals(true, signer.verify(cert, "BC"));
        }

        ((FileBackedMimeBodyPart)mm).dispose();
    }
View Full Code Here

            Collection          certCollection = certs.getCertificates(signer.getSID());
   
            Iterator        certIt = certCollection.iterator();
            X509Certificate cert = (X509Certificate)certIt.next();
   
            assertEquals(true, signer.verify(cert, "BC"));
        }
    }
   
    private void verifyMessageBytes(MimeBodyPart a, MimeBodyPart b)
        throws Exception
View Full Code Here

            Collection          certCollection = certsAndCrls.getCertificates(signer.getSID());

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

            assertEquals(true, signer.verify(cert, "SunRsaSign"));
        }
    }

    public void testSHA1WithRSAStream()
        throws Exception
View Full Code Here

            Collection          certCollection = certStore.getCertificates(signer.getSID());

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

            assertEquals(true, signer.verify(cert, "SunRsaSign"));

            if (contentDigest != null)
            {
                assertTrue(MessageDigest.isEqual(contentDigest, signer.getContentDigest()));
            }
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.