99import java .net .URI ;
1010import java .net .URISyntaxException ;
1111
12- import org .bouncycastle .jce .provider .BouncyCastleProvider ;
1312
1413import java .security .GeneralSecurityException ;
15- import java .security .Security ;
1614import java .util .HashMap ;
1715import java .util .Map ;
1816
@@ -35,10 +33,6 @@ public class EncryptionInterceptor implements Interceptor {
3533 private final String baseUrl ;
3634 private final ObjectMapper mapper = new ObjectMapper ();
3735
38- static {
39- Security .addProvider (new BouncyCastleProvider ());
40- }
41-
4236 public EncryptionInterceptor (String apiKey , String baseUrl ) {
4337 this .baseUrl = baseUrl ;
4438 this .apiKey = apiKey ;
@@ -112,21 +106,6 @@ private Map<String, Object> parseRequestBody(RequestBody body) throws IOExceptio
112106 });
113107 }
114108
115- /**
116- * 非加密模式处理 - 直接转发请求
117- */
118- private Response proceedWithoutEncryption (Chain chain , Request request , Map <String , Object > requestBodyJson ) throws IOException {
119- String modifiedRequestBodyStr = mapper .writeValueAsString (requestBodyJson );
120- RequestBody modifiedBody = RequestBody .create (
121- MediaType .get ("application/json" ),
122- modifiedRequestBodyStr
123- );
124- Request modifiedRequest = request .newBuilder ()
125- .method (request .method (), modifiedBody )
126- .build ();
127- return chain .proceed (modifiedRequest );
128- }
129-
130109 /**
131110 * 加密请求体内容
132111 */
@@ -554,4 +533,4 @@ private String getEncryptedContentFromStreamChoice(Map<String, Object> choice) {
554533 Map <String , Object > delta = (Map <String , Object >) choice .get ("delta" );
555534 return (String ) delta .get ("content" );
556535 }
557- }
536+ }
0 commit comments