/** * {@inheritDoc} */ @Override public String getDisplayName() { return Messages.CertificateCredentialsImpl_DisplayName(); }
/** * {@inheritDoc} */ @Override public String getDisplayName() { return Messages.CertificateCredentialsImpl_FileOnMasterKeyStoreSourceDisplayName(); }
return FormValidation.warning(Messages.CertificateCredentialsImpl_LoadKeystoreFailed()); int size = keyStore.size(); if (size == 0) { return FormValidation.warning(Messages.CertificateCredentialsImpl_EmptyKeystore()); if (passwordChars == null) { return FormValidation.warning( Messages.CertificateCredentialsImpl_LoadKeyFailedQueryEmptyPassword(alias)); } catch (UnrecoverableEntryException e) { return FormValidation.warning(e, Messages.CertificateCredentialsImpl_LoadKeyFailed(alias)); buf.toString())); } catch (KeyStoreException e) { return FormValidation.warning(e, Messages.CertificateCredentialsImpl_LoadKeystoreFailed()); } catch (CertificateException e) { return FormValidation.warning(e, Messages.CertificateCredentialsImpl_LoadKeystoreFailed()); } catch (NoSuchAlgorithmException e) { return FormValidation.warning(e, Messages.CertificateCredentialsImpl_LoadKeystoreFailed()); } catch (IOException e) { return FormValidation.warning(e, Messages.CertificateCredentialsImpl_LoadKeystoreFailed()); } finally { if (passwordChars != null) {
/** * Checks the keystore file path. * * @param value the file path. * @param password the password. * @return the {@link FormValidation} results. */ @SuppressWarnings("unused") // stapler form validation @Restricted(NoExternalUse.class) public FormValidation doCheckKeyStoreFile(@QueryParameter String value, @QueryParameter String password) { if (StringUtils.isBlank(value)) { return FormValidation.error(Messages.CertificateCredentialsImpl_KeyStoreFileUnspecified()); } File file = new File(value); if (file.isFile()) { try { return validateCertificateKeystore("PKCS12", FileUtils.readFileToByteArray(file), password); } catch (IOException e) { return FormValidation .error(Messages.CertificateCredentialsImpl_KeyStoreFileUnreadable(value), e); } } else { return FormValidation.error(Messages.CertificateCredentialsImpl_KeyStoreFileDoesNotExist(value)); } } }
/** * Checks the keystore content. * * @param value the keystore content. * @param password the password. * @return the {@link FormValidation} results. */ @SuppressWarnings("unused") // stapler form validation @Restricted(NoExternalUse.class) public FormValidation doCheckUploadedKeystore(@QueryParameter String value, @QueryParameter String password) { if (StringUtils.isBlank(value)) { return FormValidation.error(Messages.CertificateCredentialsImpl_NoCertificateUploaded()); } SecretBytes secretBytes = SecretBytes.fromString(value); byte[] keystoreBytes = secretBytes.getPlainData(); if (keystoreBytes == null || keystoreBytes.length == 0) { return FormValidation.error(Messages.CertificateCredentialsImpl_LoadKeystoreFailed()); } return validateCertificateKeystore("PKCS12", keystoreBytes, password); }
return FormValidation.warning(Messages.CertificateCredentialsImpl_LoadKeystoreFailed()); int size = keyStore.size(); if (size == 0) { return FormValidation.warning(Messages.CertificateCredentialsImpl_EmptyKeystore()); if (passwordChars == null) { return FormValidation.warning( Messages.CertificateCredentialsImpl_LoadKeyFailedQueryEmptyPassword(alias)); } catch (UnrecoverableEntryException e) { return FormValidation.warning(e, Messages.CertificateCredentialsImpl_LoadKeyFailed(alias)); buf.toString())); } catch (KeyStoreException e) { return FormValidation.warning(e, Messages.CertificateCredentialsImpl_LoadKeystoreFailed()); } catch (CertificateException e) { return FormValidation.warning(e, Messages.CertificateCredentialsImpl_LoadKeystoreFailed()); } catch (NoSuchAlgorithmException e) { return FormValidation.warning(e, Messages.CertificateCredentialsImpl_LoadKeystoreFailed()); } catch (IOException e) { return FormValidation.warning(e, Messages.CertificateCredentialsImpl_LoadKeystoreFailed()); } finally { if (passwordChars != null) {
/** * Checks the keystore file path. * * @param value the file path. * @param password the password. * @return the {@link FormValidation} results. */ @SuppressWarnings("unused") // stapler form validation @Restricted(NoExternalUse.class) public FormValidation doCheckKeyStoreFile(@QueryParameter String value, @QueryParameter String password) { if (StringUtils.isBlank(value)) { return FormValidation.error(Messages.CertificateCredentialsImpl_KeyStoreFileUnspecified()); } File file = new File(value); if (file.isFile()) { try { return validateCertificateKeystore("PKCS12", FileUtils.readFileToByteArray(file), password); } catch (IOException e) { return FormValidation .error(Messages.CertificateCredentialsImpl_KeyStoreFileUnreadable(value), e); } } else { return FormValidation.error(Messages.CertificateCredentialsImpl_KeyStoreFileDoesNotExist(value)); } } }
/** * Checks the keystore content. * * @param value the keystore content. * @param password the password. * @return the {@link FormValidation} results. */ @SuppressWarnings("unused") // stapler form validation @Restricted(NoExternalUse.class) public FormValidation doCheckUploadedKeystore(@QueryParameter String value, @QueryParameter String password) { if (StringUtils.isBlank(value)) { return FormValidation.error(Messages.CertificateCredentialsImpl_NoCertificateUploaded()); } SecretBytes secretBytes = SecretBytes.fromString(value); byte[] keystoreBytes = secretBytes.getPlainData(); if (keystoreBytes == null || keystoreBytes.length == 0) { return FormValidation.error(Messages.CertificateCredentialsImpl_LoadKeystoreFailed()); } return validateCertificateKeystore("PKCS12", keystoreBytes, password); }
/** * {@inheritDoc} */ @Override public String getDisplayName() { return Messages.CertificateCredentialsImpl_DisplayName(); }
/** * {@inheritDoc} */ @Override public String getDisplayName() { return Messages.CertificateCredentialsImpl_FileOnMasterKeyStoreSourceDisplayName(); }