Package org.teiid.core.crypto

Examples of org.teiid.core.crypto.DhKeyGenerator


  public void onConnection() throws CommunicationException {
        Handshake handshake = new Handshake();
       
        if (usingEncryption) {
            keyGen = new DhKeyGenerator();
            byte[] publicKey;
      try {
        publicKey = keyGen.createPublicKey();
      } catch (CryptoException e) {
        throw new CommunicationException(e);
View Full Code Here


            handshake.setVersion();
           
            byte[] serverPublicKey = handshake.getPublicKey();
           
            if (serverPublicKey != null) {
              DhKeyGenerator keyGen = new DhKeyGenerator();
              byte[] publicKey = keyGen.createPublicKey();
                this.cryptor = keyGen.getSymmetricCryptor(serverPublicKey);
                handshake.setPublicKey(publicKey);
            } else {
                this.cryptor = new NullCryptor();
            }
           
View Full Code Here


public class TestDhKeyGenerator extends TestCase {
 
  public void testKeyGenerationDefault() throws CryptoException {
    DhKeyGenerator keyGenServer = new DhKeyGenerator();
    DhKeyGenerator keyGenClient = new DhKeyGenerator();
    byte[] serverKey = keyGenServer.createPublicKey();
    byte[] clientKey = keyGenClient.createPublicKey();
    SymmetricCryptor serverCryptor = keyGenServer.getSymmetricCryptor(clientKey);
    SymmetricCryptor clientCryptor = keyGenClient.getSymmetricCryptor(serverKey);
   
    String cleartext = "cleartext!"; //$NON-NLS-1$
   
    String ciphertext = serverCryptor.encrypt(cleartext);
    String cleartext2 = clientCryptor.decrypt(ciphertext);
View Full Code Here

TOP

Related Classes of org.teiid.core.crypto.DhKeyGenerator

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.