Examples of PKCS5S2ParametersGenerator


Examples of org.bouncycastle.crypto.generators.PKCS5S2ParametersGenerator

        super(context);
    }

    @Override
    protected PBEParametersGenerator createPBEParametersGenerator() {
        return new PKCS5S2ParametersGenerator();
    }
View Full Code Here

Examples of org.bouncycastle.crypto.generators.PKCS5S2ParametersGenerator

*/
final class PKCS5S2AesCipher extends AbstractAesCipher {

    @Override
    protected PBEParametersGenerator createPBEParametersGenerator() {
        return new PKCS5S2ParametersGenerator();
    }
View Full Code Here

Examples of org.bouncycastle.crypto.generators.PKCS5S2ParametersGenerator

        return androidPBKDF2(pwArray, salt, rounds, useUtf8);
    }

    public static SecretKey androidPBKDF2(char[] pwArray, byte[] salt,
            int rounds, boolean useUtf8) {
        PBEParametersGenerator generator = new PKCS5S2ParametersGenerator();
        // Android treats password bytes as ASCII, which is obviously
        // not the case when an AES key is used as a 'password'.
        // Use the same method for compatibility.

        // Android 4.4 however uses all char bytes
        // useUtf8 needs to be true for KitKat
        byte[] pwBytes = useUtf8 ? PBEParametersGenerator.PKCS5PasswordToUTF8Bytes(pwArray)
                : PBEParametersGenerator.PKCS5PasswordToBytes(pwArray);
        generator.init(pwBytes, salt, rounds);
        KeyParameter params = (KeyParameter) generator
                .generateDerivedParameters(PBKDF2_KEY_SIZE);

        return new SecretKeySpec(params.getKey(), "AES");
    }
View Full Code Here

Examples of org.bouncycastle2.crypto.generators.PKCS5S2ParametersGenerator

                    throw new IllegalStateException("PKCS5 scheme 1 only supports MD2, MD5 and SHA1.");
                }
            }
            else if (type == PKCS5S2)
            {
                generator = new PKCS5S2ParametersGenerator();
            }
            else if (type == PKCS12)
            {
                switch (hash)
                {
View Full Code Here

Examples of org.bouncycastle2.crypto.generators.PKCS5S2ParametersGenerator

                    throw new IllegalStateException("PKCS5 scheme 1 only supports only MD5 and SHA1.");
                }
            }
            else if (type == PKCS5S2)
            {
                generator = new PKCS5S2ParametersGenerator();
            }
            else if (type == OLD_PKCS12)
            {
                switch (hash)
                {
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.