Examples of KeyPair


Examples of java.security.KeyPair

  initCrypto()
 
    throws IOException
  {
    try{
          KeyPair key_pair = generateDHKeyPair( transport, outbound );
           
          key_agreement = KeyAgreement.getInstance("DH");
         
          key_agreement.init(key_pair.getPrivate());
        
          DHPublicKey  dh_public_key = (DHPublicKey)key_pair.getPublic();
         
          BigInteger  dh_y = dh_public_key.getY();
         
          dh_public_key_bytes = bigIntegerToBytes( dh_y, DH_SIZE_BYTES );
         
View Full Code Here

Examples of java.security.KeyPair

        }
       
        last_dh_incoming_key_generate = now;
      }
     
      KeyPair  res = dh_key_generator.generateKeyPair();
     
      return( res );
    }
  }
View Full Code Here

Examples of java.security.KeyPair

    try{
      synchronized( this ){
       
        if ( use_method_public_key == null || use_method_private_key == null ){
         
          KeyPair  keys = CryptoECCUtils.createKeys();
         
          use_method_public_key  = keys.getPublic();
         
          use_method_private_key  = keys.getPrivate();
         
          last_unlock_time = SystemTime.getCurrentTime();
         
          COConfigurationManager.setParameter( CONFIG_PREFIX + "publickey", CryptoECCUtils.keyToRawdata( use_method_public_key ));
         
View Full Code Here

Examples of java.security.KeyPair

    add_time      = SystemTime.getCurrentTime();
   
    is_subscribed    = true;

    try{
      KeyPair  kp = CryptoECCUtils.createKeys();
       
      public_key       = CryptoECCUtils.keyToRawdata( kp.getPublic());
      private_key     = CryptoECCUtils.keyToRawdata( kp.getPrivate());
           
     
      fixed_random  = new Random().nextInt();
     
      init();
View Full Code Here

Examples of java.security.KeyPair

     
      byte[]  encoded_subs = Base64.encode( bytes );
     
        // use a transient key-pair as we won't have the private key in general
     
      KeyPair  kp = CryptoECCUtils.createKeys();
     
      byte[] public_key     = CryptoECCUtils.keyToRawdata( kp.getPublic());
      byte[] private_key     = CryptoECCUtils.keyToRawdata( kp.getPrivate());
 
      PlatformSubscriptionsMessenger.updateSubscription(
          true,
          subs.getName(),
          public_key,
View Full Code Here

Examples of java.security.KeyPair

    public void testGenerateKeyPairSha1Default()
    {
        DHParameterSpec parameterSpec = DiffieHellmanSession.getDefaultParameter();

        KeyPair keyPair = DiffieHellmanSession.generateKeyPair(parameterSpec);

        assertNotNull(keyPair);
    }
View Full Code Here

Examples of java.security.KeyPair

    public void testGenerateKeyPairSha1Random()
    {
        DHParameterSpec parameterSpec = DiffieHellmanSession.generateRandomParameter(512, 256);

        KeyPair keyPair = DiffieHellmanSession.generateKeyPair(parameterSpec);

        assertNotNull(keyPair);
    }
View Full Code Here

Examples of java.security.KeyPair

    public void testGenerateKeyPairSha256Random()
    {
        DHParameterSpec parameterSpec = DiffieHellmanSession.generateRandomParameter(512, 256);

        KeyPair keyPair = DiffieHellmanSession.generateKeyPair(parameterSpec);

        assertNotNull(keyPair);
    }
View Full Code Here

Examples of java.security.KeyPair

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

    } catch (Exception e) {
View Full Code Here

Examples of java.security.KeyPair

            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
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.