/** * 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); }