When trying to read a RSA private key from a file using the method
public PrivateKey getPrivateKey()
throws NoSuchAlgorithmException,
InvalidKeySpecException, IOException {
final InputStream inputStream = getClass().getClassLoader()
.getResourceAsStream("privatekey");
byte[] privKeyBytes = null;
try {
privKeyBytes = IOUtils.toByteArray(inputStream);
} catch (final IOException exception) {
LOGGER.error("", exception);
IOUtils.closeQuietly(inputStream);
}
LOGGER.debug("privKeyBytes: {}", privKeyBytes);
String BEGIN = "-----BEGIN RSA PRIVATE KEY-----";
String END = "-----END RSA PRIVATE KEY-----";
String str = new String(privKeyBytes);
if (str.contains(BEGIN) && str.contains(END)) {
str = str.substring(BEGIN.length(), str.lastIndexOf(END));
}
KeyFactory fac = KeyFactory.getInstance("RSA");
EncodedKeySpec privKeySpec =
new PKCS8EncodedKeySpec(Base64.decode(str.getBytes()));
return fac.generatePrivate(privKeySpec);
}
I get the exception
java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: IOException : algid parse error, not a sequence
at sun.security.rsa.RSAKeyFactory.engineGeneratePrivate(RSAKeyFactory.java:200) ~[na:1.6.0_23]
at java.security.KeyFactory.generatePrivate(KeyFactory.java:342) ~[na:1.6.0_23]
at the fac.generatePrivate(privKeySpec) call.
What does this error mean?
Thanks
Dmitri
asked Jul 2, 2011 at 19:52
Glory to RussiaGlory to Russia
16.6k53 gold badges176 silver badges319 bronze badges
I was having this same issue, and the format of the key was NOT the actual problem.
All I had to do to get rid of that exception was to call
java.security.Security.addProvider(
new org.bouncycastle.jce.provider.BouncyCastleProvider()
);
and everything worked
answered Sep 20, 2013 at 8:43
5
It means your key is not in PKCS#8 format. The easiest thing to do is to use the openssl pkcs8 -topk8 <...other options...>
command to convert the key once. Alternatively you can use the PEMReader
class of the Bouncycastle lightweight API.
yegor256
100k119 gold badges438 silver badges585 bronze badges
answered Jul 2, 2011 at 23:37
3
You must make your PCKS8 file from your private key!
private.pem => name of private key file
openssl genrsa -out private.pem 1024
public_key.pem => name of public key file
openssl rsa -in private.pem -pubout -outform PEM -out public_key.pem
private_key.pem => name of private key with PCKS8 format! you can just read this format in java
openssl pkcs8 -topk8 -inform PEM -in private.pem -out private_key.pem -nocrypt
answered Oct 28, 2017 at 9:58
Pasha GRPasha GR
1,43415 silver badges27 bronze badges
7
When trying to read a RSA private key from a file using the method
public PrivateKey getPrivateKey()
throws NoSuchAlgorithmException,
InvalidKeySpecException, IOException {
final InputStream inputStream = getClass().getClassLoader()
.getResourceAsStream("privatekey");
byte[] privKeyBytes = null;
try {
privKeyBytes = IOUtils.toByteArray(inputStream);
} catch (final IOException exception) {
LOGGER.error("", exception);
IOUtils.closeQuietly(inputStream);
}
LOGGER.debug("privKeyBytes: {}", privKeyBytes);
String BEGIN = "-----BEGIN RSA PRIVATE KEY-----";
String END = "-----END RSA PRIVATE KEY-----";
String str = new String(privKeyBytes);
if (str.contains(BEGIN) && str.contains(END)) {
str = str.substring(BEGIN.length(), str.lastIndexOf(END));
}
KeyFactory fac = KeyFactory.getInstance("RSA");
EncodedKeySpec privKeySpec =
new PKCS8EncodedKeySpec(Base64.decode(str.getBytes()));
return fac.generatePrivate(privKeySpec);
}
I get the exception
java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: IOException : algid parse error, not a sequence
at sun.security.rsa.RSAKeyFactory.engineGeneratePrivate(RSAKeyFactory.java:200) ~[na:1.6.0_23]
at java.security.KeyFactory.generatePrivate(KeyFactory.java:342) ~[na:1.6.0_23]
at the fac.generatePrivate(privKeySpec) call.
What does this error mean?
Thanks
Dmitri
asked Jul 2, 2011 at 19:52
Glory to RussiaGlory to Russia
16.6k53 gold badges176 silver badges319 bronze badges
I was having this same issue, and the format of the key was NOT the actual problem.
All I had to do to get rid of that exception was to call
java.security.Security.addProvider(
new org.bouncycastle.jce.provider.BouncyCastleProvider()
);
and everything worked
answered Sep 20, 2013 at 8:43
5
It means your key is not in PKCS#8 format. The easiest thing to do is to use the openssl pkcs8 -topk8 <...other options...>
command to convert the key once. Alternatively you can use the PEMReader
class of the Bouncycastle lightweight API.
yegor256
100k119 gold badges438 silver badges585 bronze badges
answered Jul 2, 2011 at 23:37
3
You must make your PCKS8 file from your private key!
private.pem => name of private key file
openssl genrsa -out private.pem 1024
public_key.pem => name of public key file
openssl rsa -in private.pem -pubout -outform PEM -out public_key.pem
private_key.pem => name of private key with PCKS8 format! you can just read this format in java
openssl pkcs8 -topk8 -inform PEM -in private.pem -out private_key.pem -nocrypt
answered Oct 28, 2017 at 9:58
Pasha GRPasha GR
1,43415 silver badges27 bronze badges
7
This tutorial guides you on how to resolve Error InvalidKeySpecException : algid parse error, not a sequence while reading pem to get RSA private key in Java.
InvalidKeySpecException : algid parse error, not a sequence
Are you facing the the following error while reading RSA private key from private.pem file with Java code ?
Exception in thread "main" java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: IOException : algid parse error, not a sequence at java.base/sun.security.rsa.RSAKeyFactory.engineGeneratePrivate(RSAKeyFactory.java:251) at java.base/java.security.KeyFactory.generatePrivate(KeyFactory.java:390) at com.sneppets.util.PemToPublicPrivateKeyExample1.getPrivateKey(PemToPublicPrivateKeyExample1.java:63) at com.sneppets.util.PemToPublicPrivateKeyExample1.main(PemToPublicPrivateKeyExample1.java:27) Caused by: java.security.InvalidKeyException: IOException : algid parse error, not a sequence at java.base/sun.security.pkcs.PKCS8Key.decode(PKCS8Key.java:350) at java.base/sun.security.pkcs.PKCS8Key.decode(PKCS8Key.java:355) at java.base/sun.security.rsa.RSAPrivateCrtKeyImpl.<init>(RSAPrivateCrtKeyImpl.java:130) at java.base/sun.security.rsa.RSAPrivateCrtKeyImpl.newKey(RSAPrivateCrtKeyImpl.java:80) at java.base/sun.security.rsa.RSAKeyFactory.generatePrivate(RSAKeyFactory.java:356) at java.base/sun.security.rsa.RSAKeyFactory.engineGeneratePrivate(RSAKeyFactory.java:247) ... 3 more
I got the above error when I tried to get private and public keys from .pem files. I had generated keypairs with OpenSSL using the following commands.
> openssl genrsa -out private.pem 2048
> openssl rsa -in private.pem -outform PEM -pubout -out public.pem
Then I wrote the following Java classes PemFile.java and PemToPublicPrivateKeyExample.java.
PemFile.java
This util class used to handle pem file I/O operations and this uses BouncyCastle library
package com.sneppets.util; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import org.bouncycastle.util.io.pem.PemObject; import org.bouncycastle.util.io.pem.PemReader; public class PemFile { private PemObject pemObject; public PemFile(String filename) throws FileNotFoundException, IOException { PemReader pemReader = new PemReader(new InputStreamReader(new FileInputStream(filename))); try { this.pemObject = pemReader.readPemObject(); } finally { pemReader.close(); } } public PemObject getPemObject() { return pemObject; } }
PemToPublicPrivateKeyExample.java
This is the actual demo class which was used to read .pem file to get the private and public keys.
package com.sneppets.util; import java.io.FileNotFoundException; import java.io.IOException; import java.security.KeyFactory; import java.security.NoSuchAlgorithmException; import java.security.PublicKey; import java.security.interfaces.RSAPrivateKey; import java.security.interfaces.RSAPublicKey; import java.security.spec.InvalidKeySpecException; import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.X509EncodedKeySpec; public class PemToPublicPrivateKeyExample { public static void main (String[] args) throws NoSuchAlgorithmException, InvalidKeySpecException, IOException { RSAPublicKey publicKey = (RSAPublicKey) getPublicKey("public.pem"); System.out.println("Public Key: " + publicKey); RSAPrivateKey privateKey = (RSAPrivateKey) getPrivateKey("private.pem"); System.out.println("Private Key: " + privateKey); } private static PublicKey getPublicKey(String filename) throws FileNotFoundException, IOException, NoSuchAlgorithmException, InvalidKeySpecException { //Usage of PemFile.java util PemFile pemFile = new PemFile(filename); byte[] encoded = pemFile.getPemObject().getContent(); X509EncodedKeySpec keySpec = new X509EncodedKeySpec(encoded); KeyFactory kf = KeyFactory.getInstance("RSA"); PublicKey publicKey = kf.generatePublic(keySpec); return publicKey; } private static RSAPrivateKey getPrivateKey(String filename) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException { PemFile pemFile = new PemFile(filename); byte[] encoded = pemFile.getPemObject().getContent(); PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(encoded); KeyFactory keyFactory = KeyFactory.getInstance("RSA"); RSAPrivateKey privateKey = (RSAPrivateKey) keyFactory.generatePrivate(spec); return privateKey; } }
When I tried to run the above program, it resulted with following output with error InvalidKeySpecException : algid parse error, not a sequence. It looks like there is a problem with KeySpec. It means that your key is not in the PKCS#8 format.
Output
Public Key: Sun RSA public key, 2048 bits params: null modulus: 25622523552640509872674647748128418427196878805802974525582213375943292866688386280128572938417498583760725631884402047650172578686271723723912330821024381216453489466722940584464191109827782366140686281989329115496275295815310414943283528008535270516589906407988761155150211830876162901079773987287320522395702055867191390238620531771664622250346650503605006931286353348714961829467079593192943673984151097109814014569056365504907110936637707839047313988149249985540404575244379812342259482507954431540160866546667721354659887420139015654844886782367838366698828795807906696509716076522708156260850256749742657872987 public exponent: 65537 Exception in thread "main" java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: IOException : algid parse error, not a sequence at java.base/sun.security.rsa.RSAKeyFactory.engineGeneratePrivate(RSAKeyFactory.java:251) at java.base/java.security.KeyFactory.generatePrivate(KeyFactory.java:390) at com.sneppets.util.PemToPublicPrivateKeyExample1.getPrivateKey(PemToPublicPrivateKeyExample1.java:63) at com.sneppets.util.PemToPublicPrivateKeyExample1.main(PemToPublicPrivateKeyExample1.java:27) Caused by: java.security.InvalidKeyException: IOException : algid parse error, not a sequence at java.base/sun.security.pkcs.PKCS8Key.decode(PKCS8Key.java:350) at java.base/sun.security.pkcs.PKCS8Key.decode(PKCS8Key.java:355) at java.base/sun.security.rsa.RSAPrivateCrtKeyImpl.<init>(RSAPrivateCrtKeyImpl.java:130) at java.base/sun.security.rsa.RSAPrivateCrtKeyImpl.newKey(RSAPrivateCrtKeyImpl.java:80) at java.base/sun.security.rsa.RSAKeyFactory.generatePrivate(RSAKeyFactory.java:356) at java.base/sun.security.rsa.RSAKeyFactory.engineGeneratePrivate(RSAKeyFactory.java:247) ... 3 more
Now, let’s see how to solve the above error. What you need to do is ? Try to run the following command, that will output private key in DER format which Java code can read with the help of “PKCS8EncodedKeySpec” interface.
> openssl pkcs8 -topk8 -inform PEM -outform DER -in private.pem -out private.der -nocrypt
Then rewrite your main() method and getPrivateKey() method as shown below.
public static void main (String[] args) throws NoSuchAlgorithmException, InvalidKeySpecException, IOException { RSAPublicKey publicKey = (RSAPublicKey) getPublicKey("public.pem"); System.out.println("Public Key: " + publicKey); RSAPrivateKey privateKey = (RSAPrivateKey) getPrivateKey("private.der"); System.out.println("Private Key: " + privateKey); }
And your getPrivateKey() method should look like the below one.
private static RSAPrivateKey getPrivateKey(String filename) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException { File file = new File(filename); FileInputStream fis = new FileInputStream(file); DataInputStream dis = new DataInputStream(fis); byte[] keyBytes = new byte[(int) file.length()]; dis.readFully(keyBytes); dis.close(); PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(keyBytes); KeyFactory keyFactory = KeyFactory.getInstance("RSA"); RSAPrivateKey privateKey = (RSAPrivateKey) keyFactory.generatePrivate(spec); return privateKey; }
After you make the above modifications when you run the java class PemToPublicPrivateKeyExample.java you should get the following output. The error algid parse error, not a sequence is gone away.
Public Key: Sun RSA public key, 2048 bits params: null modulus: 25622523552640509872674647748128418427196878805802974525582213375943292866688386280128572938417498583760725631884402047650172578686271723723912330821024381216453489466722940584464191109827782366140686281989329115496275295815310414943283528008535270516589906407988761155150211830876162901079773987287320522395702055867191390238620531771664622250346650503605006931286353348714961829467079593192943673984151097109814014569056365504907110936637707839047313988149249985540404575244379812342259482507954431540160866546667721354659887420139015654844886782367838366698828795807906696509716076522708156260850256749742657872987 public exponent: 65537 Private Key: SunRsaSign RSA private CRT key, 2048 bits params: null modulus: 25622523552640509872674647748128418427196878805802974525582213375943292866688386280128572938417498583760725631884402047650172578686271723723912330821024381216453489466722940584464191109827782366140686281989329115496275295815310414943283528008535270516589906407988761155150211830876162901079773987287320522395702055867191390238620531771664622250346650503605006931286353348714961829467079593192943673984151097109814014569056365504907110936637707839047313988149249985540404575244379812342259482507954431540160866546667721354659887420139015654844886782367838366698828795807906696509716076522708156260850256749742657872987 private exponent: 17586675877266705152852948405542832996789557033758566963459796821491022521968409906450151769059223626246375651907411955222968904695737689370473905996950420987529598801922548122601777754449900577934700871610326862724399219245008291429173183703983125160562182583129506126953049098803766357618924779439790333077672652416920933916743021966806362551647245303270227184263417966975663222400220534187827685721381511872771004877660769860453663015783027855746470790262266367515875656740848222390555559390660055912124446014837715667235277503335371191622760609500597616829812723390081370845708118008488655826516816751198273129617
That’s it. Hope it helped 🙂
Also See:
- Get modulus and exponent for RSA public key ?
- How to install OpenSSL in Windows 10 64-bit Operating System ?
- Visual Studio Code Windows install location and Path issues from Terminal
- McAfee Agent cannot be removed while it is in managed mode
- Fix iPhone touch screen unresponsiveness
- How to add add 16GB RAM along with 8GB RAM – Acer Aspire 7 Laptop ?
- Generate public key and private key with OpenSSL in Windows 10
- How do I convert a PEM file to XML RSA key ?
- Guide to upload ISO image file to VMware ESXi datastores.
- Guide to install Operating System in the VMware ESXi server using vSphere Client.
- Read .pem file to get public and private keys.
References:
- maven bouncycastle
- openssl.org
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Closed
msamichev opened this issue
Aug 14, 2018
· 3 comments
Comments
Hello.
After upgrade logstash from 6.2.2 to 6.3.2 I’ve got the follow error:
[2018-08-14T10:01:24,344][ERROR][logstash.inputs.beats ] Looks like you either have a bad certificate, an invalid key or your private key was not in PKCS8 format.
[2018-08-14T10:01:24,363][WARN ][io.netty.channel.ChannelInitializer] Failed to initialize a channel. Closing: [id: 0x64a54282, L:/172.19.0.6:5044 - R:/172.17.6.34:39248]
java.lang.IllegalArgumentException: File does not contain valid private key: /etc/server.key
at io.netty.handler.ssl.SslContextBuilder.keyManager(SslContextBuilder.java:267) ~[netty-all-4.1.18.Final.jar:4.1.18.Final]
at io.netty.handler.ssl.SslContextBuilder.forServer(SslContextBuilder.java:90) ~[netty-all-4.1.18.Final.jar:4.1.18.Final]
at org.logstash.netty.SslSimpleBuilder.build(SslSimpleBuilder.java:112) ~[logstash-input-beats-5.0.16.jar:?]
at org.logstash.beats.Server$BeatsInitializer.initChannel(Server.java:131) ~[logstash-input-beats-5.0.16.jar:?]
at org.logstash.beats.Server$BeatsInitializer.initChannel(Server.java:101) [logstash-input-beats-5.0.16.jar:?]
at io.netty.channel.ChannelInitializer.initChannel(ChannelInitializer.java:113) [netty-all-4.1.18.Final.jar:4.1.18.Final]
at io.netty.channel.ChannelInitializer.handlerAdded(ChannelInitializer.java:105) [netty-all-4.1.18.Final.jar:4.1.18.Final]
at io.netty.channel.DefaultChannelPipeline.callHandlerAdded0(DefaultChannelPipeline.java:606) [netty-all-4.1.18.Final.jar:4.1.18.Final]
at io.netty.channel.DefaultChannelPipeline.access$000(DefaultChannelPipeline.java:46) [netty-all-4.1.18.Final.jar:4.1.18.Final]
at io.netty.channel.DefaultChannelPipeline$PendingHandlerAddedTask.execute(DefaultChannelPipeline.java:1412) [netty-all-4.1.18.Final.jar:4.1.18.Final]
at io.netty.channel.DefaultChannelPipeline.callHandlerAddedForAllHandlers(DefaultChannelPipeline.java:1131) [netty-all-4.1.18.Final.jar:4.1.18.Final]
at io.netty.channel.DefaultChannelPipeline.invokeHandlerAddedIfNeeded(DefaultChannelPipeline.java:656) [netty-all-4.1.18.Final.jar:4.1.18.Final]
at io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:510) [netty-all-4.1.18.Final.jar:4.1.18.Final]
at io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:423) [netty-all-4.1.18.Final.jar:4.1.18.Final]
at io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:482) [netty-all-4.1.18.Final.jar:4.1.18.Final]
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) [netty-all-4.1.18.Final.jar:4.1.18.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:403) [netty-all-4.1.18.Final.jar:4.1.18.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463) [netty-all-4.1.18.Final.jar:4.1.18.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) [netty-all-4.1.18.Final.jar:4.1.18.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-all-4.1.18.Final.jar:4.1.18.Final]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_171]
Caused by: java.security.spec.InvalidKeySpecException: Neither RSA, DSA nor EC worked
at io.netty.handler.ssl.SslContext.getPrivateKeyFromByteBuffer(SslContext.java:1045) ~[netty-all-4.1.18.Final.jar:4.1.18.Final]
at io.netty.handler.ssl.SslContext.toPrivateKey(SslContext.java:1014) ~[netty-all-4.1.18.Final.jar:4.1.18.Final]
at io.netty.handler.ssl.SslContextBuilder.keyManager(SslContextBuilder.java:265) ~[netty-all-4.1.18.Final.jar:4.1.18.Final]
... 20 more
Caused by: java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: IOException : algid parse error, not a sequence
at sun.security.ec.ECKeyFactory.engineGeneratePrivate(ECKeyFactory.java:169) ~[sunec.jar:1.8.0_171]
at java.security.KeyFactory.generatePrivate(KeyFactory.java:372) ~[?:1.8.0_171]
at io.netty.handler.ssl.SslContext.getPrivateKeyFromByteBuffer(SslContext.java:1043) ~[netty-all-4.1.18.Final.jar:4.1.18.Final]
at io.netty.handler.ssl.SslContext.toPrivateKey(SslContext.java:1014) ~[netty-all-4.1.18.Final.jar:4.1.18.Final]
at io.netty.handler.ssl.SslContextBuilder.keyManager(SslContextBuilder.java:265) ~[netty-all-4.1.18.Final.jar:4.1.18.Final]
... 20 more
Caused by: java.security.InvalidKeyException: IOException : algid parse error, not a sequence
at sun.security.pkcs.PKCS8Key.decode(PKCS8Key.java:352) ~[?:1.8.0_171]
at sun.security.pkcs.PKCS8Key.decode(PKCS8Key.java:357) ~[?:1.8.0_171]
at sun.security.ec.ECPrivateKeyImpl.<init>(ECPrivateKeyImpl.java:73) ~[sunec.jar:1.8.0_171]
at sun.security.ec.ECKeyFactory.implGeneratePrivate(ECKeyFactory.java:237) ~[sunec.jar:1.8.0_171]
at sun.security.ec.ECKeyFactory.engineGeneratePrivate(ECKeyFactory.java:165) ~[sunec.jar:1.8.0_171]
at java.security.KeyFactory.generatePrivate(KeyFactory.java:372) ~[?:1.8.0_171]
at io.netty.handler.ssl.SslContext.getPrivateKeyFromByteBuffer(SslContext.java:1043) ~[netty-all-4.1.18.Final.jar:4.1.18.Final]
at io.netty.handler.ssl.SslContext.toPrivateKey(SslContext.java:1014) ~[netty-all-4.1.18.Final.jar:4.1.18.Final]
at io.netty.handler.ssl.SslContextBuilder.keyManager(SslContextBuilder.java:265) ~[netty-all-4.1.18.Final.jar:4.1.18.Final]
... 20 more
I use ssl selfsign certificate and it works fine in version 6.2.2(use docker image docker.elastic.co/logstash/logstash-oss:6.2.2)
Logstash config:
input {
beats {
# The port to listen on for filebeat connections.
port => 5044
# The IP address to listen for filebeat connections.
host => "0.0.0.0"
ssl => true
ssl_certificate_authorities => ["/etc/ca.crt"]
ssl_certificate => "/etc/server.crt"
ssl_key => "/etc/server.key"
ssl_verify_mode => "force_peer"
}
}
To generate certificate I’ve used openssl commands:
openssl genrsa ...
openssl req ...
openssl x509 -req ....
I tried to use «openssl pkcs8 -topk8» to convert key to PKCS8, doesn’t work.
I ran into a similar issue with the http output plugin with ssl certificates.
the configuration file is:
input {
file {
path => some path
start_position => "beginning"
}
}
output {
stdout { codec => rubydebug }
http {
url => some url
cacert => some path
client_cert => some path
client_key => some path
content_type => "application/json"
format => "json_batch"
http_method => "post"
}
}
I initially tried reverting the plugin version of output:http from 5.2.2 to 5.2.0, but that didn’t fix it.
reverting Logstash from 6.4.2 to 6.2.2 fixed the issue for me.
Here is the exception that I received when running 6.4.2:
Exception in thread "Ruby-0-Thread-4: :1" Exception in thread "Ruby-0-Thread-14: :1" java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: IOException : algid parse error, not a sequence at sun.security.rsa.RSAKeyFactory.engineGeneratePrivate(sun/security/rsa/RSAKeyFactory.java:217) at java.security.KeyFactory.generatePrivate(java/security/KeyFactory.java:372) at java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:498) at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(org/jruby/javasupport/JavaMethod.java:423) at org.jruby.javasupport.JavaMethod.invokeDirect(org/jruby/javasupport/JavaMethod.java:290) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.block in setup_key_store(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:681) at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1734) at org.jruby.RubyArray$INVOKER$i$0$0$each.call(org/jruby/RubyArray$INVOKER$i$0$0$each.gen) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.setup_key_store(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:676) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.RUBY$method$setup_key_store$0$__VARARGS__(usr/local/Cellar/logstash/$6_dot_4_dot_2/libexec/vendor/bundle/jruby/$2_dot_3_dot_0/gems/manticore_minus_0_dot_6_dot_4_minus_java/lib/manticore//usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.ssl_socket_factory_from_options(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:622) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.RUBY$method$ssl_socket_factory_from_options$0$__VARARGS__(usr/local/Cellar/logstash/$6_dot_4_dot_2/libexec/vendor/bundle/jruby/$2_dot_3_dot_0/gems/manticore_minus_0_dot_6_dot_4_minus_java/lib/manticore//usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.pool_builder(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:397) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.RUBY$method$pool_builder$0$__VARARGS__(usr/local/Cellar/logstash/$6_dot_4_dot_2/libexec/vendor/bundle/jruby/$2_dot_3_dot_0/gems/manticore_minus_0_dot_6_dot_4_minus_java/lib/manticore//usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.pool(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:405) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.initialize(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:209) at org.jruby.RubyClass.newInstance(org/jruby/RubyClass.java:1022) at org.jruby.RubyClass$INVOKER$i$newInstance.call(org/jruby/RubyClass$INVOKER$i$newInstance.gen) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_mixin_minus_http_client_minus_6_dot_0_dot_1.lib.logstash.plugin_mixins.http_client.make_client(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-mixin-http_client-6.0.1/lib/logstash/plugin_mixins/http_client.rb:180) at RUBY.client(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-mixin-http_client-6.0.1/lib/logstash/plugin_mixins/http_client.rb:185) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_output_minus_http_minus_5_dot_2_dot_0.lib.logstash.outputs.http.send_json_batch(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-output-http-5.2.0/lib/logstash/outputs/http.rb:146) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_output_minus_http_minus_5_dot_2_dot_0.lib.logstash.outputs.http.RUBY$method$send_json_batch$0$__VARARGS__(usr/local/Cellar/logstash/$6_dot_4_dot_2/libexec/vendor/bundle/jruby/$2_dot_3_dot_0/gems/logstash_minus_output_minus_http_minus_5_dot_2_dot_0/lib/logstash/outputs//usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-output-http-5.2.0/lib/logstash/outputs/http.rb) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_output_minus_http_minus_5_dot_2_dot_0.lib.logstash.outputs.http.multi_receive(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-output-http-5.2.0/lib/logstash/outputs/http.rb:122) at org.logstash.config.ir.compiler.OutputStrategyExt$AbstractOutputStrategyExt.invokeOutput(org/logstash/config/ir/compiler/OutputStrategyExt.java:124) at org.logstash.config.ir.compiler.OutputStrategyExt$SimpleAbstractOutputStrategyExt.doOutput(org/logstash/config/ir/compiler/OutputStrategyExt.java:242) at org.logstash.config.ir.compiler.OutputStrategyExt$SharedOutputStrategyExt.output(org/logstash/config/ir/compiler/OutputStrategyExt.java:271) at org.logstash.config.ir.compiler.OutputStrategyExt$AbstractOutputStrategyExt.multi_receive(org/logstash/config/ir/compiler/OutputStrategyExt.java:114) at org.logstash.config.ir.compiler.OutputDelegatorExt.doOutput(org/logstash/config/ir/compiler/OutputDelegatorExt.java:78) at org.logstash.config.ir.compiler.AbstractOutputDelegatorExt.multi_receive(org/logstash/config/ir/compiler/AbstractOutputDelegatorExt.java:97) at org.logstash.config.ir.compiler.AbstractOutputDelegatorExt$INVOKER$i$1$0$multiReceive.call(org/logstash/config/ir/compiler/AbstractOutputDelegatorExt$INVOKER$i$1$0$multiReceive.gen) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.logstash_minus_core.lib.logstash.pipeline.block in output_batch(/usr/local/Cellar/logstash/6.4.2/libexec/logstash-core/lib/logstash/pipeline.rb:373) at org.jruby.RubyHash$12.visit(org/jruby/RubyHash.java:1362) at org.jruby.RubyHash$12.visit(org/jruby/RubyHash.java:1359) at org.jruby.RubyHash.visitLimited(org/jruby/RubyHash.java:662) at org.jruby.RubyHash.visitAll(org/jruby/RubyHash.java:647) at org.jruby.RubyHash.iteratorVisitAll(org/jruby/RubyHash.java:1319) at org.jruby.RubyHash.each_pairCommon(org/jruby/RubyHash.java:1354) at org.jruby.RubyHash.each(org/jruby/RubyHash.java:1343) at org.jruby.RubyHash$INVOKER$i$0$0$each.call(org/jruby/RubyHash$INVOKER$i$0$0$each.gen) at RUBY.output_batch(/usr/local/Cellar/logstash/6.4.2/libexec/logstash-core/lib/logstash/pipeline.rb:372) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.logstash_minus_core.lib.logstash.pipeline.worker_loop(/usr/local/Cellar/logstash/6.4.2/libexec/logstash-core/lib/logstash/pipeline.rb:324) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.logstash_minus_core.lib.logstash.pipeline.RUBY$method$worker_loop$0$__VARARGS__(usr/local/Cellar/logstash/$6_dot_4_dot_2/libexec/logstash_minus_core/lib/logstash//usr/local/Cellar/logstash/6.4.2/libexec/logstash-core/lib/logstash/pipeline.rb) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.logstash_minus_core.lib.logstash.pipeline.block in start_workers(/usr/local/Cellar/logstash/6.4.2/libexec/logstash-core/lib/logstash/pipeline.rb:286) at org.jruby.RubyProc.call(org/jruby/RubyProc.java:289) at org.jruby.RubyProc.call(org/jruby/RubyProc.java:246) at java.lang.Thread.run(java/lang/Thread.java:748) Caused by: java.security.InvalidKeyException: IOException : algid parse error, not a sequence at sun.security.pkcs.PKCS8Key.decode(PKCS8Key.java:352) at sun.security.pkcs.PKCS8Key.decode(PKCS8Key.java:357) at sun.security.rsa.RSAPrivateCrtKeyImpl.<init>(RSAPrivateCrtKeyImpl.java:91) at sun.security.rsa.RSAPrivateCrtKeyImpl.newKey(RSAPrivateCrtKeyImpl.java:75) at sun.security.rsa.RSAKeyFactory.generatePrivate(RSAKeyFactory.java:316) at sun.security.rsa.RSAKeyFactory.engineGeneratePrivate(RSAKeyFactory.java:213) at java.security.KeyFactory.generatePrivate(KeyFactory.java:372) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:423) at org.jruby.javasupport.JavaMethod.invokeDirect(JavaMethod.java:290) at org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:28) at org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:90) at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.RUBY$block$setup_key_store$1(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:681) at org.jruby.runtime.CompiledIRBlockBody.yieldDirect(CompiledIRBlockBody.java:156) at org.jruby.runtime.BlockBody.yield(BlockBody.java:114) at org.jruby.runtime.Block.yield(Block.java:165) at org.jruby.RubyArray.each(RubyArray.java:1734) at org.jruby.RubyArray$INVOKER$i$0$0$each.call(RubyArray$INVOKER$i$0$0$each.gen) at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroBlock.call(JavaMethod.java:498) at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.RUBY$method$setup_key_store$0(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:676) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.RUBY$method$setup_key_store$0$__VARARGS__(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb) at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:77) at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:93) at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.RUBY$method$ssl_socket_factory_from_options$0(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:622) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.RUBY$method$ssl_socket_factory_from_options$0$__VARARGS__(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb) at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:77) at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:93) at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.RUBY$method$pool_builder$0(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:397) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.RUBY$method$pool_builder$0$__VARARGS__(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb) at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:77) at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:93) at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.RUBY$method$pool$0(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:405) at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:77) at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:93) at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.RUBY$method$initialize$0(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:209) at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:77) at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:93) at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:298) at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:79) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83) at org.jruby.RubyClass.newInstance(RubyClass.java:1022) at org.jruby.RubyClass$INVOKER$i$newInstance.call(RubyClass$INVOKER$i$newInstance.gen) at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_mixin_minus_http_client_minus_6_dot_0_dot_1.lib.logstash.plugin_mixins.http_client.RUBY$method$make_client$0(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-mixin-http_client-6.0.1/lib/logstash/plugin_mixins/http_client.rb:180) at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:90) at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:128) at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:192) at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:318) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:131) at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:339) at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73) at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:109) at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:95) at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_output_minus_http_minus_5_dot_2_dot_0.lib.logstash.outputs.http.RUBY$method$send_json_batch$0(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-output-http-5.2.0/lib/logstash/outputs/http.rb:146) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_output_minus_http_minus_5_dot_2_dot_0.lib.logstash.outputs.http.RUBY$method$send_json_batch$0$__VARARGS__(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-output-http-5.2.0/lib/logstash/outputs/http.rb) at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:77) at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:93) at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_output_minus_http_minus_5_dot_2_dot_0.lib.logstash.outputs.http.RUBY$method$multi_receive$0(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-output-http-5.2.0/lib/logstash/outputs/http.rb:122) at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:103) at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:163) at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:200) at org.logstash.config.ir.compiler.OutputStrategyExt$AbstractOutputStrategyExt.invokeOutput(OutputStrategyExt.java:124) at org.logstash.config.ir.compiler.OutputStrategyExt$SimpleAbstractOutputStrategyExt.doOutput(OutputStrategyExt.java:242) at org.logstash.config.ir.compiler.OutputStrategyExt$SharedOutputStrategyExt.output(OutputStrategyExt.java:271) at org.logstash.config.ir.compiler.OutputStrategyExt$AbstractOutputStrategyExt.multiReceive(OutputStrategyExt.java:114) at org.logstash.config.ir.compiler.OutputDelegatorExt.doOutput(OutputDelegatorExt.java:78) at org.logstash.config.ir.compiler.AbstractOutputDelegatorExt.multiReceive(AbstractOutputDelegatorExt.java:97) at org.logstash.config.ir.compiler.AbstractOutputDelegatorExt$INVOKER$i$1$0$multiReceive.call(AbstractOutputDelegatorExt$INVOKER$i$1$0$multiReceive.gen) at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodN.call(JavaMethod.java:739) at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.logstash_minus_core.lib.logstash.pipeline.RUBY$block$output_batch$0(/usr/local/Cellar/logstash/6.4.2/libexec/logstash-core/lib/logstash/pipeline.rb:373) at org.jruby.runtime.CompiledIRBlockBody.yieldDirect(CompiledIRBlockBody.java:156) at org.jruby.runtime.MixedModeIRBlockBody.yieldDirect(MixedModeIRBlockBody.java:122) at org.jruby.runtime.BlockBody.yield(BlockBody.java:114) at org.jruby.runtime.Block.yield(Block.java:165) at org.jruby.RubyHash$12.visit(RubyHash.java:1362) at org.jruby.RubyHash$12.visit(RubyHash.java:1359) at org.jruby.RubyHash.visitLimited(RubyHash.java:662) at org.jruby.RubyHash.visitAll(RubyHash.java:647) at org.jruby.RubyHash.iteratorVisitAll(RubyHash.java:1319) at org.jruby.RubyHash.each_pairCommon(RubyHash.java:1354) at org.jruby.RubyHash.each(RubyHash.java:1343) at org.jruby.RubyHash$INVOKER$i$0$0$each.call(RubyHash$INVOKER$i$0$0$each.gen) at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroBlock.call(JavaMethod.java:498) at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:298) at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:79) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83) at org.jruby.ir.instructions.CallBase.interpret(CallBase.java:428) at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:355) at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73) at org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:89) at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:214) at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:200) at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:208) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.logstash_minus_core.lib.logstash.pipeline.RUBY$method$worker_loop$0(/usr/local/Cellar/logstash/6.4.2/libexec/logstash-core/lib/logstash/pipeline.rb:324) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.logstash_minus_core.lib.logstash.pipeline.RUBY$method$worker_loop$0$__VARARGS__(/usr/local/Cellar/logstash/6.4.2/libexec/logstash-core/lib/logstash/pipeline.rb) at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:77) at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:93) at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.logstash_minus_core.lib.logstash.pipeline.RUBY$block$start_workers$2(/usr/local/Cellar/logstash/6.4.2/libexec/logstash-core/lib/logstash/pipeline.rb:286) at org.jruby.runtime.CompiledIRBlockBody.callDirect(CompiledIRBlockBody.java:145) at org.jruby.runtime.IRBlockBody.call(IRBlockBody.java:71) at org.jruby.runtime.Block.call(Block.java:124) at org.jruby.RubyProc.call(RubyProc.java:289) at org.jruby.RubyProc.call(RubyProc.java:246) at org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:104) at java.lang.Thread.run(Thread.java:748) java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: IOException : algid parse error, not a sequence at sun.security.rsa.RSAKeyFactory.engineGeneratePrivate(sun/security/rsa/RSAKeyFactory.java:217) at java.security.KeyFactory.generatePrivate(java/security/KeyFactory.java:372) at java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:498) at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(org/jruby/javasupport/JavaMethod.java:453) at org.jruby.javasupport.JavaMethod.invokeDirect(org/jruby/javasupport/JavaMethod.java:314) at RUBY.block in setup_key_store(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:681) at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1734) at org.jruby.RubyArray$INVOKER$i$0$0$each.call(org/jruby/RubyArray$INVOKER$i$0$0$each.gen) at RUBY.setup_key_store(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:676) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.ssl_socket_factory_from_options(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:622) at RUBY.pool_builder(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:397) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.pool(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:405) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.initialize(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:209) at org.jruby.RubyClass.newInstance(org/jruby/RubyClass.java:1001) at org.jruby.RubyClass$INVOKER$i$newInstance.call(org/jruby/RubyClass$INVOKER$i$newInstance.gen) at RUBY.make_client(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-mixin-http_client-6.0.1/lib/logstash/plugin_mixins/http_client.rb:180) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_mixin_minus_http_client_minus_6_dot_0_dot_1.lib.logstash.plugin_mixins.http_client.client(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-mixin-http_client-6.0.1/lib/logstash/plugin_mixins/http_client.rb:185) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_mixin_minus_http_client_minus_6_dot_0_dot_1.lib.logstash.plugin_mixins.http_client.RUBY$method$client$0$__VARARGS__(usr/local/Cellar/logstash/$6_dot_4_dot_2/libexec/vendor/bundle/jruby/$2_dot_3_dot_0/gems/logstash_minus_mixin_minus_http_client_minus_6_dot_0_dot_1/lib/logstash/plugin_mixins//usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-mixin-http_client-6.0.1/lib/logstash/plugin_mixins/http_client.rb) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_output_minus_http_minus_5_dot_2_dot_0.lib.logstash.outputs.http.send_json_batch(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-output-http-5.2.0/lib/logstash/outputs/http.rb:146) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_output_minus_http_minus_5_dot_2_dot_0.lib.logstash.outputs.http.RUBY$method$send_json_batch$0$__VARARGS__(usr/local/Cellar/logstash/$6_dot_4_dot_2/libexec/vendor/bundle/jruby/$2_dot_3_dot_0/gems/logstash_minus_output_minus_http_minus_5_dot_2_dot_0/lib/logstash/outputs//usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-output-http-5.2.0/lib/logstash/outputs/http.rb) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_output_minus_http_minus_5_dot_2_dot_0.lib.logstash.outputs.http.multi_receive(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-output-http-5.2.0/lib/logstash/outputs/http.rb:122) at org.logstash.config.ir.compiler.OutputStrategyExt$AbstractOutputStrategyExt.invokeOutput(org/logstash/config/ir/compiler/OutputStrategyExt.java:124) at org.logstash.config.ir.compiler.OutputStrategyExt$SimpleAbstractOutputStrategyExt.doOutput(org/logstash/config/ir/compiler/OutputStrategyExt.java:242) at org.logstash.config.ir.compiler.OutputStrategyExt$SharedOutputStrategyExt.output(org/logstash/config/ir/compiler/OutputStrategyExt.java:271) at org.logstash.config.ir.compiler.OutputStrategyExt$AbstractOutputStrategyExt.multi_receive(org/logstash/config/ir/compiler/OutputStrategyExt.java:114) at org.logstash.config.ir.compiler.OutputDelegatorExt.doOutput(org/logstash/config/ir/compiler/OutputDelegatorExt.java:78) at org.logstash.config.ir.compiler.AbstractOutputDelegatorExt.multi_receive(org/logstash/config/ir/compiler/AbstractOutputDelegatorExt.java:97) at org.logstash.config.ir.compiler.AbstractOutputDelegatorExt$INVOKER$i$1$0$multiReceive.call(org/logstash/config/ir/compiler/AbstractOutputDelegatorExt$INVOKER$i$1$0$multiReceive.gen) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.logstash_minus_core.lib.logstash.pipeline.block in output_batch(/usr/local/Cellar/logstash/6.4.2/libexec/logstash-core/lib/logstash/pipeline.rb:373) at org.jruby.RubyHash$12.visit(org/jruby/RubyHash.java:1362) at org.jruby.RubyHash$12.visit(org/jruby/RubyHash.java:1359) at org.jruby.RubyHash.visitLimited(org/jruby/RubyHash.java:662) at org.jruby.RubyHash.visitAll(org/jruby/RubyHash.java:647) at org.jruby.RubyHash.iteratorVisitAll(org/jruby/RubyHash.java:1319) at org.jruby.RubyHash.each_pairCommon(org/jruby/RubyHash.java:1354) at org.jruby.RubyHash.each(org/jruby/RubyHash.java:1343) at org.jruby.RubyHash$INVOKER$i$0$0$each.call(org/jruby/RubyHash$INVOKER$i$0$0$each.gen) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.logstash_minus_core.lib.logstash.pipeline.output_batch(/usr/local/Cellar/logstash/6.4.2/libexec/logstash-core/lib/logstash/pipeline.rb:372) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.logstash_minus_core.lib.logstash.pipeline.RUBY$method$output_batch$0$__VARARGS__(usr/local/Cellar/logstash/$6_dot_4_dot_2/libexec/logstash_minus_core/lib/logstash//usr/local/Cellar/logstash/6.4.2/libexec/logstash-core/lib/logstash/pipeline.rb) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.logstash_minus_core.lib.logstash.pipeline.worker_loop(/usr/local/Cellar/logstash/6.4.2/libexec/logstash-core/lib/logstash/pipeline.rb:324) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.logstash_minus_core.lib.logstash.pipeline.block in start_workers(/usr/local/Cellar/logstash/6.4.2/libexec/logstash-core/lib/logstash/pipeline.rb:286) at org.jruby.RubyProc.call(org/jruby/RubyProc.java:289) at org.jruby.RubyProc.call(org/jruby/RubyProc.java:246) at java.lang.Thread.run(java/lang/Thread.java:748) Caused by: java.security.InvalidKeyException: IOException : algid parse error, not a sequence at sun.security.pkcs.PKCS8Key.decode(PKCS8Key.java:352) at sun.security.pkcs.PKCS8Key.decode(PKCS8Key.java:357) at sun.security.rsa.RSAPrivateCrtKeyImpl.<init>(RSAPrivateCrtKeyImpl.java:91) at sun.security.rsa.RSAPrivateCrtKeyImpl.newKey(RSAPrivateCrtKeyImpl.java:75) at sun.security.rsa.RSAKeyFactory.generatePrivate(RSAKeyFactory.java:316) at sun.security.rsa.RSAKeyFactory.engineGeneratePrivate(RSAKeyFactory.java:213) at java.security.KeyFactory.generatePrivate(KeyFactory.java:372) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:453) at org.jruby.javasupport.JavaMethod.invokeDirect(JavaMethod.java:314) at org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:46) at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:338) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:163) at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:314) at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73) at org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:132) at org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:148) at org.jruby.runtime.IRBlockBody.doYield(IRBlockBody.java:186) at org.jruby.runtime.BlockBody.yield(BlockBody.java:116) at org.jruby.runtime.Block.yield(Block.java:165) at org.jruby.RubyArray.each(RubyArray.java:1734) at org.jruby.RubyArray$INVOKER$i$0$0$each.call(RubyArray$INVOKER$i$0$0$each.gen) at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroBlock.call(JavaMethod.java:498) at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:298) at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:79) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83) at org.jruby.ir.instructions.CallBase.interpret(CallBase.java:428) at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:355) at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73) at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:109) at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:95) at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.RUBY$method$ssl_socket_factory_from_options$0(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:622) at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:103) at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:163) at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:200) at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:338) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:163) at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:314) at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73) at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:109) at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:95) at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.RUBY$method$pool$0(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:405) at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:77) at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:93) at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.manticore_minus_0_dot_6_dot_4_minus_java.lib.manticore.client.RUBY$method$initialize$0(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:209) at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:77) at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:100) at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:163) at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:348) at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:173) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:177) at org.jruby.RubyClass.newInstance(RubyClass.java:1001) at org.jruby.RubyClass$INVOKER$i$newInstance.call(RubyClass$INVOKER$i$newInstance.gen) at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:200) at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:338) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:163) at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:314) at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73) at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:109) at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:95) at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_mixin_minus_http_client_minus_6_dot_0_dot_1.lib.logstash.plugin_mixins.http_client.RUBY$method$client$0(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-mixin-http_client-6.0.1/lib/logstash/plugin_mixins/http_client.rb:185) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_mixin_minus_http_client_minus_6_dot_0_dot_1.lib.logstash.plugin_mixins.http_client.RUBY$method$client$0$__VARARGS__(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-mixin-http_client-6.0.1/lib/logstash/plugin_mixins/http_client.rb) at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:77) at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:93) at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_output_minus_http_minus_5_dot_2_dot_0.lib.logstash.outputs.http.RUBY$method$send_json_batch$0(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-output-http-5.2.0/lib/logstash/outputs/http.rb:146) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_output_minus_http_minus_5_dot_2_dot_0.lib.logstash.outputs.http.RUBY$method$send_json_batch$0$__VARARGS__(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-output-http-5.2.0/lib/logstash/outputs/http.rb) at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:77) at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:93) at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_output_minus_http_minus_5_dot_2_dot_0.lib.logstash.outputs.http.RUBY$method$multi_receive$0(/usr/local/Cellar/logstash/6.4.2/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-output-http-5.2.0/lib/logstash/outputs/http.rb:122) at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:103) at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:163) at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:200) at org.logstash.config.ir.compiler.OutputStrategyExt$AbstractOutputStrategyExt.invokeOutput(OutputStrategyExt.java:124) at org.logstash.config.ir.compiler.OutputStrategyExt$SimpleAbstractOutputStrategyExt.doOutput(OutputStrategyExt.java:242) at org.logstash.config.ir.compiler.OutputStrategyExt$SharedOutputStrategyExt.output(OutputStrategyExt.java:271) at org.logstash.config.ir.compiler.OutputStrategyExt$AbstractOutputStrategyExt.multiReceive(OutputStrategyExt.java:114) at org.logstash.config.ir.compiler.OutputDelegatorExt.doOutput(OutputDelegatorExt.java:78) at org.logstash.config.ir.compiler.AbstractOutputDelegatorExt.multiReceive(AbstractOutputDelegatorExt.java:97) at org.logstash.config.ir.compiler.AbstractOutputDelegatorExt$INVOKER$i$1$0$multiReceive.call(AbstractOutputDelegatorExt$INVOKER$i$1$0$multiReceive.gen) at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodN.call(JavaMethod.java:739) at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.logstash_minus_core.lib.logstash.pipeline.RUBY$block$output_batch$3(/usr/local/Cellar/logstash/6.4.2/libexec/logstash-core/lib/logstash/pipeline.rb:373) at org.jruby.runtime.CompiledIRBlockBody.yieldDirect(CompiledIRBlockBody.java:156) at org.jruby.runtime.BlockBody.yield(BlockBody.java:114) at org.jruby.runtime.Block.yield(Block.java:165) at org.jruby.RubyHash$12.visit(RubyHash.java:1362) at org.jruby.RubyHash$12.visit(RubyHash.java:1359) at org.jruby.RubyHash.visitLimited(RubyHash.java:662) at org.jruby.RubyHash.visitAll(RubyHash.java:647) at org.jruby.RubyHash.iteratorVisitAll(RubyHash.java:1319) at org.jruby.RubyHash.each_pairCommon(RubyHash.java:1354) at org.jruby.RubyHash.each(RubyHash.java:1343) at org.jruby.RubyHash$INVOKER$i$0$0$each.call(RubyHash$INVOKER$i$0$0$each.gen) at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroBlock.call(JavaMethod.java:498) at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.logstash_minus_core.lib.logstash.pipeline.RUBY$method$output_batch$0(/usr/local/Cellar/logstash/6.4.2/libexec/logstash-core/lib/logstash/pipeline.rb:372) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.logstash_minus_core.lib.logstash.pipeline.RUBY$method$output_batch$0$__VARARGS__(/usr/local/Cellar/logstash/6.4.2/libexec/logstash-core/lib/logstash/pipeline.rb) at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:77) at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:93) at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.logstash_minus_core.lib.logstash.pipeline.RUBY$method$worker_loop$0(/usr/local/Cellar/logstash/6.4.2/libexec/logstash-core/lib/logstash/pipeline.rb:324) at usr.local.Cellar.logstash.$6_dot_4_dot_2.libexec.logstash_minus_core.lib.logstash.pipeline.RUBY$block$start_workers$2(/usr/local/Cellar/logstash/6.4.2/libexec/logstash-core/lib/logstash/pipeline.rb:286) at org.jruby.runtime.CompiledIRBlockBody.callDirect(CompiledIRBlockBody.java:145) at org.jruby.runtime.IRBlockBody.call(IRBlockBody.java:71) at org.jruby.runtime.Block.call(Block.java:124) at org.jruby.RubyProc.call(RubyProc.java:289) at org.jruby.RubyProc.call(RubyProc.java:246) at org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:104) at java.lang.Thread.run(Thread.java:748)
Problem has been fixed (check on version 6.4.2) using converting private key to PKCS8 format using command:
openssl pkcs8 -topk8 -inform pem -in privatekey.key -outform pem -nocrypt -out privatekey_p8.key
Still the same issue with RSA keys… Problem fixed using PKCS8…
pedroluislopez
added a commit
to Neuromobile/debops
that referenced
this issue
Aug 4, 2020
Signed-off-by: Pedro Luis López Sánchez <plopez@neuromobilemarketing.com>
To get a private key, you need to decrypt the encrypted data. I can’t figure it out. When I get the privatekey, I report an error algid parse error, not a sequence
KeyFactory.getInstance("RSA").generatePrivate(
new PKCS8EncodedKeySpec(Encodes.decodeBase64("priKey")))
The reason is that the private key string is not in PKCs #8’s format and cannot be transferred without using a third-party jar
One solution is to use OpenSSL to convert the private key string into pkcs#8 format
The second is to use the third-party library. I use the third-party library bouncy castle, which is more convenient and fast. I don’t bother to install OpenSSL
pom:
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.59</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcmail-jdk15on</artifactId>
<version>1.59</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.59</version>
</dependency>
Restore private/public key to PEM file
public static PrivateKey get10027504355PrivateKey() throws Exception {
BufferedReader br=new BufferedReader(new InputStreamReader(ClassLoader.getSystemResourceAsStream("config/10027504355ssl.pem")));
PEMParser pemParser = new PEMParser(br);
PEMKeyPair pemKeyPair = (PEMKeyPair)pemParser.readObject();
pemParser.close();
JcaPEMKeyConverter converter = new JcaPEMKeyConverter();
KeyPair keyPair = converter.getKeyPair(pemKeyPair);
PublicKey publicKey=keyPair.getPublic();
return keyPair.getPrivate();
}
Add bouncycastleprovider when the application starts and initialize it once
package com.mktpay.admin.init;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import java.security.Security;
/**
* @ClassName Runner
* @Author yupanpan
* @Date 2021/10/11 15:03
*/
@Component
public class EDncryptRunner implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
//Customize other ways to initialize encryption and decryption algorithms
Security.addProvider(new BouncyCastleProvider());
}
}
Read More:
1. Возникающие ошибки
Об этой ошибке было сообщено сегодня при подписании с RSA:
java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: IOException : algid parse error, not a sequence
at sun.security.rsa.RSAKeyFactory.engineGeneratePrivate(RSAKeyFactory.java:217)
at java.security.KeyFactory.generatePrivate(KeyFactory.java:372)
at com.iapppay.sign.RSA.sign(RSA.java:64)
at com.iapppay.sign.SignHelper.sign(SignHelper.java:16)
at com.iapppay.demo.CheckLogin.ReqData(CheckLogin.java:37)
at com.iapppay.demo.CheckLogin.CheckToken(CheckLogin.java:45)
at com.iapppay.demo.CheckLogin.main(CheckLogin.java:96)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.security.InvalidKeyException: IOException : algid parse error, not a sequence
at sun.security.pkcs.PKCS8Key.decode(PKCS8Key.java:351)
at sun.security.pkcs.PKCS8Key.decode(PKCS8Key.java:356)
at sun.security.rsa.RSAPrivateCrtKeyImpl.<init>(RSAPrivateCrtKeyImpl.java:91)
at sun.security.rsa.RSAPrivateCrtKeyImpl.newKey(RSAPrivateCrtKeyImpl.java:75)
at sun.security.rsa.RSAKeyFactory.generatePrivate(RSAKeyFactory.java:316)
at sun.security.rsa.RSAKeyFactory.engineGeneratePrivate(RSAKeyFactory.java:213)
... 11 more
Во-вторых, причина и решение ошибки.
Оказывается, формат ключа неверный. Ключ надо преобразовать в формат pkcs8 (обычно этот формат используется для подписей rsa в java). Вы можете запросить канал для ключа в этом формате, конечно, можно также преобразовать его самостоятельно
Его можно преобразовать на машине Linux: (pkcs1 — это традиционный формат закрытого ключа, а сгенерированный ключ обычно имеет формат pkcs1)
1. Преобразуйте pkcs1 в pkcs8.
openssl pkcs8 -topk8 -inform PEM -in private.key -outform pem -nocrypt -out pkcs8.pem
Вышеупомянутая команда предназначена для преобразования закрытого ключа в файле private.key в формат pkcs8 и вывода в файл pkcs8.pem
2. Преобразуйте pkcs1 в pkcs8.
openssl pkcs8 -in pkcs8.pem -nocrypt -out pri_key.pem
Три, обратите внимание
У ключей, сгенерированных openssl, есть голова и хвост,
Поэтому не забудьте добавить заголовок и конец к ключевому контенту во время преобразования, иначе будет сообщено об ошибке.
Формат pkcs1:
-----BEGIN RSA PRIVATE KEY-----
MIICXgIBAAKBgQC/q5nnXQ4bN4U2+pGEksf3OBy9ibl6Dhcienp8MPJTRQRKfALF
PHBMon/hq8KHwsMrJZBlpxNOWECQQDlHWJKNes9MiP5
KThdGv+1UnPJ5zVtjoa4wYDUDvpjVymlH4agRadsJyVgeAbZrDicrjQ9JHtC3D2R
YnQHn73tAkEA1iliXR3wp7e9TiceQ4OLTfFlEpxjGQW2Juk2f8Fen+rmtJ056eSg
ITdYptrz9OxNblfpNG4Ow8Pg/t4opXqRpwJBAIcXRkcfd67Di7Zz+YncS32sOh2I
OFZ6vTDe14kxs60zTZjQ9940c70vb7hrzQ43n8GybZbHle4cUikQ9f0w0RkCQQCG
GOuqerDRk89JPF1K0PdNGrW67YlvhZAE1Up2vFHPuHo05a35slpB8jHkaH0RA1WI
nis71R4RnnknnVu+If1JAkEAhRK3NoMbs/X6YHjHcGYXHT/nvRKmTLVNz4ILiZP5
SKMJMOWQjwBuzpssMSG6oygrIK/X/hD/kcVtvb7TtL4I4Q==
-----END RSA PRIVATE KEY-----
Формат pkcs2:
-----BEGIN PRIVATE KEY-----
MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAL+rmeddDhs3hTb6
kYSSx/c4HL2JuXoOFyJ6enww8lNFBEp8AsU8cEyiY8lOomOGYdMQVgBibYsHBCy3
wFWv6L7nO+NWYAUSnXj5SJ+6jjl+nbKwVLVXih7rQhq5wW3r+0CaCIp7BnHNNe8A
yNvOkPUFuP5CidAefve0CQQDWKWJdHfCnt71OJx5D
g4tN8WUSnGMZBbYm6TZ/wV6f6ua0nTnp5KAhN1im2vP07E1uV+k0bg7Dw+D+3iil
epGnAkEAhxdGRx93rsOLtnP5idxLfaw6HYg4Vnq9MN7XiTGzrTNNmND33jRzvS9v
uGvNDjefwbJtlseV7hxSKRD1/TDRGQJBAIYY66p6sNGTz0k8XUrQ900atbrtiW+F
kATVSna8Uc+4ejTlrfmyWkHyMeRofREDVYieKzvVHhGeeSedW74h/UkCQQCFErc2
gxuz9fpgeMdwZhcdP+e9EqZMtU3PgguJk/lIowkw5ZCPAG7OmywxIbqjKCsgr9f+
EP+RxW29vtO0vgjh
-----END PRIVATE KEY-----