Package org.bouncycastle.crypto.engines

Examples of org.bouncycastle.crypto.engines.RSAEngine


    static public class NoPadding
        extends JCERSACipher
    {
        public NoPadding()
        {
            super(new RSAEngine());
        }
View Full Code Here


    static public class SHA1withRSA
        extends JDKPSSSigner
    {
        public SHA1withRSA()
        {
            super("SHA1withRSA/PSS", new RSAEngine(), new SHA1Digest());
        }
View Full Code Here

    static public class SHA256withRSA
        extends JDKPSSSigner
    {
        public SHA256withRSA()
        {
            super("SHA256withRSA/PSS", new RSAEngine(), new SHA256Digest());
        }
View Full Code Here

    static public class SHA384withRSA
        extends JDKPSSSigner
    {
        public SHA384withRSA()
        {
            super("SHA384withRSA/PSS", new RSAEngine(), new SHA384Digest());
        }
View Full Code Here

    static public class SHA512withRSA
        extends JDKPSSSigner
    {
        public SHA512withRSA()
        {
            super("SHA512withRSA/PSS", new RSAEngine(), new SHA512Digest());
        }
View Full Code Here

    static public class SHA1WithRSAEncryption
        extends JDKISOSignature
    {
        public SHA1WithRSAEncryption()
        {
            super("SHA1withRSA/ISO9796-2", new SHA1Digest(), new RSAEngine());
        }
View Full Code Here

    static public class MD5WithRSAEncryption
        extends JDKISOSignature
    {
        public MD5WithRSAEncryption()
        {
            super("MD5withRSA/ISO9796-2", new MD5Digest(), new RSAEngine());
        }
View Full Code Here

    static public class RIPEMD160WithRSAEncryption
        extends JDKISOSignature
    {
        public RIPEMD160WithRSAEncryption()
        {
            super("RIPEMD160withRSA/ISO9796-2", new RIPEMD160Digest(), new RSAEngine());
        }
View Full Code Here

    // some data where first entry is 0
    byte[] data = { 10, 122, 12, 127, 35, 58, 87, 56, -6, 73, 10, -13, -78, 4, -122, -61 };

    // encrypt data asymmetrically
    AsymmetricBlockCipher cipher = new RSAEngine();
    cipher = new PKCS1Encoding(cipher);
    cipher.init(true, keyPair.getPublic());
    byte[] rsaEncryptedData = cipher.processBlock(data, 0, data.length);

    Assert.assertFalse(Arrays.equals(data, rsaEncryptedData));

    // decrypt data asymmetrically
    cipher.init(false, keyPair.getPrivate());
    byte[] dataBack = cipher.processBlock(rsaEncryptedData, 0, rsaEncryptedData.length);

    assertTrue(Arrays.equals(data, dataBack));

    long stopTime = System.currentTimeMillis();
    long elapsedTime = stopTime - startTime;
View Full Code Here

    BigInteger intModulus = new BigInteger(modulus);
    BigInteger intExponent = new BigInteger(exponent);
    RSAKeyParameters RSApubKey = new RSAKeyParameters(false, intModulus, intExponent);
    byte[] toEncrypt = input.getBytes();
    cipher = new PKCS1Encoding(new RSAEngine());
    cipher.init(true, RSApubKey);
    byte[] encByte = cipher.processBlock(toEncrypt, 0, toEncrypt.length);
    byte[] encValue = Hex.encode(encByte);
    encString = new String(encValue);
View Full Code Here

TOP

Related Classes of org.bouncycastle.crypto.engines.RSAEngine

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.