Interface TKTokenSessionDelegate


  • public interface TKTokenSessionDelegate
    TKTokenSessionDelegate contains operations with token objects provided by token implementors which should be performed in the context of authentication session. API-Since: 10.0
    • Method Detail

      • tokenSessionBeginAuthForOperationConstraintError

        @Nullable
        default @Nullable TKTokenAuthOperation tokenSessionBeginAuthForOperationConstraintError​(@NotNull
                                                                                                @NotNull TKTokenSession session,
                                                                                                long operation,
                                                                                                @NotNull
                                                                                                @NotNull java.lang.Object constraint,
                                                                                                @Nullable
                                                                                                @Nullable org.moe.natj.general.ptr.Ptr<NSError> error)
        Establishes a context for the requested authentication operation.
        Parameters:
        session - Related TKTokenSession instance.
        operation - Identifier of the operation.
        constraint - Constraint to be satisfied by this authentication operation.
        error - Error details (see TKError.h).
        Returns:
        authOperation Resulting context of the operation, which will be eventually finalized by receiving 'finishWithError:'. The resulting 'authOperation' can be of any type based on TKTokenAuthOperation. For known types (e.g. TKTokenPasswordAuthOperation) the system will first fill in the context-specific properties (e.g. 'password') before triggering 'finishWithError:'. When no authentication is actually needed (typically because the session is already authenticated for requested constraint), return instance of TKTokenAuthOperation class instead of any specific subclass.
      • tokenSessionDecryptDataUsingKeyAlgorithmError

        @Nullable
        default @Nullable NSData tokenSessionDecryptDataUsingKeyAlgorithmError​(@NotNull
                                                                               @NotNull TKTokenSession session,
                                                                               @NotNull
                                                                               @NotNull NSData ciphertext,
                                                                               @NotNull
                                                                               @NotNull java.lang.Object keyObjectID,
                                                                               @NotNull
                                                                               @NotNull TKTokenKeyAlgorithm algorithm,
                                                                               @Nullable
                                                                               @Nullable org.moe.natj.general.ptr.Ptr<NSError> error)
        Decrypts ciphertext using private key.
        Parameters:
        session - Related TKTokenSession instance.
        ciphertext - Encrypted data to decrypt.
        keyObjectID - Identifier of the private key object.
        algorithm - Requested encryption/decryption algorithm to be used.
        error - Error details (see TKError.h). If authentication is required (by invoking beginAuthForOperation:), @c TKErrorCodeAuthenticationNeeded should be used.
        Returns:
        Resulting decrypted plaintext, or nil if an error happened.
      • tokenSessionPerformKeyExchangeWithPublicKeyUsingKeyAlgorithmParametersError

        @Nullable
        default @Nullable NSData tokenSessionPerformKeyExchangeWithPublicKeyUsingKeyAlgorithmParametersError​(@NotNull
                                                                                                             @NotNull TKTokenSession session,
                                                                                                             @NotNull
                                                                                                             @NotNull NSData otherPartyPublicKeyData,
                                                                                                             @NotNull
                                                                                                             @NotNull java.lang.Object objectID,
                                                                                                             @NotNull
                                                                                                             @NotNull TKTokenKeyAlgorithm algorithm,
                                                                                                             @NotNull
                                                                                                             @NotNull TKTokenKeyExchangeParameters parameters,
                                                                                                             @Nullable
                                                                                                             @Nullable org.moe.natj.general.ptr.Ptr<NSError> error)
        Performs Diffie-Hellman style key exchange operation.
        Parameters:
        session - Related TKTokenSession instance.
        otherPartyPublicKeyData - Raw public data of other party public key.
        objectID - Identifier of the private key object.
        algorithm - Requested key exchange algorithm to be used.
        parameters - Additional parameters for key exchange operation. Chosen algorithm dictates meaning of parameters.
        error - Error details (see TKError.h). If authentication is required (by invoking beginAuthForOperation:), @c TKErrorCodeAuthenticationNeeded should be used.
        Returns:
        Result of key exchange operation, or nil if the operation failed.
      • tokenSessionSignDataUsingKeyAlgorithmError

        @Nullable
        default @Nullable NSData tokenSessionSignDataUsingKeyAlgorithmError​(@NotNull
                                                                            @NotNull TKTokenSession session,
                                                                            @NotNull
                                                                            @NotNull NSData dataToSign,
                                                                            @NotNull
                                                                            @NotNull java.lang.Object keyObjectID,
                                                                            @NotNull
                                                                            @NotNull TKTokenKeyAlgorithm algorithm,
                                                                            @Nullable
                                                                            @Nullable org.moe.natj.general.ptr.Ptr<NSError> error)
        Performs cryptographic signature operation.
        Parameters:
        session - Related TKTokenSession instance.
        dataToSign - Input data for the signature operation.
        keyObjectID - Identifier of the private key object.
        algorithm - Requested signature algorithm to be used.
        error - Error details (see TKError.h). If authentication is required (by invoking beginAuthForOperation:), @c TKErrorCodeAuthenticationNeeded should be used.
        Returns:
        Resulting signature, or nil if an error happened.
      • tokenSessionSupportsOperationUsingKeyAlgorithm

        default boolean tokenSessionSupportsOperationUsingKeyAlgorithm​(@NotNull
                                                                       @NotNull TKTokenSession session,
                                                                       long operation,
                                                                       @NotNull
                                                                       @NotNull java.lang.Object keyObjectID,
                                                                       @NotNull
                                                                       @NotNull TKTokenKeyAlgorithm algorithm)
        Checks whether specified operation and algorithm is supported on specified key.
        Parameters:
        session - Related TKTokenSession instance.
        operation - Type of cryptographic operation for which the list of supported algorithms should be retrieved.
        keyObjectID - Identifier of the private key object.
        algorithm - Algorithm with which the oepration should be performed.
        Returns:
        YES if the operation is supported, NO otherwise.