Key
public class Key : TokenObject
Class that describes a key object. Inherits from TokenObject
.
-
Returns the algorithm of the key.
See also
Declaration
Swift
public func getAlgorithm() -> KeyAlgorithm
Return Value
The algorithm of the key.
-
Returns the key length, in bits.
Declaration
Swift
public func getKeyLength() -> Int
Return Value
The length of the key.
-
Returns the modulus.
Note:
This function works only for RSA keys.
Declaration
Swift
public func getModulus(completionHandler: @escaping (_ modulus: Data?, _ error: NSError?) -> Void)
Parameters
completionHandler
The completion handler block to be called as soon as the modulus is retrieved. It takes the following parameters:
- modulus
Data?
: The modulus. - error
NSError?
:nil
if the modulus is retrieved successfully; otherwise an error encapsulates the reason of failure.
Note
The completion handler is executed on the same type ofDispatchQueue
as in the calling code. - modulus
-
Returns the public exponent.
Note:
This function works only for RSA keys.
Declaration
Swift
public func getPublicExponent(completionHandler: @escaping (_ publicExponent: Data?, _ error: NSError?) -> Void)
Parameters
completionHandler
The completion handler block to be called as soon as the public exponent is retrieved. It takes the following parameters:
- publicExponent
Data?
: The public exponent. - error
NSError?
:nil
if the modulus is retrieved successfully; otherwise an error encapsulates the reason of failure.
Note
The completion handler is executed on the same type ofDispatchQueue
as in the calling code. - publicExponent
-
Returns the elliptic curve parameters.
Note:
This function works only for EC keys.
Declaration
Swift
public func getECParams(completionHandler: @escaping (_ ecParams: Data?, _ error: NSError?) -> Void)
Parameters
completionHandler
The completion handler block to be called as soon as the elliptic curve parameters is retrieved. It takes the following parameters:
- ecParams
Data?
: The elliptic curve parameters. - error
NSError?
:nil
if the elliptic curve parameters are retrieved successfully; otherwise an error encapsulates the reason of failure.
Note
The completion handler is executed on the same type ofDispatchQueue
as in the calling code. - ecParams