]> WPIA git - gigi.git/commitdiff
Merge changes I46ae11f8,I6d71e70e,Ie19e3229
authorBenny Baumann <BenBE1987@gmx.net>
Tue, 7 Nov 2017 19:55:40 +0000 (20:55 +0100)
committerGerrit Code Review <gigi-system@dogcraft.de>
Tue, 7 Nov 2017 19:55:40 +0000 (20:55 +0100)
* changes:
  chg: remove csr_name and crt_name columns from certs
  chg: use certificate attachment to store CRT and CSR files
  add: text-attachments for certificates

1  2 
tests/club/wpia/gigi/pages/account/TestCertificateAdd.java

index 8d46cf2de8c841232e9e55096256e13f36ce37ef,986442b13c3f854c9a17099fbdbd832d276a3aa8..bac62175e7bfee9bf0ddcb9c53dd895c25e929f7
@@@ -68,12 -68,6 +68,12 @@@ public class TestCertificateAdd extend
  
      KeyPair kp = generateKeypair();
  
 +    /**
 +     * This KeyPair is used for testing the KeyCheck for proper rejection of
 +     * invalid keys. The generated keys suffers from small factors.
 +     */
 +    KeyPair kpBroken = generateBrokenKeypair();
 +
      String csrf;
  
      public TestCertificateAdd() throws GeneralSecurityException, IOException {
@@@ -88,7 -82,6 +88,6 @@@
          }, new DNSName(uniq + ".tld"));
  
          String pem = generatePEMCSR(kp, "CN=a." + uniq + ".tld", atts);
          String[] res = fillOutForm("CSR=" + URLEncoder.encode(pem, "UTF-8"));
          assertArrayEquals(new String[] {
                  "server", CertificateRequest.DEFAULT_CN, "dns:a." + uniq + ".tld\ndns:" + uniq + ".tld\n", Digest.SHA512.toString()
          X509Certificate parsedLoginEnabled = createCertWithValidity("&validFrom=now&validity=1m", true);
          assertEquals(u, CertificateOwner.getByEnabledSerial(parsedLoginEnabled.getSerialNumber().toString(16).toLowerCase()));
      }
 +
 +    @Test
 +    public void testInvalidKeyInCSR() throws IOException, GeneralSecurityException {
 +        PKCS10Attributes atts = buildAtts(new ObjectIdentifier[] {
 +                CertificateRequest.OID_KEY_USAGE_SSL_SERVER
 +        }, new DNSName(uniq + ".tld"));
 +
 +        String pem = generatePEMCSR(kpBroken, "CN=a." + uniq + ".tld", atts);
 +
 +        HttpURLConnection huc = post(CertificateAdd.PATH, "CSR=" + URLEncoder.encode(pem, "UTF-8"));
 +        assertThat(IOUtils.readURL(huc), hasError());
 +    }
 +
  }