TokenObject

public class TokenObject
extension TokenObject: Hashable

Class that describes a cryptographic object located in a smart card.

  • Returns label string, corresponding to the CKA_LABEL attribute of the object, as seen by the PKCS#11 interface.

    Declaration

    Swift

    public func getCkLabel() -> String

    Return Value

    The CKA_LABEL attribute of the object.

  • Returns the identifier string, corresponding to the hexadecimal representation of the CKA_ID attribute of the object, as seen by the PKCS#11.

    Note:

    This value can be used to match keys and certificates that are linked together (inside the same container).

    Example:

    token.getObjects() { objects, error in
        if let error = error {
            print("error reason : " + error.localizedDescription);
        }
        else {
            if let objects = objects {
                for object in objects {
                    if (object.getCkId() == certificate.getCkId() && object is PrivateKey) {
                        // We found the private key associated with the certificate.
                    }
                }
            }
        }
    }
    

    Declaration

    Swift

    public func getCkId() -> String

    Return Value

    The CKA_ID attribute of the object.

  • Returns the Token object from which the object has been retrieved.

    Declaration

    Swift

    public func getParent() -> Token

    Return Value

    The Token object.

  • Returns the index of the PIN which grants access to the private objects. This corresponds to the index within the Token.pins() array.

    For public objects (certificates and public keys), it is the PIN which grants access to the corresponding private key (association is determined by the TokenObject.getCkId() attribute).

    Declaration

    Swift

    public func getPinNumber() -> Int

    Return Value

    The index of the associated PIN.