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.
    • Method Detail

      • tokenSessionBeginAuthForOperationConstraintError

        default TKTokenAuthOperation tokenSessionBeginAuthForOperationConstraintError​(TKTokenSession session,
                                                                                      long operation,
                                                                                      java.lang.Object constraint,
                                                                                      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

        default NSData tokenSessionDecryptDataUsingKeyAlgorithmError​(TKTokenSession session,
                                                                     NSData ciphertext,
                                                                     java.lang.Object keyObjectID,
                                                                     TKTokenKeyAlgorithm algorithm,
                                                                     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

        default NSData tokenSessionPerformKeyExchangeWithPublicKeyUsingKeyAlgorithmParametersError​(TKTokenSession session,
                                                                                                   NSData otherPartyPublicKeyData,
                                                                                                   java.lang.Object objectID,
                                                                                                   TKTokenKeyAlgorithm algorithm,
                                                                                                   TKTokenKeyExchangeParameters parameters,
                                                                                                   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

        default NSData tokenSessionSignDataUsingKeyAlgorithmError​(TKTokenSession session,
                                                                  NSData dataToSign,
                                                                  java.lang.Object keyObjectID,
                                                                  TKTokenKeyAlgorithm algorithm,
                                                                  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​(TKTokenSession session,
                                                                       long operation,
                                                                       java.lang.Object keyObjectID,
                                                                       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.