Package java.security.cert

Examples of java.security.cert.X509Certificate.verify()


            for (int k = 0; k < oc.size(); ++k) {
                try {
                    if (provider == null)
                        v.verify(((X509Certificate)oc.get(k)).getPublicKey());
                    else
                        v.verify(((X509Certificate)oc.get(k)).getPublicKey(), provider);
                    found = true;
                    cc.add(oc.get(k));
                    oc.remove(k);
                    break;
                }
View Full Code Here


            if (esbCertificate == null)
            {
                throw new LoginException("No certificate found in keystore for alias '" + alias + "'");
            }
            //  verify that the caller supplied certificate was signed using the public key in our keystore.
            callerCert.verify(esbCertificate.getPublicKey());

            //  set the verified certificate. Will be used in commit to add principals to the subject.
            this.verifiedCertificate = callerCert;
            return true;
        }
View Full Code Here

        // Check if the certificate is authorised to access the Fnr
        if ( this.trustedCerts.contains(cert.getSerialNumber()) ) {
            // If we found in the hashmap the same key with issuer and serialnumber, we know we got it.
            // Just verify it as well to be damn sure
            try {
                cert.verify(this.cacert.getPublicKey());
            } catch (Exception e) {
            String errMsg = intres.getLocalizedMessage("ocsp.errorverifycert");
                m_log.error(errMsg, e);
                return false;
            }
View Full Code Here

            return null;
        }
        while ( i.hasNext() ) {
            tmpCert = i.next();
            try {
                tmpCert.verify(this.caChain.get(0).getPublicKey());
            } catch (Exception e) {
                tmpCert = null;
                continue;
            }
            if ( keyPair.getPublic().equals(tmpCert.getPublicKey()) )
View Full Code Here

    assertNotNull(rootcert);
    X509Certificate subcert = cache.findLatestBySubjectDN(HashID.getFromSubjectDN(testsubcert));
    // This old subcert should not be possible to verify with the new root cert
    boolean failed = false;
    try {
      subcert.verify(rootcert.getPublicKey());
    } catch (InvalidKeyException e) {
      failed = true;
    }
    assertTrue(failed);
    // CVC certificate should not be part of OCSP certificate cache
View Full Code Here

   
    // Test lookup based on CertID
    cert = cache.findByOcspHash(new CertificateID(CertificateID.HASH_SHA1, testrootcert, BigInteger.valueOf(0)));
    assertNotNull(cert);
    // The old subcert should verify with this old rootcert
    subcert.verify(cert.getPublicKey());
    // But not with the new rootcert
    cert = cache.findByOcspHash(new CertificateID(CertificateID.HASH_SHA1, testrootnewcert, BigInteger.valueOf(0)));
    assertNotNull(cert);
    failed = false;
    try {
View Full Code Here

    // But not with the new rootcert
    cert = cache.findByOcspHash(new CertificateID(CertificateID.HASH_SHA1, testrootnewcert, BigInteger.valueOf(0)));
    assertNotNull(cert);
    failed = false;
    try {
      subcert.verify(cert.getPublicKey());
    } catch (InvalidKeyException e) {
      failed = true;
    }
    assertTrue(failed);
   
View Full Code Here

        registerResultType = registerResult2.getValue();
       
        PrivateKeyType privateKeyType2 = registerResultType.getPrivateKey();
        RSAPrivateKey privkey2 = XKMSUtil.getPrivateKeyFromEncryptedXML(privateKeyType2, "This is total crap");
        X509Certificate cert = CertTools.genSelfCert("CN=test", 10, null,privkey2, keys.getPublic(), "SHA1WithRSA", true);
        cert.verify(keys.getPublic());   
    }   
 
  public void test02TestAliceRegistrationAuthenticationKey() throws Exception
    String authenticationData= "024837";
   
View Full Code Here

        RSAPublicKeySpec rSAPublicKeySpec = new RSAPublicKeySpec(new BigInteger(rSAKeyValueType.getModulus()), new BigInteger(rSAKeyValueType.getExponent()));       
        RSAPublicKey rSAPublicKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(rSAPublicKeySpec);
       
        X509Certificate cert = CertTools.genSelfCert("CN=test", 10, null,keys.getPrivate(), rSAPublicKey, "SHA1WithRSA", true);
       
        cert.verify(rSAPublicKey)
  }
}
View Full Code Here

    }
    final int nrOfCerts = multipart.getCount();
    for ( int i=0; i<nrOfCerts; i++ ) {
      final X509Certificate cert = (X509Certificate)this.cf.generateCertificate(multipart.getBodyPart(i).getInputStream());
      try {
        cert.verify(theCert.getPublicKey());
      } catch (GeneralSecurityException e) {
        // CA probably signed by an old not any longer existing CA. But this old CA certificate should still be in the DB. Let's check the chain.
        checkIssuer(cert);
        continue;
      }
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.