Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<name>DashScope Java SDK</name>
<groupId>com.alibaba</groupId>
<artifactId>dashscope-sdk-java</artifactId>
<version>2.23.2</version>
<version>2.23.3</version>

<properties>
<maven.compiler.source>8</maven.compiler.source>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/alibaba/dashscope/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
package com.alibaba.dashscope;

public final class Version {
public static final String version = "2.23.2";
public static final String version = "2.23.3";
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ public HttpRequest getHttpRequest() throws NoApiKeyException, ApiException {
|| getHttpMethod() == HttpMethod.DELETE) {
JsonObject body = param.getHttpBody();
if (isEncryptRequest() && body != null) { // we need to encrypt the input
this.encryptionConfig = EncryptionUtils.generateEncryptionConfig(param.getApiKey());
this.encryptionConfig =
EncryptionUtils.generateEncryptionConfig(
param.getApiKey(), serviceOption.getBaseHttpUrl());
requestHeaders.put("X-DashScope-EncryptionKey", getEncryptionKeyHeader(encryptionConfig));
JsonObject input = body.get("input").getAsJsonObject();
String chiperInput =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,14 @@ public static String AESDecrypt(String cipherText, SecretKey secretKey, byte[] i
/** Generate a EncryptionConfig. */
public static EncryptionConfig generateEncryptionConfig(String apiKey)
throws ApiException, NoApiKeyException {
EncryptionKeys encryptionKeys = new EncryptionKeys();
return generateEncryptionConfig(apiKey, null);
}

/** Generate a EncryptionConfig, fetching the public key from the given base URL. */
public static EncryptionConfig generateEncryptionConfig(String apiKey, String baseHttpUrl)
throws ApiException, NoApiKeyException {
EncryptionKeys encryptionKeys =
baseHttpUrl != null ? new EncryptionKeys(baseHttpUrl) : new EncryptionKeys();
EncryptionKey encryptionKey = encryptionKeys.get(apiKey);
byte[] iv = new byte[12];
new SecureRandom().nextBytes(iv);
Expand Down
Loading