I run into the error in the title of the issue when trying to run the HexaPDF testsuite on JRuby. This uses jruby-openssl 0.19.1.
To reproduce clone the HexaPDF repository at https://github.com/gettalong/hexapdf and run the following script using ruby -Ilib:test in its root directory:
require 'hexapdf/digital_signature/common'
pkcs7 = OpenSSL::PKCS7.sign(CERTIFICATES.signer_certificate, CERTIFICATES.signer_key, 'data',
[CERTIFICATES.ca_certificate], OpenSSL::PKCS7::DETACHED)
pkcs7.add_signer(OpenSSL::PKCS7::SignerInfo.new(CERTIFICATES.signer_certificate, CERTIFICATES.signer_key, 'SHA1'))
pkcs7.to_der
It will give the following error output:
Unhandled Java exception: java.lang.NullPointerException: 'element' cannot be null
java.lang.NullPointerException: 'element' cannot be null
add at org/bouncycastle/asn1/ASN1EncodableVector:-1
toASN1Object at org/jruby/ext/openssl/impl/SignerInfoWithPkey.java:240
signerInfosToASN1Set at org/jruby/ext/openssl/impl/Signed.java:265
asASN1 at org/jruby/ext/openssl/impl/Signed.java:225
asASN1 at org/jruby/ext/openssl/impl/PKCS7DataSigned.java:137
asASN1 at org/jruby/ext/openssl/impl/PKCS7.java:179
toASN1 at org/jruby/ext/openssl/impl/PKCS7.java:188
to_der at org/jruby/ext/openssl/PKCS7.java:769
call at org/jruby/ext/openssl/PKCS7$INVOKER$i$0$0$to_der.gen:-1
call at org/jruby/internal/runtime/methods/JavaMethod.java:729
performIndirectCall at org/jruby/ir/targets/indy/InvokeSite.java:893
invoke at org/jruby/ir/targets/indy/InvokeSite.java:797
❤ script at -:5
run at -:-1
invokeWithArguments at java/lang/invoke/MethodHandle.java:735
load at org/jruby/ir/Compiler.java:114
runScript at org/jruby/Ruby.java:1227
runNormally at org/jruby/Ruby.java:1139
runFromMain at org/jruby/Ruby.java:984
internalRun at org/jruby/main/Main.java:289
run at org/jruby/main/Main.java:239
main at org/jruby/main/Main.java:211
I run into the error in the title of the issue when trying to run the HexaPDF testsuite on JRuby. This uses jruby-openssl 0.19.1.
To reproduce clone the HexaPDF repository at https://github.com/gettalong/hexapdf and run the following script using
ruby -Ilib:testin its root directory:It will give the following error output: