Skip to content

Commit aca089c

Browse files
committed
only add DER.TRUE when encoding X.509 extension when non-critical (MRI behaviour)
1 parent 588f798 commit aca089c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/org/jruby/ext/openssl/X509Extensions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -838,8 +838,8 @@ public IRubyObject to_der() {
838838
final ASN1EncodableVector vec = new ASN1EncodableVector();
839839
try {
840840
vec.add( getRealOid() );
841-
if ( critical != null ) { // NOTE: likely a hack Boolean.FALSE should also get skipped
842-
vec.add(critical.booleanValue() ? DERBoolean.TRUE : DERBoolean.FALSE);
841+
if ( critical != null && critical.booleanValue() ) {
842+
vec.add( DERBoolean.TRUE );
843843
}
844844
vec.add( new DEROctetString(getRealValueBytes()) );
845845
return RubyString.newString(getRuntime(), new DLSequence(vec).getEncoded(ASN1Encoding.DER));

0 commit comments

Comments
 (0)