Skip to content

Commit 4c2c0a5

Browse files
Adding comment about sun classes usage and using a constant for empty byte array
1 parent 9d86ce2 commit 4c2c0a5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/main/java/com/amazonaws/encryptionsdk/internal/Utils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.util.WeakHashMap;
2525
import java.util.concurrent.atomic.AtomicLong;
2626

27+
import org.apache.commons.lang3.ArrayUtils;
2728
import org.bouncycastle.util.encoders.Base64;
2829

2930
/**
@@ -268,7 +269,7 @@ public static ByteBuffer limit(final ByteBuffer buff, final int newLimit) {
268269
* @return decoded data as a byte array
269270
*/
270271
public static byte[] decodeBase64String(final String encoded) {
271-
return encoded.isEmpty() ? new byte[0] : Base64.decode(encoded);
272+
return encoded.isEmpty() ? ArrayUtils.EMPTY_BYTE_ARRAY : Base64.decode(encoded);
272273
}
273274

274275
/**

src/test/java/com/amazonaws/encryptionsdk/jce/KeyStoreProviderTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
import com.amazonaws.encryptionsdk.MasterKeyProvider;
4444
import com.amazonaws.encryptionsdk.exception.CannotUnwrapDataKeyException;
4545
import com.amazonaws.encryptionsdk.multi.MultipleProviderFactory;
46+
47+
/* These internal sun classes are included solely for test purposes as
48+
this test cannot use BouncyCastle cert generation, as there are incompatibilities
49+
between how standard BC and FIPS BC perform cert generation. */
4650
import sun.security.x509.AlgorithmId;
4751
import sun.security.x509.CertificateAlgorithmId;
4852
import sun.security.x509.CertificateSerialNumber;

0 commit comments

Comments
 (0)