|
19 | 19 |
|
20 | 20 | package com.aliyun.oss; |
21 | 21 |
|
| 22 | +import java.security.KeyStore; |
22 | 23 | import java.util.ArrayList; |
23 | 24 | import java.util.Collections; |
24 | 25 | import java.util.LinkedHashMap; |
@@ -129,6 +130,8 @@ public class ClientConfiguration { |
129 | 130 |
|
130 | 131 | private boolean enableAutoCorrectClockSkew = false; |
131 | 132 |
|
| 133 | + private KeyStore keyStore = null; |
| 134 | + |
132 | 135 | public ClientConfiguration() { |
133 | 136 | super(); |
134 | 137 | AppendDefaultExcludeList(this.cnameExcludeList); |
@@ -1017,4 +1020,35 @@ public boolean isEnableAutoCorrectClockSkew() { |
1017 | 1020 | public void setEnableAutoCorrectClockSkew(boolean enableAutoCorrectClockSkew) { |
1018 | 1021 | this.enableAutoCorrectClockSkew = enableAutoCorrectClockSkew; |
1019 | 1022 | } |
| 1023 | + |
| 1024 | + /** |
| 1025 | + * Gets the KeyStore currently configured for SSL/TLS operations. |
| 1026 | + * <p> |
| 1027 | + * This KeyStore typically contains trusted certificates (for server verification) |
| 1028 | + * or client certificates (for mutual authentication). The returned KeyStore is |
| 1029 | + * the same instance that was set via {@link #setKeyStore(KeyStore)}. |
| 1030 | + * <p> |
| 1031 | + * Note: If no KeyStore has been explicitly set, this method may return `null`. |
| 1032 | + * Applications should ensure the KeyStore is properly initialized and configured |
| 1033 | + * before use in SSL/TLS contexts. |
| 1034 | + * |
| 1035 | + * @return the KeyStore instance (e.g., JKS or PKCS12 format), or `null` if not set. |
| 1036 | + */ |
| 1037 | + public KeyStore getKeyStore() { |
| 1038 | + return keyStore; |
| 1039 | + } |
| 1040 | + |
| 1041 | + /** |
| 1042 | + * Sets the KeyStore to be used for SSL/TLS operations. |
| 1043 | + * <p> |
| 1044 | + * This KeyStore typically contains trusted certificates (for server verification) |
| 1045 | + * or client certificates (for mutual authentication). The KeyStore must be |
| 1046 | + * pre-initialized and populated with the necessary certificates/keys before being set. |
| 1047 | + * |
| 1048 | + * @param keyStore the KeyStore instance (e.g., JKS or PKCS12 format) to be used. |
| 1049 | + * Must not be null. |
| 1050 | + */ |
| 1051 | + public void setKeyStore(KeyStore keyStore) { |
| 1052 | + this.keyStore = keyStore; |
| 1053 | + } |
1020 | 1054 | } |
0 commit comments