Package java.security

Examples of java.security.PublicKey


      }
      return true;
    }

    // Get public key
    PublicKey publickey = getPublicKey();

    return validate(publickey, identity);
  }
View Full Code Here


      KeyPairGenerator keyGen = KeyPairGenerator.getInstance(ALGORITHM);
      keyGen.initialize(DH_SPEC);
      KeyPair keypair = keyGen.generateKeyPair();

      privateKey = keypair.getPrivate();
      PublicKey publicKey = keypair.getPublic();

      return publicKey.getEncoded();
    } catch (NoSuchAlgorithmException e) {
      throw new CryptoException(e);
    } catch (InvalidAlgorithmParameterException e) {
      throw new CryptoException(e);
    }
View Full Code Here

    }
    try {
      X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(
          peerPublicKeyBytes);
      KeyFactory keyFact = KeyFactory.getInstance(ALGORITHM);
      PublicKey publicKey = keyFact.generatePublic(x509KeySpec);

      KeyAgreement ka = KeyAgreement.getInstance(ALGORITHM);
      ka.init(privateKey);
      ka.doPhase(publicKey, true);
      byte[] secret = ka.generateSecret();
View Full Code Here

    try{     
          BigInteger  other_dh_y = bytesToBigInteger( buffer, 0, DH_SIZE_BYTES );
         
          KeyFactory dh_key_factory = KeyFactory.getInstance("DH");
               
        PublicKey other_public_key = dh_key_factory.generatePublic( new DHPublicKeySpec( other_dh_y, DH_P_BI, DH_G_BI ));
             
        key_agreement.doPhase( other_public_key, true );
       
        secret_bytes = key_agreement.generateSecret();
         
View Full Code Here

    byte[]    data,
    byte[]    signature )
 
    throws CryptoManagerException
  {
    PublicKey  pub = CryptoECCUtils.rawdataToPubkey( public_key );
   
    Signature sig = CryptoECCUtils.getSignature( pub );
   
    try{
      sig.update( data );
View Full Code Here

    * @throws KeyResolverException
    */

   public PublicKey getPublicKey() throws KeyResolverException {

      PublicKey pk = this.getPublicKeyFromInternalResolvers();

      if (pk != null) {
         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I could find a key using the per-KeyInfo key resolvers");

         return pk;
View Full Code Here

                  // if we do not have storage resolvers, we verify with null
                  StorageResolver storage = null;

                  if (keyResolver.canResolve((Element) currentChild,
                                             this.getBaseURI(), storage)) {
                     PublicKey pk =
                        keyResolver.resolvePublicKey((Element) currentChild,
                                                     this.getBaseURI(),
                                                     storage);

                     if (pk != null) {
                        return pk;
                     }
                  }
               } else {
                  for (int k = 0; k < this._storageResolvers.size(); k++) {
                     StorageResolver storage =
                        (StorageResolver) this._storageResolvers.get(k);

                     if (keyResolver.canResolve((Element) currentChild,
                                                this.getBaseURI(), storage)) {
                        PublicKey pk =
                           keyResolver.resolvePublicKey((Element) currentChild,
                                                        this.getBaseURI(),
                                                        storage);

                        if (pk != null) {
View Full Code Here

                  StorageResolver storage = null;

                  if (keyResolver.engineCanResolve((Element) currentChild,
                                                   this.getBaseURI(),
                                                   storage)) {
                     PublicKey pk =
                        keyResolver
                           .engineResolvePublicKey((Element) currentChild, this
                              .getBaseURI(), storage);

                     if (pk != null) {
                        return pk;
                     }
                  }
               } else {
                  for (int k = 0; k < this._storageResolvers.size(); k++) {
                     StorageResolver storage =
                        (StorageResolver) this._storageResolvers.get(k);

                     if (keyResolver.engineCanResolve((Element) currentChild,
                                                      this.getBaseURI(),
                                                      storage)) {
                        PublicKey pk = keyResolver
                           .engineResolvePublicKey((Element) currentChild, this
                              .getBaseURI(), storage);

                        if (pk != null) {
                           return pk;
View Full Code Here

         os.println("KeyName(" + i + ")=\"" + x.getKeyName() + "\"");
      }

      for (int i = 0; i < ki.lengthKeyValue(); i++) {
         KeyValue x = ki.itemKeyValue(i);
         PublicKey pk = x.getPublicKey();

         os.println("KeyValue Nr. " + i);
         os.println(pk);
      }
View Full Code Here

      }

      try {
         DSAKeyValue dsaKeyValue = new DSAKeyValue(this._dsaKeyElement,
                                                   BaseURI);
         PublicKey pk = dsaKeyValue.getPublicKey();

         return pk;
      } catch (XMLSecurityException ex) {
    //do nothing
      }
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.