diff --git a/src/main/java/org/jruby/ext/openssl/ASN1.java b/src/main/java/org/jruby/ext/openssl/ASN1.java index f2bb0cde..d89bc950 100644 --- a/src/main/java/org/jruby/ext/openssl/ASN1.java +++ b/src/main/java/org/jruby/ext/openssl/ASN1.java @@ -1695,13 +1695,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 ) {