Skip to content

Commit cd3c976

Browse files
authored
Fix PKCS12 API Name (#601)
* rename pkcs12 constructor * mark old function as deprecated * fix format
1 parent bc6b5b0 commit cd3c976

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

Diff for: documents/MQTT5_Userguide.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ A MQTT5 direct connection can be made using a PKCS12 file rather than using a PE
185185
~~~ java
186186

187187
String clientEndpoint = "<prefix>-ats.iot.<region>.amazonaws.com";
188-
AwsIotMqtt5ClientBuilder builder = AwsIotMqtt5ClientBuilder.newDirectMqttBuilderWithMtlsFromPkcs11(clientEndpoint, "<PKCS12 file path>", "<PKCS12 password>");
188+
AwsIotMqtt5ClientBuilder builder = AwsIotMqtt5ClientBuilder.newDirectMqttBuilderWithMtlsFromPkcs12(clientEndpoint, "<PKCS12 file path>", "<PKCS12 password>");
189189
~~~
190190

191191
**Note**: Currently, TLS integration with PKCS12 is only available on MacOS devices.

Diff for: samples/Mqtt5/PubSub/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ A MQTT5 direct connection can be made using a PKCS12 file rather than using a PE
201201
~~~ java
202202

203203
String clientEndpoint = "<prefix>-ats.iot.<region>.amazonaws.com";
204-
AwsIotMqtt5ClientBuilder builder = AwsIotMqtt5ClientBuilder.newDirectMqttBuilderWithMtlsFromPkcs11(clientEndpoint, "<PKCS12 file path>", "<PKCS12 password>");
204+
AwsIotMqtt5ClientBuilder builder = AwsIotMqtt5ClientBuilder.newDirectMqttBuilderWithMtlsFromPkcs12(clientEndpoint, "<PKCS12 file path>", "<PKCS12 password>");
205205
~~~
206206

207207
**Note**: Currently, TLS integration with PKCS12 is only available on MacOS devices.

Diff for: sdk/src/main/java/software/amazon/awssdk/iot/AwsIotMqtt5ClientBuilder.java

+17
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ public static AwsIotMqtt5ClientBuilder newDirectMqttBuilderWithCustomAuth(String
178178
}
179179

180180
/**
181+
* @deprecated Use alternate newDirectMqttBuilderWithMtlsFromPkcs12().
181182
* Create a new builder with mTLS, using a PKCS12 library for private key operations.
182183
*
183184
* NOTE: MacOS only
@@ -187,7 +188,23 @@ public static AwsIotMqtt5ClientBuilder newDirectMqttBuilderWithCustomAuth(String
187188
* @param pkcs12Password The password of the PKCS12 file to use with the builder.
188189
* @return - A new AwsIotMqtt5ClientBuilder
189190
*/
191+
@Deprecated
190192
public static AwsIotMqtt5ClientBuilder newDirectMqttBuilderWithMtlsFromPkcs11(String hostName, String pkcs12Path, String pkcs12Password) {
193+
return newDirectMqttBuilderWithMtlsFromPkcs12(hostName, pkcs12Path, pkcs12Password);
194+
}
195+
196+
197+
/**
198+
* Create a new builder with mTLS, using a PKCS12 library for private key operations.
199+
*
200+
* NOTE: MacOS only
201+
*
202+
* @param hostName - AWS IoT endpoint to connect to
203+
* @param pkcs12Path Path to the PKCS12 file to use with the builder.
204+
* @param pkcs12Password The password of the PKCS12 file to use with the builder.
205+
* @return - A new AwsIotMqtt5ClientBuilder
206+
*/
207+
public static AwsIotMqtt5ClientBuilder newDirectMqttBuilderWithMtlsFromPkcs12(String hostName, String pkcs12Path, String pkcs12Password) {
191208
TlsContextOptions options = TlsContextOptions.createWithMtlsPkcs12(pkcs12Path, pkcs12Password);
192209
AwsIotMqtt5ClientBuilder builder = new AwsIotMqtt5ClientBuilder(hostName, DEFAULT_DIRECT_MQTT_PORT, options);
193210
options.close();

0 commit comments

Comments
 (0)