Skip to content

Commit ba8a32f

Browse files
dreis2211snicoll
authored andcommitted
Replace commons-codec Base64 usage
See gh-13378
1 parent e3bf518 commit ba8a32f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveTokenValidatorTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,7 +29,6 @@
2929
import java.util.Map;
3030
import java.util.concurrent.ConcurrentHashMap;
3131

32-
import org.apache.commons.codec.binary.Base64;
3332
import org.junit.Before;
3433
import org.junit.Test;
3534
import org.mockito.Mock;
@@ -337,7 +336,8 @@ private PrivateKey getPrivateKey()
337336
+ "J/OOn5zOs8yf26os0q3+JUM=\n-----END PRIVATE KEY-----";
338337
String privateKey = signingKey.replace("-----BEGIN PRIVATE KEY-----\n", "");
339338
privateKey = privateKey.replace("-----END PRIVATE KEY-----", "");
340-
byte[] pkcs8EncodedBytes = Base64.decodeBase64(privateKey);
339+
privateKey = privateKey.replace("\n", "");
340+
byte[] pkcs8EncodedBytes = Base64Utils.decodeFromString(privateKey);
341341
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(pkcs8EncodedBytes);
342342
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
343343
return keyFactory.generatePrivate(keySpec);

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/TokenValidatorTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,7 +28,6 @@
2828
import java.util.Collections;
2929
import java.util.Map;
3030

31-
import org.apache.commons.codec.binary.Base64;
3231
import org.junit.Before;
3332
import org.junit.Rule;
3433
import org.junit.Test;
@@ -248,7 +247,8 @@ private PrivateKey getPrivateKey()
248247
+ "J/OOn5zOs8yf26os0q3+JUM=\n-----END PRIVATE KEY-----";
249248
String privateKey = signingKey.replace("-----BEGIN PRIVATE KEY-----\n", "");
250249
privateKey = privateKey.replace("-----END PRIVATE KEY-----", "");
251-
byte[] pkcs8EncodedBytes = Base64.decodeBase64(privateKey);
250+
privateKey = privateKey.replace("\n", "");
251+
byte[] pkcs8EncodedBytes = Base64Utils.decodeFromString(privateKey);
252252
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(pkcs8EncodedBytes);
253253
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
254254
return keyFactory.generatePrivate(keySpec);

0 commit comments

Comments
 (0)