Package org.bouncycastle.jcajce.provider.asymmetric.ec

Examples of org.bouncycastle.jcajce.provider.asymmetric.ec.IESCipher$ECIES


    {
        byte[] derivation = Hex.decode("202122232425262728292a2b2c2d2e2f");
        byte[] encoding   = Hex.decode("303132333435363738393a3b3c3d3e3f");
       
       
        IESCipher c1 = new org.bouncycastle.jcajce.provider.asymmetric.ec.IESCipher.ECIES();
        IESCipher c2 = new org.bouncycastle.jcajce.provider.asymmetric.ec.IESCipher.ECIES();
        IESParameterSpec params = new IESParameterSpec(derivation,encoding,128);

        // Testing ECIES with default curve in streaming mode
        KeyPairGenerator    g = KeyPairGenerator.getInstance("EC", "BC");
        doTest("ECIES with default", g, "ECIES", params);
       
        // Testing ECIES with 192-bit curve in streaming mode
        g.initialize(192, new SecureRandom());
        doTest("ECIES with 192-bit", g, "ECIES", params);

        // Testing ECIES with 256-bit curve in streaming mode
        g.initialize(256, new SecureRandom());
        doTest("ECIES with 256-bit", g, "ECIES", params);

       
        c1 = new IESCipher(new IESEngine(new ECDHBasicAgreement(),
                new KDF2BytesGenerator(new SHA1Digest()),
                new HMac(new SHA1Digest()),
                new PaddedBufferedBlockCipher(new DESEngine())));
       
        c2 = new IESCipher(new IESEngine(new ECDHBasicAgreement(),
                new KDF2BytesGenerator(new SHA1Digest()),
                new HMac(new SHA1Digest()),
                new PaddedBufferedBlockCipher(new DESEngine())))
   
        params = new IESParameterSpec(derivation, encoding, 128, 128);
View Full Code Here


    }

    private static byte[] _cryptIES(byte[] input, Key recipient,
            boolean forEncryption) throws InvalidKeyException,
            IllegalBlockSizeException, BadPaddingException {
        IESCipher cipher = new IESCipher(new IESEngine(
                new ECDHBasicAgreement(), new KDF2BytesGenerator(
                        new SHA1Digest()), new HMac(new SHA256Digest()),
                new PaddedBufferedBlockCipher(new CBCBlockCipher(
                        new AESEngine()))));

        cipher.engineInit(forEncryption ? Cipher.ENCRYPT_MODE
                : Cipher.DECRYPT_MODE, recipient, new SecureRandom());
        return cipher.engineDoFinal(input, 0, input.length);
    }
View Full Code Here

TOP

Related Classes of org.bouncycastle.jcajce.provider.asymmetric.ec.IESCipher$ECIES

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.