Skip to content

Instantly share code, notes, and snippets.

@headius
Created August 3, 2012 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save headius/3250143 to your computer and use it in GitHub Desktop.
Save headius/3250143 to your computer and use it in GitHub Desktop.
system ~/projects/jruby/tmp/bc_pgp_jruby1.7_bug $ (pickjdk 2 ; jruby ./runner.rb)
New JDK: 1.7.0.jdk
This example will encrypt data, and then decrypt that data.
Private Key: /Users/headius/projects/jruby/tmp/bc_pgp_jruby1.7_bug/keys/bc_pgp_jruby_bug-prv.asc
Public Key: /Users/headius/projects/jruby/tmp/bc_pgp_jruby1.7_bug/keys/bc_pgp_jruby_bug-pub.asc
Encrypting string: "8==============D"
......
Cipher.java:642:in `getInstance': java.lang.SecurityException: JCE cannot authenticate the provider BC
from null:-1:in `createCipher'
from null:-1:in `createCipher'
from null:-1:in `createPublicKeyCipher'
from null:-1:in `encryptSessionInfo'
from null:-1:in `generate'
from null:-1:in `open'
from null:-1:in `open'
from NativeMethodAccessorImpl.java:-2:in `invoke0'
from NativeMethodAccessorImpl.java:57:in `invoke'
from DelegatingMethodAccessorImpl.java:43:in `invoke'
from Method.java:601:in `invoke'
from JavaMethod.java:470:in `invokeDirectWithExceptionHandling'
from JavaMethod.java:328:in `invokeDirect'
from InstanceMethodInvoker.java:71:in `call'
from CachingCallSite.java:332:in `cacheAndCall'
from CachingCallSite.java:203:in `call'
from CallTwoArgNode.java:59:in `interpret'
from LocalAsgnNode.java:123:in `interpret'
from NewlineNode.java:104:in `interpret'
from BlockNode.java:71:in `interpret'
from ASTInterpreter.java:75:in `INTERPRET_METHOD'
from InterpretedMethod.java:182:in `call'
from DefaultMethod.java:192:in `call'
from CachingCallSite.java:312:in `cacheAndCall'
from CachingCallSite.java:169:in `call'
from ./runner.rb:17:in `__file__'
from ./runner.rb:-1:in `load'
from Ruby.java:780:in `runScript'
from Ruby.java:773:in `runScript'
from Ruby.java:650:in `runNormally'
from Ruby.java:499:in `runFromMain'
from Main.java:376:in `doRunFromMain'
from Main.java:265:in `internalRun'
from Main.java:231:in `run'
from Main.java:215:in `run'
from Main.java:195:in `main'
Caused by:
JarVerifier.java:247:in `verify': java.util.jar.JarException: Class is on the bootclasspath
from JceSecurity.java:161:in `verifyProviderJar'
from JceSecurity.java:187:in `getVerificationResult'
from Cipher.java:638:in `getInstance'
from null:-1:in `createCipher'
from null:-1:in `createCipher'
from null:-1:in `createPublicKeyCipher'
from null:-1:in `encryptSessionInfo'
from null:-1:in `generate'
from null:-1:in `open'
from null:-1:in `open'
from NativeMethodAccessorImpl.java:-2:in `invoke0'
from NativeMethodAccessorImpl.java:57:in `invoke'
from DelegatingMethodAccessorImpl.java:43:in `invoke'
from Method.java:601:in `invoke'
from JavaMethod.java:470:in `invokeDirectWithExceptionHandling'
from JavaMethod.java:328:in `invokeDirect'
from InstanceMethodInvoker.java:71:in `call'
from CachingCallSite.java:332:in `cacheAndCall'
from CachingCallSite.java:203:in `call'
from CallTwoArgNode.java:59:in `interpret'
from LocalAsgnNode.java:123:in `interpret'
from NewlineNode.java:104:in `interpret'
from BlockNode.java:71:in `interpret'
from ASTInterpreter.java:75:in `INTERPRET_METHOD'
from InterpretedMethod.java:182:in `call'
from DefaultMethod.java:192:in `call'
from CachingCallSite.java:312:in `cacheAndCall'
from CachingCallSite.java:169:in `call'
from ./runner.rb:17:in `__file__'
from ./runner.rb:-1:in `load'
from Ruby.java:780:in `runScript'
from Ruby.java:773:in `runScript'
from Ruby.java:650:in `runNormally'
from Ruby.java:499:in `runFromMain'
from Main.java:376:in `doRunFromMain'
from Main.java:265:in `internalRun'
from Main.java:231:in `run'
from Main.java:215:in `run'
from Main.java:195:in `main'
system ~/projects/jruby/tmp/bc_pgp_jruby1.7_bug $ (pickjdk 3 ; jruby ./runner.rb)
New JDK: 1.8.0.mlvm.head
This example will encrypt data, and then decrypt that data.
Private Key: /Users/headius/projects/jruby/tmp/bc_pgp_jruby1.7_bug/keys/bc_pgp_jruby_bug-prv.asc
Public Key: /Users/headius/projects/jruby/tmp/bc_pgp_jruby1.7_bug/keys/bc_pgp_jruby_bug-pub.asc
Encrypting string: "8==============D"
......
Encrypted value (ASCII Armored): "-----BEGIN PGP MESSAGE-----\nVersion: BCPG v1.47\n\nhQEMA0hQjTEd00ExAQgAvws9zkjYjEIAMbKXv8SbxzIobfUDKqaPLhqTq4wUzTBt\nk4WojUhs7BaEDq4r9c6a8PQQDnrPP6XSXicRrpiEgrjIn4gDdvl4n1MMP7pcIJvs\nDsb0Uxw+WfyEykEMDtE8RIDxDVfhhqj1hwbThHtrbR5i7LvKSRSQ5h4nTp8geEka\nMX5W/waIglJzt15NV5/qC8nnWH8vjHCG+gjyitCULBGChnL9JZdJx5BcS1I1PKXK\ne5+wqHA/DZ1dUqxDzGyIM5nwPCx8473hgbdmFpFVCSAeYzd+BLO2frV8aN6JcytT\nTRjicFLpx4WxLbZNUCKPkB7cFG4BoeixUhx+OlmK9skeqkEnCUhcJDIuUzzGLCDT\nLLxQKF5wHCLmhqfHhotA\n=lUGc\n-----END PGP MESSAGE-----\n"
Decrypting....
Decrypted value: "8==============D"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment