| | |
| | | * |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin.client.cli; |
| | |
| | | else |
| | | if (trustStorePathArg.isPresent()) |
| | | { |
| | | FileInputStream fos = null; |
| | | |
| | | try |
| | | { |
| | | FileInputStream fos = |
| | | new FileInputStream(trustStorePathArg.getValue()); |
| | | fos = new FileInputStream(trustStorePathArg.getValue()); |
| | | String trustStorePasswordStringValue = null; |
| | | char[] trustStorePasswordValue = null; |
| | | if (trustStorePasswordArg.isPresent()) |
| | |
| | | |
| | | truststore = KeyStore.getInstance(KeyStore.getDefaultType()); |
| | | truststore.load(fos, trustStorePasswordValue); |
| | | fos.close(); |
| | | } |
| | | catch (KeyStoreException e) |
| | | { |
| | |
| | | // are in a best effort mode. |
| | | LOG.log(Level.WARNING, "Error with the truststore", e); |
| | | } |
| | | finally |
| | | { |
| | | if (fos != null) |
| | | { |
| | | try |
| | | { |
| | | fos.close(); |
| | | } |
| | | catch (Exception e) {} |
| | | } |
| | | } |
| | | } |
| | | trustManager = new ApplicationTrustManager(truststore); |
| | | } |
| | |
| | | char[] keyStorePasswordValue = null; |
| | | if (keyStorePathArg.isPresent()) |
| | | { |
| | | FileInputStream fos = null; |
| | | try |
| | | { |
| | | FileInputStream fos = new FileInputStream(keyStorePathArg.getValue()); |
| | | fos = new FileInputStream(keyStorePathArg.getValue()); |
| | | if (keyStorePasswordArg.isPresent()) |
| | | { |
| | | keyStorePasswordStringValue = keyStorePasswordArg.getValue(); |
| | |
| | | |
| | | keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); |
| | | keyStore.load(fos,keyStorePasswordValue); |
| | | fos.close(); |
| | | } |
| | | catch (KeyStoreException e) |
| | | { |
| | |
| | | // in a best effort mode. |
| | | LOG.log(Level.WARNING, "Error with the keystore", e); |
| | | } |
| | | finally |
| | | { |
| | | if (fos != null) |
| | | { |
| | | try { |
| | | fos.close(); |
| | | } |
| | | catch (Exception e) {} |
| | | } |
| | | } |
| | | |
| | | char[] password = null; |
| | | if (keyStorePasswordStringValue != null) |
| | | { |