From 864ea499695f2f13aab38c178aea866cff220643 Mon Sep 17 00:00:00 2001 From: kares Date: Wed, 10 Apr 2024 12:28:19 +0200 Subject: [PATCH] [fix] OpenSSL::X509::Request#version default is -1 --- src/main/java/org/jruby/ext/openssl/X509Request.java | 2 +- src/test/ruby/x509/test_x509req.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jruby/ext/openssl/X509Request.java b/src/main/java/org/jruby/ext/openssl/X509Request.java index 065a2641..699a5472 100644 --- a/src/main/java/org/jruby/ext/openssl/X509Request.java +++ b/src/main/java/org/jruby/ext/openssl/X509Request.java @@ -267,7 +267,7 @@ public IRubyObject version() { return getRuntime().newFixnum( certVersion.intValue() ); } } - return version == null ? getRuntime().newFixnum(0) : version; + return version == null ? getRuntime().newFixnum(-1) : version; } @JRubyMethod(name="version=") diff --git a/src/test/ruby/x509/test_x509req.rb b/src/test/ruby/x509/test_x509req.rb index d7408cd1..93641509 100644 --- a/src/test/ruby/x509/test_x509req.rb +++ b/src/test/ruby/x509/test_x509req.rb @@ -49,7 +49,7 @@ def test_csr_request_ec_key def test_version csr = OpenSSL::X509::Request.new - assert_equal 0, csr.version + assert_equal -1, csr.version req = OpenSSL::X509::Request.new req.version = 1