Code example for KeyPair

0
 
            AsymmetricCipherKeyPair   pair = engine.generateKeyPair();
            DSAPublicKeyParameters     pub = (DSAPublicKeyParameters)pair.getPublic();
            DSAPrivateKeyParameters priv = (DSAPrivateKeyParameters)pair.getPrivate();
 
            return new KeyPair(new JDKDSAPublicKey(pub),
                               new JDKDSAPrivateKey(priv));
        } 
    } 
 
    // BEGIN android-removed 
    // public static class ElGamal 
    //     extends JDKKeyPairGenerator 
    // { 
    //     ElGamalKeyGenerationParameters  param; 
    //     ElGamalKeyPairGenerator         engine = new ElGamalKeyPairGenerator(); 
    //     int                             strength = 1024; 
    //     int                             certainty = 20; 
    //     SecureRandom                    random = new SecureRandom(); 
    //     boolean                         initialised = false; 
    //