keyStore.load(new ByteArrayInputStream(keyStoreSource.getKeyStoreBytes()), toCharArray(password)); } catch (CertificateException e) { LogRecord lr = new LogRecord(Level.WARNING, "Credentials ID {0}: Could not load keystore from {1}"); lr.setParameters(new Object[]{getId(), keyStoreSource}); lr.setThrown(e); LOGGER.log(lr); } catch (NoSuchAlgorithmException e) { LogRecord lr = new LogRecord(Level.WARNING, "Credentials ID {0}: Could not load keystore from {1}"); lr.setParameters(new Object[]{getId(), keyStoreSource}); lr.setThrown(e); LOGGER.log(lr); } catch (IOException e) { LogRecord lr = new LogRecord(Level.WARNING, "Credentials ID {0}: Could not load keystore from {1}"); lr.setParameters(new Object[]{getId(), keyStoreSource}); lr.setThrown(e); LOGGER.log(lr);
public StandardCertificateCredentials snapshot(StandardCertificateCredentials credentials) { if (credentials instanceof CertificateCredentialsImpl) { final KeyStoreSource keyStoreSource = ((CertificateCredentialsImpl) credentials).getKeyStoreSource(); if (keyStoreSource.isSnapshotSource()) { return credentials; return new CertificateCredentialsImpl(credentials.getScope(), credentials.getId(), credentials.getDescription(), credentials.getPassword().getEncryptedValue(), new UploadedKeyStoreSource(SecretBytes.fromBytes(keyStoreSource.getKeyStoreBytes()))); Arrays.fill(password, (char) 0); return new CertificateCredentialsImpl(credentials.getScope(), credentials.getId(), credentials.getDescription(), credentials.getPassword().getEncryptedValue(), new UploadedKeyStoreSource(SecretBytes.fromBytes(bos.toByteArray())));
@Override public StandardCertificateCredentials toCredentials(String description) { return new CertificateCredentialsImpl(CredentialsScope.GLOBAL, null, description, Scrambler.descramble(Secret.toString(password)), new CertificateCredentialsImpl.UploadedKeyStoreSource(certificate.getEncryptedValue())); }
public StandardCertificateCredentials snapshot(StandardCertificateCredentials credentials) { if (credentials instanceof CertificateCredentialsImpl) { final KeyStoreSource keyStoreSource = ((CertificateCredentialsImpl) credentials).getKeyStoreSource(); if (keyStoreSource.isSnapshotSource()) { return credentials; return new CertificateCredentialsImpl(credentials.getScope(), credentials.getId(), credentials.getDescription(), credentials.getPassword().getEncryptedValue(), new UploadedKeyStoreSource(SecretBytes.fromBytes(keyStoreSource.getKeyStoreBytes()))); Arrays.fill(password, (char) 0); return new CertificateCredentialsImpl(credentials.getScope(), credentials.getId(), credentials.getDescription(), credentials.getPassword().getEncryptedValue(), new UploadedKeyStoreSource(SecretBytes.fromBytes(bos.toByteArray())));
keyStore.load(new ByteArrayInputStream(keyStoreSource.getKeyStoreBytes()), toCharArray(password)); } catch (CertificateException e) { LogRecord lr = new LogRecord(Level.WARNING, "Credentials ID {0}: Could not load keystore from {1}"); lr.setParameters(new Object[]{getId(), keyStoreSource}); lr.setThrown(e); LOGGER.log(lr); } catch (NoSuchAlgorithmException e) { LogRecord lr = new LogRecord(Level.WARNING, "Credentials ID {0}: Could not load keystore from {1}"); lr.setParameters(new Object[]{getId(), keyStoreSource}); lr.setThrown(e); LOGGER.log(lr); } catch (IOException e) { LogRecord lr = new LogRecord(Level.WARNING, "Credentials ID {0}: Could not load keystore from {1}"); lr.setParameters(new Object[]{getId(), keyStoreSource}); lr.setThrown(e); LOGGER.log(lr);