@Test public void testIsCertificatePassPhraseValid() throws Exception { iOSApplicationUploadForm form = new iOSApplicationUploadForm(); form.setCertificate(IOUtils.toByteArray(getClass().getResourceAsStream("/Certificates.p12"))); form.setPassphrase("aero1gears"); final Set<ConstraintViolation<iOSApplicationUploadForm>> constraintViolations = validator.validate(form); assertThat(constraintViolations).isEmpty(); }
@AssertTrue(message = "the provided certificate passphrase does not match with the uploaded certificate") public boolean isCertificatePassphraseValid() { try { PKCS12.validate(certificate, passphrase); return true; } catch (Exception e) { return false; } }
iOSApplicationUploadForm { @AssertTrue(message = "the provided certificate passphrase does not match with the uploaded certificate") public boolean isCertificatePassphraseValid() { try { PKCS12.validate(certificate, passphrase); return true; } catch (Exception e) { return false; } } }
iOSApplicationUploadForm { @AssertTrue(message = "the provided certificate passphrase does not match with the uploaded certificate") public boolean isCertificatePassphraseValid() { try { PKCS12.validate(certificate, passphrase); return true; } catch (Exception e) { return false; } } iOSApplicationUploadForm(); }
iOSApplicationUploadForm { @AssertTrue(message = "the provided certificate passphrase does not match with the uploaded certificate") public boolean isCertificatePassphraseValid() { try { PKCS12.validate(certificate, passphrase); return true; } catch (Exception e) { return false; } } iOSApplicationUploadForm(); Boolean getProduction(); @FormParam("production") void setProduction(Boolean production); String getName(); @FormParam("variantID") void setVariantID(String variantID); @FormParam("secret") void setSecret(String secret); String getSecret(); String getVariantID(); @FormParam("name") void setName(String name); String getDescription(); @FormParam("description") void setDescription(String description); String getPassphrase(); @FormParam("passphrase") void setPassphrase(String passphrase); byte[] getCertificate(); @FormParam("certificate") @PartType("application/octet-stream") void setCertificate(byte[] data); @AssertTrue(message = "the provided certificate passphrase does not match with the uploaded certificate") boolean isCertificatePassphraseValid(); void apply(iOSVariant iOSVariant); }
iOSApplicationUploadForm { @AssertTrue(message = "the provided certificate passphrase does not match with the uploaded certificate") public boolean isCertificatePassphraseValid() { try { PKCS12.validate(certificate, passphrase); return true; } catch (Exception e) { return false; } } iOSApplicationUploadForm(); Boolean getProduction(); @FormParam("production") void setProduction(Boolean production); String getName(); @FormParam("variantID") void setVariantID(String variantID); @FormParam("secret") void setSecret(String secret); String getSecret(); String getVariantID(); @FormParam("name") void setName(String name); String getDescription(); @FormParam("description") void setDescription(String description); String getPassphrase(); @FormParam("passphrase") void setPassphrase(String passphrase); byte[] getCertificate(); @FormParam("certificate") @PartType("application/octet-stream") void setCertificate(byte[] data); @AssertTrue(message = "the provided certificate passphrase does not match with the uploaded certificate") boolean isCertificatePassphraseValid(); void apply(iOSVariant iOSVariant);  }