SCMError

public enum SCMError : Error

Represents an error that can be thrown or returned from function of the API.

Generally, whenever a completionHandlerreturns a NSError, a SCMError may be present through NSError.scmError to describe the error.

Example:

pin.login(value: "****") { error in
    if let error = error {
        if (error.scmError == SCMError.CKR_PIN_INCORRECT) {
            // pin value is incorrect
        }
        else if (error.scmError == SCMError.CKR_PIN_LOCKED) {
            // pin is locked
        }
        else {
            // check other errors...
        }
    }
    else {
        // login is sucessful
    }
}

See also

NSError.scmError
  • The operation was canceled.

    Declaration

    Swift

    case CKR_CANCEL
  • Not enough memory on the host computer.

    Declaration

    Swift

    case CKR_HOST_MEMORY
  • The selected slot Pin ID is invalid.

    Declaration

    Swift

    case CKR_SLOT_ID_INVALID
  • An unrecoverable error occurred. This may be due to an inconsistency in the smart card data.

    Declaration

    Swift

    case CKR_GENERAL_ERROR
  • The operation failed for an unknown reason.

    Declaration

    Swift

    case CKR_FUNCTION_FAILED
  • Bad argument were passed to the function.

    Declaration

    Swift

    case CKR_ARGUMENTS_BAD
  • The token object cannot be modified because it is read-only.

    Declaration

    Swift

    case CKR_ATTRIBUTE_READ_ONLY
  • The token object cannot be read because it is sensitive.

    Declaration

    Swift

    case CKR_ATTRIBUTE_SENSITIVE
  • The object attribute is invalid.

    Declaration

    Swift

    case CKR_ATTRIBUTE_TYPE_INVALID
  • The value of the object attribute is invalid.

    Declaration

    Swift

    case CKR_ATTRIBUTE_VALUE_INVALID
  • The action cannot be done because it is prohibited by the token.

    Declaration

    Swift

    case CKR_ACTION_PROHIBITED
  • The data is invalid.

    Declaration

    Swift

    case CKR_DATA_INVALID
  • The length of the data is inconsistent.

    Declaration

    Swift

    case CKR_DATA_LEN_RANGE
  • An error occurred during the communication with the card.

    Declaration

    Swift

    case CKR_DEVICE_ERROR
  • There is not enough memory space available in the card.

    Declaration

    Swift

    case CKR_DEVICE_MEMORY
  • The card has been removed during the operation.

    Declaration

    Swift

    case CKR_DEVICE_REMOVED
  • The encrypted data is invalid.

    Declaration

    Swift

    case CKR_ENCRYPTED_DATA_INVALID
  • The length of the encrypted data is invalid.

    Declaration

    Swift

    case CKR_ENCRYPTED_DATA_LEN_RANGE
  • The operation has been cancelled. (Legacy support)There is currently no function executing in parallel in the specified session. case CKR_FUNCTION_NOT_PARALLEL

    Declaration

    Swift

    case CKR_FUNCTION_CANCELED
  • The operation is not supported by the card.

    Declaration

    Swift

    case CKR_FUNCTION_NOT_SUPPORTED
  • The specified key handle is not valid.

    Declaration

    Swift

    case CKR_KEY_HANDLE_INVALID
  • The key size is outside of the range supported for this operation.

    Declaration

    Swift

    case CKR_KEY_SIZE_RANGE
  • The key types are inconsistent for this operation.

    Declaration

    Swift

    case CKR_KEY_TYPE_INCONSISTENT
  • An extraneous key was supplied.

    Declaration

    Swift

    case CKR_KEY_NOT_NEEDED
  • One of the keys specified is not the same key that was being used in the original saved session.

    Declaration

    Swift

    case CKR_KEY_CHANGED
  • The key cannot be digested.

    Declaration

    Swift

    case CKR_KEY_INDIGESTIBLE
  • The key does not support this operation.

    Declaration

    Swift

    case CKR_KEY_FUNCTION_NOT_PERMITTED
  • The key cannot be wrapped.

    Declaration

    Swift

    case CKR_KEY_NOT_WRAPPABLE
  • The key cannot be extracted.

    Declaration

    Swift

    case CKR_KEY_UNEXTRACTABLE
  • The cryptographic algorithm is not supported.

    Declaration

    Swift

    case CKR_MECHANISM_INVALID
  • The parameters for the cryptographic operation are incorrect.

    Declaration

    Swift

    case CKR_MECHANISM_PARAM_INVALID
  • The PIN value is incorrect.

    Declaration

    Swift

    case CKR_PIN_INCORRECT
  • The PIN does not have the proper format.

    Declaration

    Swift

    case CKR_PIN_INVALID
  • The length of the PIN is outside of the range.

    Declaration

    Swift

    case CKR_PIN_LEN_RANGE
  • The PIN has expired and needs to be changed.

    Declaration

    Swift

    case CKR_PIN_EXPIRED
  • The PIN has been blocked

    Declaration

    Swift

    case CKR_PIN_LOCKED
  • The digital signature in invalid.

    Declaration

    Swift

    case CKR_SIGNATURE_INVALID
  • The length of the digital signature is inconsistent.

    Declaration

    Swift

    case CKR_SIGNATURE_LEN_RANGE
  • The template specified for creating an object is incomplete, and lacks some necessary attributes.

    Declaration

    Swift

    case CKR_TEMPLATE_INCOMPLETE
  • The template specified for creating an object has conflicting attribute.

    Declaration

    Swift

    case CKR_TEMPLATE_INCONSISTENT
  • The token has been removed.

    Declaration

    Swift

    case CKR_TOKEN_NOT_PRESENT
  • The token is not supported.

    Declaration

    Swift

    case CKR_TOKEN_NOT_RECOGNIZED
  • The token is write-protected.

    Declaration

    Swift

    case CKR_TOKEN_WRITE_PROTECTED
  • The key handle specified to be used to unwrap another key is not valid.

    Declaration

    Swift

    case CKR_UNWRAPPING_KEY_HANDLE_INVALID
  • The size of the unwrapping key is outside of the range supported for this operation.

    Declaration

    Swift

    case CKR_UNWRAPPING_KEY_SIZE_RANGE
  • The type of the unwrapping key is not supported for this operation.

    Declaration

    Swift

    case CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT
  • The user is already logged in.

    Declaration

    Swift

    case CKR_USER_ALREADY_LOGGED_IN
  • The appropriate user is not logged in. You dont’ have the right to perform this operation.

    Declaration

    Swift

    case CKR_USER_NOT_LOGGED_IN
  • The user PIN on this token has never been initially set.

    Declaration

    Swift

    case CKR_USER_PIN_NOT_INITIALIZED
  • The required user type is not defined for this card.

    Declaration

    Swift

    case CKR_USER_TYPE_INVALID
  • Another user is currently logged in.

    Declaration

    Swift

    case CKR_USER_ANOTHER_ALREADY_LOGGED_IN
  • Too many users are logged in the token.

    Declaration

    Swift

    case CKR_USER_TOO_MANY_TYPES
  • The size of the wrapped key is outside of the range supported for this operation.

    Declaration

    Swift

    case CKR_WRAPPED_KEY_INVALID
  • The type of the wrapped key is not supported for this operation.

    Declaration

    Swift

    case CKR_WRAPPED_KEY_LEN_RANGE
  • The key handle specified to be used to wrap another key is not valid.

    Declaration

    Swift

    case CKR_WRAPPING_KEY_HANDLE_INVALID
  • The size of the wrapping key is outside of the range supported for this operation.

    Declaration

    Swift

    case CKR_WRAPPING_KEY_SIZE_RANGE
  • The type of the wrapping key is not supported for this operation.

    Declaration

    Swift

    case CKR_WRAPPING_KEY_TYPE_INCONSISTENT
  • This curve is not supported by this token.

    Declaration

    Swift

    case CKR_CURVE_NOT_SUPPORTED
  • The information is sensitive and cannot be revealed.

    Declaration

    Swift

    case CKR_INFORMATION_SENSITIVE
  • The Cryptoki library could not load a dependent shared library.

    Declaration

    Swift

    case CKR_LIBRARY_LOAD_FAILED
  • The new PIN must be different from the current one and recent previous PINs.

    Declaration

    Swift

    case CKR_PIN_TOO_WEAK
  • The public key fails a public key validation.

    Declaration

    Swift

    case CKR_PUBLIC_KEY_INVALID
  • The software license key is invalid.

    Declaration

    Swift

    case CXR_NO_LICENSE_KEY
  • The selected container is invalid.

    Declaration

    Swift

    case CXR_CONTAINER_INVALID
  • Security status not satisfied: the user may not be authenticated, the secure channel might not be established, or chip authentication may be missing.

    Declaration

    Swift

    case CXR_CONTAINER_EXISTS
  • The Puk is already used.

    Declaration

    Swift

    case CXR_PUK_ALREADY_USED
  • The PIN cannot be unblocked anymore. The maximum number of unlock attempts has been reached.

    Declaration

    Swift

    case CXR_PIN_UNBLOCK_BLOCKED
  • The Puk is already used.

    Declaration

    Swift

    case CXR_NOT_PERMITTED
  • a fingerprint scanner is needed for this operation.

    Declaration

    Swift

    case CXR_MISSING_FINGERPRINT_SCANNER
  • The card needs a Pace before using it.

    Declaration

    Swift

    case CXR_PACE_NEEDED
  • The certificate has not been approved by an authority from the trusted zone.

    Declaration

    Swift

    case CXR_CERT_NOT_TRUSTED
  • Secure chanel is broken.

    Declaration

    Swift

    case CXR_BROKEN_AUTHENTICATION
  • The format of the file is unsupported or the file has been damaged.

    Declaration

    Swift

    case MWR_IMPORT_FILE_INVALID
  • The file password is invalid.

    Declaration

    Swift

    case MWR_IMPORT_PASSWORD_INVALID
  • The card does not support the required key type.

    Declaration

    Swift

    case MWR_IMPORT_KEY_TYPE_UNSUPPORTED
  • The card does not support the required key length.

    Declaration

    Swift

    case MWR_IMPORT_KEY_LENGTH_UNSUPPORTED
  • This PIN unblocking code has already been used.

    Declaration

    Swift

    case MWR_PUK_ALREADY_USED
  • The SCWS service could not be reached.

    Declaration

    Swift

    case MWR_SCWS_UNREACHABLE
  • The communication with the SCWS service failed.

    Declaration

    Swift

    case MWR_SCWS_COMM_ERROR
  • The communication with the SCWS service has timed out.

    Declaration

    Swift

    case MWR_SCWS_COMM_TIMEOUT
  • Invalid input parameters.

    Declaration

    Swift

    case MWR_SCWS_BAD_PARAMS
  • The SCWS service returned an invalid error code.

    Declaration

    Swift

    case MWR_SCWS_UNKNOWN_ERROR
  • Bluetooth permissions are not granted.

    Declaration

    Swift

    case CXR_BT_PERMISSIONS_NOT_GRANTED
  • The initialization of bluetooth service failed. Maybe it is not enabled on your device.

    Declaration

    Swift

    case CXR_BT_INITIALIZATION_FAILED
  • Bluetooth scan has not been started or has been stopped.

    Declaration

    Swift

    case CXR_BT_NOT_SCANNING
  • The bluetooth peripheral is not supported.

    Declaration

    Swift

    case CXR_BT_DEVICE_NOT_SUPPORTED
  • The bluetooth peripheral is not detected.

    Declaration

    Swift

    case CXR_BT_DEVICE_NOT_DETECTED
  • The current operation is not permitted because a bluetooth peripheral is already paired.

    Declaration

    Swift

    case CXR_BT_ALREADY_PAIRED
  • Timestamping step of the signature failed.

    Declaration

    Swift

    case CXR_SIGNATURE_TIMESTAMP
  • The operation took too long.

    Declaration

    Swift

    case CXR_FUNCTION_TIMED_OUT
  • The AID of the card is not recognized, please be sure to add the correct card AID in the info.plis file.

    Declaration

    Swift

    case CXR_AID_NOT_IN_PLIST_FILE