Struct

struct OAEPOption

public struct OAEPOption {
    public init(hash: Digest, mgfHash: Digest, label!: String = "")
}

Description: Indicates the parameters to be set for the OAEP padding mode.

init(Digest, Digest, String)

public init(hash: Digest, mgfHash: Digest, label!: String = "")

Description: Initializes the OAEP padding parameters.

Parameters:

  • hash: Digest: digest method, which is used to digest the label
  • mgfHash: Digest: digest method, which is used to set the digest method in the MGF1 function
  • label!: String: optional parameter used to distinguish different encryption operations, which is an empty string by default

struct PSSOption

public struct PSSOption {
    public init(saltLen: Int32)
}

This struct is a parameter that needs to be set in the PSS padding mode.

init(Int32)

public init(saltLen: Int32)

Description: Initializes the PSS padding parameters.

Parameters:

  • saltLen: Int32: random salt length (in bytes). The value must be greater than or equal to 0 and less than or equal to (RSA length – Digest length – 2). If the length is too long, signing fails.

Throws:

  • CryptoException: If the length of the random salt is less than 0, this exception is thrown.