'BouncyCastle function (JcaPEMKeyConverter) hanging somewhere
So I have the code below and when debugging in IntelliJ, it seems to hang after executing this line
JcaPEMKeyConverter converter = new JcaPEMKeyConverter()
Any ideas what could be wrong?
try {
//I have a breakpoint on the line below (Object object...)
Object object = (Object) ContentUtils.readFileReturnAsInputStream(request, publicKeyPath);
JcaPEMKeyConverter converter = new JcaPEMKeyConverter();
//never goes to the line below
converter = converter.setProvider("BC"); //never gets to this p
PublicKey key2 = converter.getPublicKey((SubjectPublicKeyInfo) object);
return key1;
} catch (Exception e) {
throw new IOException();
}
I loaded the libraries by adding these into my pom file
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.51</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.51</version>
</dependency>
and then I can see the following libraries were downloaded locally.
➜ ls -al ~/.m2/repository/org/bouncycastle/
0755 - myuser 11 Apr 11:37 bcpkix-jdk15on
0755 - myuser 11 Apr 11:37 bcprov-jdk15on
0755 - myuser 11 Apr 11:20 bcutil-jdk15on
➜ ls -al ~/.m2/repository/org/bouncycastle/bcpkix-jdk15on/1.51
0644 207 myuser 11 Apr 11:37 _remote.repositories
0644 606k myuser 11 Apr 11:37 bcpkix-jdk15on-1.51.jar
0644 345 myuser 11 Apr 11:37 bcpkix-jdk15on-1.51.jar.lastUpdated
0644 40 myuser 11 Apr 11:37 bcpkix-jdk15on-1.51.jar.sha1
0644 1.5k myuser 11 Apr 11:37 bcpkix-jdk15on-1.51.pom
0644 345 myuser 11 Apr 11:37 bcpkix-jdk15on-1.51.pom.lastUpdated
0644 40 myuser 11 Apr 11:37 bcpkix-jdk15on-1.51.pom.sha1
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
