You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+64Lines changed: 64 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,9 @@ Description of utilising Spring Boot
37
37
38
38
1)[Misc](#misc)
39
39
40
+
1)[Known Issues](#known-issues)-
41
+
Known issues using the libraries
42
+
40
43
1)[Support](#support)-
41
44
Please feel free to reach out
42
45
@@ -215,6 +218,67 @@ For more information and to see an example of this in use take a look at the Spr
215
218
If necessary, this can be overridden by setting the `yoti.api.url` system property.
216
219
* Yoti Java SDK uses AES-256 encryption. If you are using the Oracle JDK, this key length is not enabled by default. The following stack overflow question explains how to fix this: [http://stackoverflow.com/questions/6481627/java-security-illegal-key-size-or-default-parameters](http://stackoverflow.com/questions/6481627/java-security-illegal-key-size-or-default-parameters)
217
220
* To find out how to set up your Java project in order to use this SDK, you can check the Spring Boot example in this repo.
221
+
222
+
## Known Issues
223
+
224
+
### Loading Private Keys
225
+
226
+
#### Affects
227
+
228
+
* Version 1.1 onwards.
229
+
230
+
#### Description
231
+
232
+
There was a known issue with the encoding of RSA private key PEM files that were issued in the past by Yoti Dashboard (most likely where you downloaded the private key for your application).
233
+
234
+
Some software is more accepting that others and will have been able to cope with the incorrect encoding, whereas some stricter libraries will not accept this encoding.
235
+
236
+
At version `1.1` of this client the Java Security Provider that we use (`Bouncy Castle`) was [upgraded](https://www.bouncycastle.org/releasenotes.html) from `1.51` -> `1.57`. This upgrade appears to have made the key parser more strict in terms of encoding since it no longer accepts these incorrectly encoded keys.
237
+
238
+
#### Symptoms
239
+
240
+
This error usually manifests itself when constructing and instance of the Yoti Client to read the private key.
241
+
242
+
Generally you'll see an error message and stack trace as follows:
at com.yoti.api.client.spi.remote.SecureYotiClient.loadKeyPair(SecureYotiClient.java:99)
247
+
at com.yoti.api.client.spi.remote.SecureYotiClient.<init>(SecureYotiClient.java:73)
248
+
at com.yoti.api.client.spi.remote.SecureYotiClientFactory.getInstance(SecureYotiClientFactory.java:25)
249
+
at com.yoti.api.client.ServiceLocatorYotiClientBuilder.build(ServiceLocatorYotiClientBuilder.java:40)
250
+
at com.yoti.api.spring.YotiClientAutoConfiguration.yotiClient(YotiClientAutoConfiguration.java:48)
251
+
252
+
Caused by:org.bouncycastle.openssl.PEMException: problem creating RSAprivate key:java.lang.IllegalArgumentException: failed to construct sequence from byte[]: corrupted stream detected
253
+
at org.bouncycastle.openssl.PEMParser$KeyPairParser.parseObject(UnknownSource)
254
+
at org.bouncycastle.openssl.PEMParser.readObject(UnknownSource)
255
+
at com.yoti.api.client.spi.remote.SecureYotiClient$KeyStreamVisitor.findKeyPair(SecureYotiClient.java:269)
256
+
at com.yoti.api.client.spi.remote.SecureYotiClient$KeyStreamVisitor.accept(SecureYotiClient.java:260)
257
+
at com.yoti.api.spring.SpringResourceKeyPairSource.getFromStream(SpringResourceKeyPairSource.java:28)
258
+
at com.yoti.api.client.spi.remote.SecureYotiClient.loadKeyPair(SecureYotiClient.java:97)
259
+
...52 common frames omitted
260
+
261
+
Caused by:org.bouncycastle.openssl.PEMException: problem creating RSAprivate key:java.lang.IllegalArgumentException: failed to construct sequence from byte[]: corrupted stream detected
262
+
at org.bouncycastle.openssl.PEMParser$RSAKeyPairParser.parse(UnknownSource)
263
+
...58 common frames omitted
264
+
265
+
Caused by:java.lang.IllegalArgumentException: failed to construct sequence from byte[]: corrupted stream detected
266
+
at org.bouncycastle.asn1.ASN1Sequence.getInstance(UnknownSource)
267
+
...59 common frames omitted
268
+
```
269
+
270
+
#### How To Fix
271
+
272
+
You can re-encode the badly encoded PEM file using some software that is more accepting of the incorrect encoding and saving the new key.
273
+
274
+
An example of software able to do this is `OpenSSL` versions `1.0.2g` and `1.1.0` using the command:
0 commit comments