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
+31-17Lines changed: 31 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -265,30 +265,44 @@ Javadocs are generated when `gradle javadoc` is run and can be found in
265
265
266
266
## FIPS 140-2 Compliance
267
267
268
-
The Box Java SDK uses libraries (`org.bouncycastle:bcpkix-jdk15on:1.57` and `org.bouncycastle:bcprov-jdk15on:1.57`) that are compatible with FIPS 140-2 validated cryptographic libraries (`org.bouncycastle:bc-fips:1.0.2.1`).
268
+
To generate a Json Web Signature used for retrieving tokens in the JWT authentication method, the Box Java SDK decrypts an encrypted private key.
269
+
For this purpose, Box Java SDK uses libraries (`org.bouncycastle:bcpkix-jdk15on:1.70` and `org.bouncycastle:bcprov-jdk15on:1.70`)
270
+
that are NOT compatible with FIPS 140-2 validated cryptographic library (`org.bouncycastle:bc-fips`).
269
271
270
-
### Vulnerabilities in Bouncycastle libraries
271
-
In Box Java SDK we are using:
272
-
-`org.bouncycastle:bcpkix-jdk15on:1.57`
273
-
-`org.bouncycastle:bcprov-jdk15on:1.57`
272
+
There are two ways of ensuring that decryption operation is FIPS-compiant.
274
273
275
-
There are some moderate vulnerabilities reported against those versions:
274
+
1. You can provide a custom implementation of the `IPrivateKeyDecryptor` interface,
275
+
which performs the decryption operation using FIPS-certified library of your choice. The interface requires the
After implementing the custom decryptor, you need to set your custom decryptor class in the Box Config.
281
+
Below is an example of setting up a `BoxDeveloperEditionAPIConnection` with a config file and the custom decryptor.
282
+
```java
283
+
Reader reader =newFileReader(JWT_CONFIG_PATH);
284
+
BoxConfig boxConfig =BoxConfig.readFrom(reader);
285
+
boxConfig.setPrivateKeyDecryptor(customDecryptor)
286
+
BoxDeveloperEditionAPIConnection api =BoxDeveloperEditionAPIConnection.getAppEnterpriseConnection(boxConfig);
287
+
```
288
+
289
+
2. Alternative method is to override the Bouncy Castle libraries to the v.1.57 version,
290
+
which are compatible with the FIPS 140-2 validated cryptographic library (`org.bouncycastle:bc-fips`).
291
+
292
+
NOTE: This solution is not recommended as Bouncy Castle v.1.57 has some moderate vulnerabilities reported against those versions, including:
276
293
-[CVE-2020-26939](https://github.com/advisories/GHSA-72m5-fvvv-55m6) - Observable Differences in Behavior to Error Inputs in Bouncy Castle
277
294
-[CVE-2020-15522](https://github.com/advisories/GHSA-6xx3-rg99-gc3p) - Timing based private key exposure in Bouncy Castle
278
295
279
-
We cannot upgrade those libraries as they are working with [FIPS 140-2 certified](https://csrc.nist.gov/projects/cryptographic-module-validation-program/certificate/3514)
280
-
cryptographic module. Some of our customers require certified cryptography module and our SDK must work with it.
281
-
282
-
If you want to use modern `bcpkix-jdk15on` and `bcprov-jdk15on` than you can exclude them while importing Java Box SDK and provide you own versions:
296
+
Furthermore,using Bouncy Castle v.1.57 may lead to [Bouncycastle BadPaddingException for JWT auth](#bouncycastle-badPaddingException-for-jWT-auth).
As of October 2023, RSA keypairs generated on the Developer Console (refer to the [Generate a keypair guide](https://developer.box.com/guides/authentication/jwt/jwt-setup/#generate-a-keypair-recommended))
331
-
are no longer compatible with Bouncy Castle version 1.57, which is utilized in the Box Java SDK.
345
+
are no longer compatible with Bouncy Castle version 1.57, which was utilized in the Box Java SDK up to v4.6.1.
332
346
Attempting to use a JWT configuration downloaded from the Developer Console results in a
333
347
`javax.crypto.BadPaddingException: pad block corrupted` error.
334
-
While we continue our efforts to address this issue, two possible workarounds are available:
335
-
1.Override the Bouncy Castle library version with a newer one, following the steps described above.
348
+
Prossible solutions:
349
+
1.Upgrade to the v4.7.0 of Box Java SDK, which uses newer version of the Bouncy Castle library. (recommended)
336
350
2. Manually generate a keypair using OpenSSL version 1.0.x and add the Public Key to the Developer Console.
337
351
The [manually add keypair guide](https://developer.box.com/guides/authentication/jwt/jwt-setup/#manually-add-keypair) provides assistance in this process.
0 commit comments