title: Adding a new Extension to my generated certificate
body: <p>I need to add a new Extension of OID <strong>1.3.6.1.5.5.7.1.26</strong> in my certificate. I got this OID extension in my certificate but with the following error:</p>
  
  <blockquote>
    <p>Certificate Extensions: 10
    [1]: ObjectId: 1.3.6.1.5.5.7.1.26 Criticality=false<br>
    <strong>Extension unknown: DER encoded OCTET string =</strong><br>
    0000: 04 0C 30 0A 13 08 33 39   20 64 63 20 32 62        ..0...<br>
    39 dc 2b</p>
  </blockquote>
  
  <p>I want this OID to be recognized similar to other extensions like <strong>AuthorityInfoAccess</strong>, etc. </p>
  
  <p>Do I need to edit the jar of <strong>Bouncy Castle</strong> X509 class? </p>
  
  <p>Im using ACME4j as a client and Letsencrypt Boulder as my server.</p>
  
  <p>Here is the CSR Builder code for signing up the certificate.</p>
  
  <pre><code>public void sign(KeyPair keypair) throws IOException {
      //Security.addProvider(new BouncyCastleProvider());
      Objects.requireNonNull(keypair, "keypair");
      if (namelist.isEmpty()) {
          throw new IllegalStateException("No domain was set");
      }
  
      try {
          GeneralName[] gns = new GeneralName[namelist.size()];
          for (int ix = 0; ix &lt; namelist.size(); ix++) {
              gns[ix] = new GeneralName(GeneralName.dNSName,namelist.get(ix));
          }
          SignatureAlgorithmIdentifierFinder algFinder = new 
                  DefaultSignatureAlgorithmIdentifierFinder();
          GeneralNames subjectAltName = new GeneralNames(gns);
  
  
          PKCS10CertificationRequestBuilder p10Builder = new     JcaPKCS10CertificationRequestBuilder(namebuilder.build(), keypair.getPublic());
  
          ExtensionsGenerator extensionsGenerator = new ExtensionsGenerator();
          extensionsGenerator.addExtension(Extension.subjectAlternativeName,     false, subjectAltName);
          //extensionsGenerator.addExtension(Extension.authorityInfoAccess,         true, subjectAltName);
          //extensionsGenerator.addExtension(new ASN1ObjectIdentifier("TBD"),     false, subjectAltName);
          //extensionsGenerator.addExtension(new     ASN1ObjectIdentifier("1.3.6.1.5.5.7.1.24"), false, subjectAltName);
          extensionsGenerator.addExtension(new     ASN1ObjectIdentifier("1.3.6.1.5.5.7.1.26").intern(), false, subjectAltName);
          //extentionsGenerator.addExtension();
              p10Builder.addAttribute(PKCSObjectIdentifiers.pkcs_9_at_extensionRequest,     extensionsGenerator.generate());
  
  
          PrivateKey pk = keypair.getPrivate();
          /*JcaContentSignerBuilder csBuilder = new JcaContentSignerBuilder(
                          pk instanceof ECKey ? EC_SIGNATURE_ALG :     EC_SIGNATURE_ALG);
          ContentSigner signer = csBuilder.build(pk);*/
  
          if(pk instanceof ECKey)
          {
              AlgorithmIdentifier sigAlg = algFinder.find("SHA1withECDSA");
                AlgorithmIdentifier digAlg = new     DefaultDigestAlgorithmIdentifierFinder().
                      find(sigAlg);
              ContentSigner signer = new     JcaContentSignerBuilder("SHA256with"+pk.getAlgorithm()).setProvider(BOUNCY_CASTL    E_PROVIDER).build(keypair.getPrivate());
  
              csr=p10Builder.build(signer);
              System.out.println("ZIPED CSR ECDSA: "+csr);
          }
          else
          {
              ContentSigner signer = new     JcaContentSignerBuilder("SHA256with"+pk.getAlgorithm()).build(keypair.getPrivate    ()); 
              csr = p10Builder.build(signer);
              System.out.println("ZIPED CSR RSA: "+csr);
          }
  
          //csr = p10Builder.build(signer);
      } catch (Exception ex) {
          ex.printStackTrace();;
      }
  }
  </code></pre>