Skip to content

Commit d5aef09

Browse files
committed
upgraded other dependencies
1 parent 2ee0da8 commit d5aef09

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

build.gradle

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55

66
dependencies {
77
// https://github.com/melix/japicmp-gradle-plugin/issues/36
8-
classpath 'com.google.guava:guava:31.1-jre'
8+
classpath 'com.google.guava:guava:32.0.1-jre'
99
}
1010
}
1111

@@ -121,21 +121,20 @@ test {
121121

122122
dependencies {
123123
implementation 'javax.servlet:javax.servlet-api:3.1.0'
124-
implementation 'org.apache.commons:commons-lang3:3.12.0'
125-
implementation 'com.google.guava:guava-annotations:r03'
124+
implementation 'org.apache.commons:commons-lang3:3.13.0'
125+
implementation 'com.google.guava:guava:32.0.1-jre'
126126
implementation 'commons-codec:commons-codec:1.15'
127127

128128
api 'com.auth0:auth0:1.45.1'
129129
api 'com.auth0:java-jwt:4.5.0'
130130
api 'com.auth0:jwks-rsa:0.22.1'
131131

132-
testImplementation 'org.bouncycastle:bcprov-jdk15on:1.64'
133-
testImplementation 'org.hamcrest:java-hamcrest:2.0.0.0'
134-
testImplementation 'org.hamcrest:hamcrest-core:1.3'
135-
testImplementation 'org.mockito:mockito-core:2.8.9'
132+
testImplementation 'org.hamcrest:hamcrest:2.2'
133+
testImplementation 'org.mockito:mockito-core:4.8.1'
136134
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
137135
testImplementation 'org.springframework:spring-test:4.3.14.RELEASE'
138-
testImplementation 'com.squareup.okhttp3:okhttp:4.11.0'
136+
testImplementation 'com.squareup.okhttp3:okhttp:4.12.0'
137+
testImplementation "com.squareup.okio:okio:3.5.0"
139138
}
140139

141140
apply from: rootProject.file('gradle/maven-publish.gradle')

src/test/java/com/auth0/SignatureVerifierTest.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
import com.auth0.jwk.JwkException;
55
import com.auth0.jwk.JwkProvider;
66
import com.auth0.jwt.interfaces.DecodedJWT;
7-
import org.bouncycastle.util.io.pem.PemReader;
87
import org.junit.jupiter.api.Test;
98

9+
import java.io.BufferedReader;
1010
import java.io.FileInputStream;
1111
import java.io.FileReader;
1212
import java.io.IOException;
@@ -18,6 +18,7 @@
1818
import java.security.interfaces.RSAPublicKey;
1919
import java.security.spec.EncodedKeySpec;
2020
import java.security.spec.X509EncodedKeySpec;
21+
import java.util.Base64;
2122
import java.util.Scanner;
2223

2324
import static org.hamcrest.CoreMatchers.notNullValue;
@@ -146,7 +147,7 @@ private JwkProvider getRSProvider(String rsaPath) throws Exception {
146147

147148
private static RSAPublicKey readPublicKeyFromFile(final String path) throws IOException {
148149
Scanner scanner = null;
149-
PemReader pemReader = null;
150+
BufferedReader reader = null;
150151
try {
151152
scanner = new Scanner(Paths.get(path));
152153
if (scanner.hasNextLine() && scanner.nextLine().startsWith("-----BEGIN CERTIFICATE-----")) {
@@ -157,8 +158,15 @@ private static RSAPublicKey readPublicKeyFromFile(final String path) throws IOEx
157158
fs.close();
158159
return (RSAPublicKey) key;
159160
} else {
160-
pemReader = new PemReader(new FileReader(path));
161-
byte[] keyBytes = pemReader.readPemObject().getContent();
161+
reader = new BufferedReader(new FileReader(path));
162+
StringBuilder pemContent = new StringBuilder();
163+
String line;
164+
while ((line = reader.readLine()) != null) {
165+
if (!line.startsWith("-----BEGIN") && !line.startsWith("-----END")) {
166+
pemContent.append(line);
167+
}
168+
}
169+
byte[] keyBytes = Base64.getDecoder().decode(pemContent.toString());
162170
KeyFactory kf = KeyFactory.getInstance("RSA");
163171
EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes);
164172
return (RSAPublicKey) kf.generatePublic(keySpec);
@@ -169,8 +177,8 @@ private static RSAPublicKey readPublicKeyFromFile(final String path) throws IOEx
169177
if (scanner != null) {
170178
scanner.close();
171179
}
172-
if (pemReader != null) {
173-
pemReader.close();
180+
if (reader != null) {
181+
reader.close();
174182
}
175183
}
176184
}

0 commit comments

Comments
 (0)