From 28d9fd18c2e0cd7bda366d74d208d43d87ae5e53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Sun, 29 Jun 2025 09:44:48 -1000 Subject: [PATCH] Fix `OpenSSL::X509::CRL#to_pem` when building CRL from scratch When building an CRL from scratch, the `crl` member variable has no value, and when calling `to_pem` on the object, the following value is returned instead of the actual CRL: ``` -----BEGIN X509 CRL----- MAA= -----END X509 CRL----- ``` The function `getCRL()` return the `crl` member variable if it is non-null, and generate the CRL and store it in this variable otherwise. It seems adequate to use this getter function rather than accessing the member variable directly. Fixes #163 --- src/main/java/org/jruby/ext/openssl/X509CRL.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jruby/ext/openssl/X509CRL.java b/src/main/java/org/jruby/ext/openssl/X509CRL.java index df9e1453..b5baa2b8 100644 --- a/src/main/java/org/jruby/ext/openssl/X509CRL.java +++ b/src/main/java/org/jruby/ext/openssl/X509CRL.java @@ -304,7 +304,7 @@ public IRubyObject initialize_copy(final IRubyObject obj) { public IRubyObject to_pem(final ThreadContext context) { StringWriter writer = new StringWriter(); try { - PEMInputOutput.writeX509CRL(writer, crl); + PEMInputOutput.writeX509CRL(writer, getCRL()); return RubyString.newString(context.runtime, writer.getBuffer()); } catch (IOException e) {