/** * 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); }
/** * 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()); 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) {
return FormValidation.warning(Messages.CertificateCredentialsImpl_LoadKeystoreFailed()); 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) {