Package com.googlecode.gwt.crypto.bouncycastle

Examples of com.googlecode.gwt.crypto.bouncycastle.AsymmetricCipherKeyPair


*/
public class KeysTest {

    @Test
    public void testGenerateAndSerialize() throws Exception {
        AsymmetricCipherKeyPair kp1 = RSA.makeKeypairSlow(RSA.Strength.FOUR);

        String test = "this is a test 12345 \n \n !!! 123";
        byte[] encrypted = RSA.encrypt((RSAKeyParameters) kp1.getPublic(), test);

        String decrypted = RSA.decrypt((RSAPrivateCrtKeyParameters) kp1.getPrivate(), encrypted);
        assertEquals(test, decrypted);

        String serialized = RSA.serialize((RSAPrivateCrtKeyParameters) kp1.getPrivate());
        RSAPrivateCrtKeyParameters priv2 = RSA.deserialize(serialized);

        String decrypted2 = RSA.decrypt(priv2, encrypted);
        assertEquals(test, decrypted2);
    }
View Full Code Here


                p, q, dP, dQ, qInv);
        RSAKeyParameters pub = new RSAKeyParameters(false, new BigInteger(modulus), new BigInteger(publicExponent));

        // TODO handle error from forge

        AsymmetricCipherKeyPair keyPair = new AsymmetricCipherKeyPair(pub, priv);
        callback.onSuccess(keyPair);
    }
View Full Code Here

TOP

Related Classes of com.googlecode.gwt.crypto.bouncycastle.AsymmetricCipherKeyPair

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.