Examples of PasswordFinder


Examples of org.bouncycastle.openssl.PasswordFinder

        if (certificate != null) {
            Log.warn("Certificate already exists for alias: " + alias);
            return false;
        }
        // Retrieve the private key of the stored certificate
        PasswordFinder passwordFinder = new PasswordFinder() {
            public char[] getPassword() {
                return passPhrase != null ? passPhrase.toCharArray() : new char[] {};
            }
        };
        PEMReader pemReader = new PEMReader(new InputStreamReader(pkInputStream), passwordFinder);
View Full Code Here

Examples of org.bouncycastle.openssl.PasswordFinder

            //  in order to break the link between SshClient and BouncyCastle
            try {
                if (SecurityUtils.isBouncyCastleRegistered()) {
                    class KeyPairProviderLoader implements Callable<KeyPairProvider> {
                        public KeyPairProvider call() throws Exception {
                            return new FileKeyPairProvider(files.toArray(new String[files.size()]), new PasswordFinder() {
                                public char[] getPassword() {
                                    try {
                                        System.out.println("Enter password for private key: ");
                                        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
                                        String password = r.readLine();
View Full Code Here

Examples of org.bouncycastle.openssl.PasswordFinder

            //  in order to break the link between SshClient and BouncyCastle
            try {
                if (SecurityUtils.isBouncyCastleRegistered()) {
                    class KeyPairProviderLoader implements Callable<KeyPairProvider> {
                        public KeyPairProvider call() throws Exception {
                            return new FileKeyPairProvider(files.toArray(new String[files.size()]), new PasswordFinder() {
                                public char[] getPassword() {
                                    try {
                                        System.out.println("Enter password for private key: ");
                                        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
                                        String password = r.readLine();
View Full Code Here

Examples of org.bouncycastle.openssl.PasswordFinder

            .append(" ]").toString();
    }

    private Object readPemObject(String pemFile, String keyPassword, @SuppressWarnings("rawtypes") Class... expectedInterfaces)
    {
        final PasswordFinder passwordFinder;
        if (keyPassword != null)
        {
            passwordFinder = getPasswordFinderFor(keyPassword);
        }
        else
View Full Code Here

Examples of org.bouncycastle.openssl.PasswordFinder

        return false;
    }

    private PasswordFinder getPasswordFinderFor(final String keyPassword)
    {
        PasswordFinder passwordFinder = new PasswordFinder()
        {
            @Override
            public char[] getPassword()
            {
                return keyPassword.toCharArray();
View Full Code Here

Examples of org.bouncycastle.openssl.PasswordFinder

    public void performTest()
        throws Exception
    {
        Reader          fRd =new BufferedReader(new InputStreamReader(this.getClass().getResourceAsStream("test.pem")));
        PasswordFinder  pGet = new Password("secret".toCharArray());
        PEMReader       pemRd = new PEMReader(fRd, pGet);
        Object          o;
        KeyPair         pair;

        while ((o = pemRd.readObject()) != null)
View Full Code Here

Examples of org.bouncycastle.openssl.PasswordFinder

    }

    public void performTest()
        throws Exception
    {
        PasswordFinder  pGet = new Password("secret".toCharArray());
        PEMReader       pemRd = openPEMResource("test.pem", pGet);
        Object          o;
        KeyPair         pair;

        while ((o = pemRd.readObject()) != null)
View Full Code Here

Examples of org.bouncycastle.openssl.PasswordFinder

            try {
                final PEMReader pemReader;
                if (pemPassword == null) {
                    pemReader = new PEMReader(pemFileReader);
                } else {
                    final PasswordFinder passwordFinder = new CRXPasswordFinder(pemPassword);
                    pemReader = new PEMReader(pemFileReader, passwordFinder);
                }
                try {
                    return (KeyPair)pemReader.readObject();
                } finally {
View Full Code Here

Examples of org.bouncycastle.openssl.PasswordFinder

            try {
                final PEMReader pemReader;
                if (pemPassword == null) {
                    pemReader = new PEMReader(pemFileReader);
                } else {
                    final PasswordFinder passwordFinder = new CRXPasswordFinder(pemPassword);
                    pemReader = new PEMReader(pemFileReader, passwordFinder);
                }
                try {
                    final Object pemObject = pemReader.readObject();
                    if (pemObject instanceof KeyPair) {
View Full Code Here

Examples of org.bouncycastle.openssl.PasswordFinder

            .append(" ]").toString();
    }

    private Object readPemObject(String pemFile, String keyPassword, @SuppressWarnings("rawtypes") Class... expectedInterfaces)
    {
        final PasswordFinder passwordFinder;
        if (keyPassword != null)
        {
            passwordFinder = getPasswordFinderFor(keyPassword);
        }
        else
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.