1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 package software.amazon.awssdk.crt.io; 6 7 import software.amazon.awssdk.crt.Log; 8 import software.amazon.awssdk.crt.Log.LogLevel; 9 import software.amazon.awssdk.crt.Log.LogSubject; 10 11 /** 12 * Interface for handling private key operations during the TLS handshake. 13 */ 14 public interface TlsKeyOperationHandler { 15 16 /** 17 * Invoked each time a private key operation needs to be performed. 18 * 19 * You MUST call either operation.complete(output) or 20 * operation.completeExceptionally(exception) or the TLS connection will hang 21 * forever. 22 * 23 * You may complete the operation synchronously, or async. You may complete the 24 * operation on any thread. 25 * 26 * The function is always invoked from an IO event-loop thread. Therefore you 27 * MUST NOT perform an async call and wait for it in a blocking way from within 28 * this function. Such behavior is likely to deadlock your program. 29 * 30 * Additionally, this may be called from multiple times from multiple threads 31 * at once, so keep this in mind if using a private key operation that has to 32 * be single-threaded and synchronously called. 33 * 34 * @param operation The operation to be acted on 35 */ performOperation(TlsKeyOperation operation)36 void performOperation(TlsKeyOperation operation); 37 } 38