Examples of AESEngine


Examples of org.bouncycastle.crypto.engines.AESEngine

        return innerCreateAES(os, key, random);
    }
   
    /** For unit tests only */
    static AEADOutputStream innerCreateAES(OutputStream os, byte[] key, Random random) throws IOException {
        AESEngine mainCipher = new AESEngine();
        AESLightEngine hashCipher = new AESLightEngine();
        byte[] nonce = new byte[mainCipher.getBlockSize()];
        random.nextBytes(nonce);
        nonce[0] &= 0x7F;
        return new AEADOutputStream(os, key, nonce, hashCipher, mainCipher);
    }
View Full Code Here

Examples of org.bouncycastle.crypto.engines.AESEngine

    public void reset() throws IOException {
        throw new IOException("Mark/reset not supported");
    }
   
    public static AEADInputStream createAES(InputStream is, byte[] key) throws IOException {
        AESEngine mainCipher = new AESEngine();
        AESLightEngine hashCipher = new AESLightEngine();
        return new AEADInputStream(is, key, hashCipher, mainCipher);
    }
View Full Code Here

Examples of org.bouncycastle.crypto.engines.AESEngine

        public ECIESwithAES()
        {
            super(new IESEngine(new ECDHBasicAgreement(),
                new KDF2BytesGenerator(new SHA1Digest()),
                new HMac(new SHA1Digest()),
                new PaddedBufferedBlockCipher(new AESEngine())));
        }
View Full Code Here

Examples of org.bouncycastle.crypto.engines.AESEngine

    public static class RFC3211Wrap
        extends WrapCipherSpi
    {
        public RFC3211Wrap()
        {
            super(new RFC3211WrapEngine(new AESEngine()), 16);
        }
View Full Code Here

Examples of org.bouncycastle.crypto.engines.AESEngine

    public static class RFC3211Wrap
        extends WrapCipherSpi
    {
        public RFC3211Wrap()
        {
            super(new RFC3211WrapEngine(new AESEngine()), 16);
        }
View Full Code Here

Examples of org.bouncycastle.crypto.engines.AESEngine

        public IESwithAES()
        {
            super(new IESEngine(new DHBasicAgreement(),
                new KDF2BytesGenerator(new SHA1Digest()),
                new HMac(new SHA1Digest()),
                new PaddedBufferedBlockCipher(new AESEngine())));
        }
View Full Code Here

Examples of org.bouncycastle.crypto.engines.AESEngine

     * @param blockMode block mode name
     * @return instance to the block mode
     */
    public static AEADBlockCipher getNewCipher(Mode blockMode) {

        AESEngine aesEngine = new AESEngine();

        switch (blockMode) {

        case GCM:
            return new GCMBlockCipher(aesEngine);
View Full Code Here

Examples of org.bouncycastle.crypto.engines.AESEngine

        switch (encAlgorithm)
        {
        case SymmetricKeyAlgorithmTags.AES_128:
        case SymmetricKeyAlgorithmTags.AES_192:
        case SymmetricKeyAlgorithmTags.AES_256:
            engine = new AESEngine();
            break;
        case SymmetricKeyAlgorithmTags.BLOWFISH:
            engine = new BlowfishEngine();
            break;
        case SymmetricKeyAlgorithmTags.CAST5:
View Full Code Here

Examples of org.bouncycastle.crypto.engines.AESEngine

            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

Examples of org.bouncycastle.crypto.engines.AESEngine

    // h/t Steve Weis, Michael Rogers, and liberationtech
    private static byte[] _cryptBytesAES(byte[] input, byte[] key,
            boolean forEncryption) throws InvalidCipherTextException {
        assert key.length == 32; // 32 bytes == 256 bits
        return process(input, new PaddedBufferedBlockCipher(new CBCBlockCipher(
                new AESEngine())), new KeyParameter(key), forEncryption);
        // note: using zero IV because we generate a new key for every message
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.