Package java.security

Examples of java.security.PublicKey


                     .getBigIntegerFromChildElement(Constants._TAG_Q, Constants
                     .SignatureSpecNS), this
                        .getBigIntegerFromChildElement(Constants
                           ._TAG_G, Constants.SignatureSpecNS));
         KeyFactory dsaFactory = KeyFactory.getInstance("DSA");
         PublicKey pk = dsaFactory.generatePublic(pkspec);

         return pk;
      } catch (NoSuchAlgorithmException ex) {
         throw new XMLSecurityException("empty", ex);
      } catch (InvalidKeySpecException ex) {
View Full Code Here


            new RSAPublicKeySpec(this
               .getBigIntegerFromChildElement(Constants._TAG_MODULUS, Constants
               .SignatureSpecNS), this
                  .getBigIntegerFromChildElement(Constants
                     ._TAG_EXPONENT, Constants.SignatureSpecNS));
         PublicKey pk = rsaFactory.generatePublic(rsaKeyspec);

         return pk;
      } catch (NoSuchAlgorithmException ex) {
         throw new XMLSecurityException("empty", ex);
      } catch (InvalidKeySpecException ex) {
View Full Code Here

        String alias = "runes-system"; // FIX

        KeyStore ks = KeyStore.getInstance("JKS");
        ks.load(new FileInputStream(ksl), ksp.toCharArray());
        PrivateKey privateKey = (PrivateKey) ks.getKey(alias, alias.toCharArray()); // FIX, password
        PublicKey publicKey = ks.getCertificate(alias).getPublicKey();
        keyPair = new KeyPair(publicKey, privateKey);
      }

      return new SignedAspect(ext, keyPair);
View Full Code Here

            checkKeyStore();
            if (isKeyStoreExists() && !isKeyStoreEmpty()) {
                Key key = keyStore.getKey(alias, password);
                if (key instanceof PrivateKey) {
                    Certificate cert = keyStore.getCertificate(alias);
                    PublicKey publicKey = cert.getPublicKey();
                    return new KeyPair(publicKey, (PrivateKey) key);
                }
            }
        } catch (Exception e) {
            log.error("Could not get key pair with alias " + alias + ".", e);
View Full Code Here

      return result;
   }

   public void verifySignature(Map headers, byte[] body, Verification verification, DKIMSignature signature) throws SignatureException
   {
      PublicKey key = verification.getKey();

      if (key == null)
      {
         if (verification.getRepository() != null)
         {
View Full Code Here

      repository.setUseDns(false);
      repository.start();

      PrivateKey privateKey = repository.getKeyStore().getPrivateKey("test._domainKey.samplezone.org");
      if (privateKey == null) throw new Exception("Private Key is null!!!");
      PublicKey publicKey = repository.getKeyStore().getPublicKey("test._domainKey.samplezone.org");
      keys = new KeyPair(publicKey, privateKey);

      KeyPair keyPair = KeyPairGenerator.getInstance("RSA").generateKeyPair();
      badKey = keyPair.getPrivate();
View Full Code Here

                    // try to parse url
                    locationURL = new DigestURI(location);
                } catch (final MalformedURLException e) {
                    break;
                }
                PublicKey publicKey = null;
                // get public key if it's in config
                try {
                    final String publicKeyString = getConfig("network.unit.update.location" + i + ".key", null);
                    if (publicKeyString != null) {
                        final byte[] publicKeyBytes = Base64Order.standardCoder.decode(publicKeyString.trim());
View Full Code Here

    signFile.close();
      } else if(args[0].equals("--verify") && args.length==3) {
    CryptoLib cl = new CryptoLib();
    CharBuffer pubKeyBuffer = new CharBuffer(new File(args[1]));
    byte[] pubKeyByteBuffer = Base64Order.standardCoder.decode(pubKeyBuffer.toString().trim());
    PublicKey pubKey = cl.getPublicKeyFromBytes(pubKeyByteBuffer);

    FileInputStream dataStream = new FileInputStream(args[2]);

    CharBuffer signBuffer = new CharBuffer(new File(args[2] + ".sig"));
    byte[] signByteBuffer = Base64Order.standardCoder.decode(signBuffer.toString().trim());
View Full Code Here

    protected void verify(String host, SSLSession session) throws Exception {

        X509Certificate[] chain;
        X509Certificate   certificate;
        Principal         principal;
        PublicKey         publicKey;
        String            DN;
        String            CN;
        int               start;
        int               end;
        String            emsg;
View Full Code Here

       
        try {
           
       
            PrivateKey privKey = SOSKeyGenerator.getPrivateKeyFromFile(privateKeyFileName);
            PublicKey pubKey   = SOSKeyGenerator.getPublicKeyFromFile(publicKeyFileName);
           
           
            SOSCertificate.setHashAlgorithm(SOSCertificate.SHA1);
            //SOSCertificate.setHashAlgorithm(SOSCertificate.MD2);
            //SOSCertificate.setHashAlgorithm(SOSCertificate.MD5);
View Full Code Here

TOP

Related Classes of java.security.PublicKey

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.