diff --git a/src/main/java/org/jruby/ext/openssl/ASN1.java b/src/main/java/org/jruby/ext/openssl/ASN1.java index 8b7b2b54..b2efe10c 100644 --- a/src/main/java/org/jruby/ext/openssl/ASN1.java +++ b/src/main/java/org/jruby/ext/openssl/ASN1.java @@ -1697,13 +1697,13 @@ ASN1Encodable toASN1(final ThreadContext context) { } if ( type == DERGeneralString.class ) { - return new DERGeneralString( val.asString().toString() ); + return ASN1GeneralString.getInstance( val.asString().getBytes() ); } if ( type == DERVisibleString.class ) { - return new DERVisibleString( val.asString().toString() ); + return ASN1VisibleString.getInstance( val.asString().getBytes() ); } if ( type == DERNumericString.class ) { - return new DERNumericString( val.asString().toString() ); + return ASN1NumericString.getInstance( val.asString().getBytes() ); } if ( val instanceof RubyString ) {