*
Returns the WSKeyStore object given the keyStoreName.

@param keyStoreName
@return WSKeyStore
*
359234
public WSKeyStore getKeyStore(String keyStoreName) {
        WSKeyStore ks = keyStoreMap.get(keyStoreName);

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            if (ks != null) {
                Tr.debug(tc, "Returning a keyStore for name: " + keyStoreName);
            } else {
                Tr.debug(tc, "Cannot find a keyStore for name: " + keyStoreName);
            }
        }

        return ks;
    }
477529
private Path keyStoreFile()
  {
    String fileName = _config.get(_prefix + ".ssl.key-store");
    
    if (fileName == null) {
      return null;
    }
    
    return Vfs.path(fileName);
  }
765399
public static KeyStore loadKeyStore(File file, String password) throws KSIException {
        notNull(file, "Trust store file");
        FileInputStream input = null;
        KeyStore keyStore = null;
        try {
            keyStore = KeyStore.getInstance("JKS");
            char[] passwordCharArray = password == null ? null : password.toCharArray();
            input = new FileInputStream(file);
            keyStore.load(input, passwordCharArray);
        } catch (GeneralSecurityException | IOException e) {
            throw new KSIException("Loading java key store with path " + file + " failed", e);
        } finally {
            closeQuietly(input);
        }
        return keyStore;
    }
1012822
Map<String, WSKeyStore> getKeyStores() {
        Map<String, WSKeyStore> ret = new HashMap<String, WSKeyStore>(keystoreIdMap);
        ret.putAll(keystorePidMap);
        return ret;
    }
59650
public final String encodeKeyStore(KeyStore keyStore, char[] password) {
        logger.entry();
        try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
            keyStore.store(out, password);
            out.flush();
            byte[] bytes = out.toByteArray();
            String encodedKeyStore = Base64Utils.encode(bytes);
            logger.exit();
            return encodedKeyStore;
        } catch (IOException | KeyStoreException | NoSuchAlgorithmException | CertificateException e) {
            RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to encode a keystore.", e);
            logger.error(exception.toString());
            throw exception;
        }
    }
1060977
public static InputStream openKeyStore(String fileName) throws MalformedURLException, IOException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "openKeyStore: " + fileName);

        URL urlFile = null;

        // Check if the filename exists as a File.
        File kfile = new File(fileName);

        if (kfile.exists() && kfile.length() == 0) {
            throw new IOException("Keystore file exists, but is empty: " + fileName);
        } else if (!kfile.exists()) {
            urlFile = new URL(fileName);
        } else {
            // kfile exists
            urlFile = new URL("file:" + kfile.getCanonicalPath());
        }

        // Finally open the file.
        InputStream fis = urlFile.openStream();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "openKeyStore: " + (null != fis));
        return fis;
    }
988312
@Override public SpanStore spanStore() {
    if (spanStore == null) {
      synchronized (this) {
        if (spanStore == null) {
          spanStore = new CassandraSpanStore(this);
        }
      }
    }
    return spanStore;
  }
117704
public OvhSshKey sshKey_keyName_GET(String keyName) throws IOException {
		String qPath = "/me/sshKey/{keyName}";
		StringBuilder sb = path(qPath, keyName);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhSshKey.class);
	}
364463
public StoreSchema getStore(final String name) {
    for (StoreSchema store : storeSchemas)
      if (store.getName().equals(name))
        return store;
    return null;
  }
1168961
public String[] getKeyStoreAliases() {
        Set<String> set = keyStoreMap.keySet();
        return set.toArray(new String[set.size()]);
    }
351627
@RequestMapping(value = "/cert/{hostname:.+}", method = {RequestMethod.GET, RequestMethod.HEAD})
    public
    @ResponseBody
    void getCert(Locale locale, Model model, HttpServletResponse response, @PathVariable String hostname) throws Exception {
        // Set the appropriate headers so the browser thinks this is a file
        response.reset();
        response.setContentType("application/x-x509-ca-cert");
        response.setHeader("Content-Disposition", "attachment;filename=" + hostname + ".cer");

        // special handling for hostname=="root"
        // return the CyberVillians Root Cert in this case
        if (hostname.equals("root")) {
            hostname = "cybervillainsCA";
            response.setContentType("application/pkix-cert ");
        }

        // get the cert for the hostname
        KeyStoreManager keyStoreManager = com.groupon.odo.bmp.Utils.getKeyStoreManager(hostname);

        if (hostname.equals("cybervillainsCA")) {
            // get the cybervillians cert from resources
            File root = new File("seleniumSslSupport" + File.separator + hostname);

            // return the root cert
            Files.copy(new File(root.getAbsolutePath() + File.separator + hostname + ".cer").toPath(), response.getOutputStream());
            response.flushBuffer();
        } else {
            // return the cert for the appropriate alias
            response.getOutputStream().write(keyStoreManager.getCertificateByAlias(hostname).getEncoded());
            response.flushBuffer();
        }


    }
1189627
public PrivateKey get(KeyStoreChooser keyStoreChooser, PrivateKeyChooserByAlias privateKeyChooserByAlias) {
        CacheKey cacheKey = new CacheKey(keyStoreChooser.getKeyStoreName(), privateKeyChooserByAlias.getAlias());
        PrivateKey retrievedPrivateKey = cache.get(cacheKey);

        if (retrievedPrivateKey != null) {
            return retrievedPrivateKey;
        }

        KeyStore keyStore = keyStoreRegistry.get(keyStoreChooser);

        if (keyStore != null) {
            PrivateKeyFactoryBean factory = new PrivateKeyFactoryBean();
            factory.setKeystore(keyStore);
            factory.setAlias(privateKeyChooserByAlias.getAlias());
            factory.setPassword(privateKeyChooserByAlias.getPassword());
            try {
                factory.afterPropertiesSet();
                PrivateKey privateKey = (PrivateKey) factory.getObject();

                if (privateKey != null) {
                    cache.put(cacheKey, privateKey);
                }
                return privateKey;
            } catch (Exception e) {
                throw new PrivateKeyException("error initializing private key factory bean", e);
            }
        }

        return null;
    }
1086360
private RSAPublicKey getKeyForUser(String userName) throws KeyNotFoundException {
    RSAPublicKey key = null;
    for (final KeyProvider keyProvider : keyProviders) {
      try {
        key = keyProvider.getKey(userName);
        break;
      } catch (KeyNotFoundException e) {
        // that's fine, try the next provider
      }
    }

    if (key == null) {
      throw new KeyNotFoundException();
    }

    return key;
  }
1241270
public Entity get(String keyName) {
    Datastore datastore = transaction.getDatastore();
    // [START get]
    Key key = datastore.newKeyFactory().setKind("MyKind").newKey(keyName);
    Entity entity = transaction.get(key);
    transaction.commit();
    // Do something with the entity
    // [END get]
    return entity;
  }
297142
public static KeyStore loadKeyStore(String keystoreType, @Nullable String keystorePassword, InputStream is)
            throws KeyStoreException {
        try {
            KeyStore keystore = KeyStore.getInstance(keystoreType);
            keystore.load(is, keystorePassword != null ? keystorePassword.toCharArray() : null);
            return keystore;
        } catch (IOException x) {
            throw new KeyStoreException(x);
        } catch (GeneralSecurityException x) {
            throw new KeyStoreException(x);
        } finally {
            try {
                is.close();
            } catch (IOException x) {
                // Ignored.
            }
        }
    }
1368889
public FKeyModel getFkey(String fkeyName) {
		if (fkeyConstraints == null)
			return null;
		for (FKeyModel fkey : fkeyConstraints)
			if (!StrUtils.isEmpty(fkeyName) && fkeyName.equalsIgnoreCase(fkey.getFkeyName()))
				return fkey;
		return null;
	}
24910
public void clearKeyStoreFromMap(String keyStoreName) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "clearKeyStoreFromMap: " + keyStoreName);
        synchronized (keyStoreMap) {
            keyStoreMap.remove(keyStoreName);
        }
    }