code: public X509ExtensionBuilder addExtension(ASN1ObjectIdentifier oid, boolean critical, ASN1Encodable value)
      {
          try {
              this.extensions.addExtension(oid, critical, value.toASN1Primitive().getEncoded(ASN1Encoding.DER));
          } catch (IOException e) {
              // Very unlikely
              throw new IllegalArgumentException("Invalid extension value, it could not be properly DER encoded.");
          }
          return this;
      }
docs: Add an extension.
  
  @param oid the extension oid.
  @param critical true if the extension is critical.
  @param value the value of the extension.
  @return this extensions builder to allow chaining.