Examples of ElGamalPrivateKey


Examples of org.bouncycastle.jce.interfaces.ElGamalPrivateKey

      // generate the keys
      try {
        KeyPair pair = Util.generateKeys();
        ElGamalPublicKey publicKey = (ElGamalPublicKey) pair
            .getPublic();
        ElGamalPrivateKey privateKey = (ElGamalPrivateKey) pair
            .getPrivate();
        addUser(userId, publicKey, privateKey);
        return privateKey;
      } catch (NoSuchAlgorithmException e) {
        e.printStackTrace();
View Full Code Here

Examples of org.bouncycastle.jce.interfaces.ElGamalPrivateKey

      // generate the keys
      try {
        KeyPair pair = Util.generateKeys();
        ElGamalPublicKey publicKey = (ElGamalPublicKey) pair
            .getPublic();
        ElGamalPrivateKey privateKey = (ElGamalPrivateKey) pair
            .getPrivate();
        addUser(userId, publicKey, privateKey);
        return publicKey;
      } catch (NoSuchAlgorithmException e) {
        e.printStackTrace();
View Full Code Here

Examples of org.bouncycastle2.jce.interfaces.ElGamalPrivateKey

        PrivateKey    key)
        throws InvalidKeyException
    {
        if (key instanceof ElGamalPrivateKey)
        {
            ElGamalPrivateKey    k = (ElGamalPrivateKey)key;

            return new ElGamalPrivateKeyParameters(k.getX(),
                new ElGamalParameters(k.getParameters().getP(), k.getParameters().getG()));
        }
        else if (key instanceof DHPrivateKey)
        {
            DHPrivateKey    k = (DHPrivateKey)key;

            return new ElGamalPrivateKeyParameters(k.getX(),
                new ElGamalParameters(k.getParams().getP(), k.getParams().getG()));
        }
                       
        throw new InvalidKeyException("can't identify private key for El Gamal.");
    }
View Full Code Here

Examples of org.bouncycastle2.jce.interfaces.ElGamalPrivateKey

           
            secKey = new DSASecretBCPGKey(dsK.getX());
            break;
        case PGPPublicKey.ELGAMAL_ENCRYPT:
        case PGPPublicKey.ELGAMAL_GENERAL:
            ElGamalPrivateKey   esK = (ElGamalPrivateKey)privKey.getKey();
           
            secKey = new ElGamalSecretBCPGKey(esK.getX());
            break;
        default:
            throw new PGPException("unknown key class");
        }
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.