Package com.googlecode.gwt.crypto.bouncycastle

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


     * @param raw
     * @return
     * @throws InvalidCipherTextException
     */
    public static byte[] encrypt(RSAKeyParameters publicKey, String raw) throws InvalidCipherTextException {
        AsymmetricBlockCipher eng = new PKCS1Encoding(new RSAEngine());
        eng.init(true, publicKey);

        byte[] input = raw.getBytes();

        return eng.processBlock(input, 0, input.length);
    }
View Full Code Here


        return eng.processBlock(input, 0, input.length);
    }

    public static String decrypt(RSAPrivateCrtKeyParameters privateKey, byte[] encrypted) throws InvalidCipherTextException {
        AsymmetricBlockCipher eng = new PKCS1Encoding(new RSAEngine());
        eng.init(false, privateKey);

        return new String(eng.processBlock(encrypted, 0, encrypted.length));
    }
View Full Code Here

TOP

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

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.