protected static synchronized KeyPair generateKeyPair( String algorithm, int keySize ) throws GeneralSecurityException
    {
        final KeyPairGenerator generator;
        generator = KeyPairGenerator.getInstance( algorithm, PROVIDER );
        generator.initialize( keySize, new SecureRandom() );
        return generator.generateKeyPair();
    }
Returns a new public &amp; private key with the specified algorithm (e.g. DSA, RSA, etc.).

@param algorithm DSA, RSA, etc.
@param keySize the desired key size. This is an algorithm-specific metric, such as modulus length, specified in number of bits.
@return a new public &amp; private key with the specified algorithm (e.g. DSA, RSA, etc.).
@throws GeneralSecurityException if the supplied algorithm does not have a key-pair generator
xmppserver/src/main/java/org/jivesoftware/openfire/keystore/IdentityStore.java