Enumeration

enum Curve

public enum Curve {
    | P224 | P256 | P384 | P521 | BP256 | BP320 | BP384 | BP512
}

Description: The enumeration type Curve is used to select the elliptic curve type used for generating ECDSA keys.

The elliptic curve is a mathematical curve, and is usually used for key generation in encryption algorithms. In cryptography, the elliptic curve cryptography algorithm is a public key cryptography algorithm based on elliptic curves. Its basic idea is to use the point set on the elliptic curve to form a computational difficulty to implement the security of public key passwords.

The Curve enumeration type supports eight elliptic curves: NIST P-224, NIST P-256, NIST P-384, NIST P-521, Brainpool P-256, Brainpool P-320, Brainpool P-384, and Brainpool P-512.

  • NIST P-224: Indicates an encryption algorithm based on elliptic curves, which uses a 224-bit prime number as a modulus, has relatively high security, and is applicable to lightweight applications.

  • NIST P-256: Indicates an encryption algorithm based on elliptic curves, which uses a 256-bit prime number as a modulus, has relatively high security, and is applicable to medium-level applications.

  • NIST P-384: Indicates an encryption algorithm based on elliptic curves, which uses a 384-bit prime number as a modulus, has very high security, and is applicable to high-level applications.

  • NIST P-521: Indicates an encryption algorithm based on elliptic curves, which uses a 521-bit prime number as a modulus, has very high security, and is applicable to extremely-high-level applications.

  • Brainpool P-256: Indicates an encryption algorithm based on elliptic curves, which uses a 256-bit prime number as a modulus, has relatively high security, and is faster than NIST P-256.

  • Brainpool P-320: Indicates an encryption algorithm based on elliptic curves, which uses a 320-bit prime number as a modulus, has very high security, and is faster than NIST P-384.

  • Brainpool P-384: Indicates an encryption algorithm based on elliptic curves, which uses a 384-bit prime number as a modulus, has very high security, and is faster than NIST P-384.

  • Brainpool P-512: Indicates an encryption algorithm based on elliptic curves, which uses a 512-bit prime number as a modulus, has very high security, and is faster than NIST P-521.

BP256

BP256

Description: Initializes a Curve instance using the Brainpool P-256 elliptic curve.

BP320

BP320

Description: Initializes a Curve instance using the Brainpool P-320 elliptic curve.

BP384

BP384

Description: Initializes a Curve instance using the Brainpool P-384 elliptic curve.

BP512

BP512

Description: Initializes a Curve instance using the Brainpool P-512 elliptic curve.

P224

P224

Description: Initializes a Curve instance using the NIST P-224 elliptic curve.

P256

P256

Description: Initializes a Curve instance using the NIST P-256 elliptic curve.

P384

P384

Description: Initializes a Curve instance using the NIST P-384 elliptic curve.

P521

P521

Description: Initializes a Curve instance using the NIST P-521 elliptic curve.

enum PadOption

public enum PadOption {
    | OAEP(OAEPOption) | PSS(PSSOption) | PKCS1
}

Description: Specifies the padding mode of the RSA.

RSA has the following three common padding modes:

OAEP is the optimal asymmetric encryption padding mode and can be used only for encryption and decryption. PSS is a probabilistic signature scheme mode and can be used only for signing and verification. PKCS1 is a common padding mode used to pad the data length. It can be used for encryption, decryption, signing, and verification. The PKCS1 padding mode of the RSA is defined in PKCS #1 v1.5. Currently, attacks on the PKCS1 padding mode are mature, and attackers can easily decrypt or forge signatures. It is advised to use the more secure PSS or OAEP padding mode in PKCS #1 v2.

OAEP(OAEPOption)

OAEP(OAEPOption)

Description: Initializes a PadOption instance using the optimal asymmetric encryption.

PKCS1

PKCS1

Description: Initializes a PadOption instance using the PKCS #1 public key cryptography standard.

PSS(PSSOption)

PSS(PSSOption)

Description: Initializes a PadOption instance using the probabilistic signature scheme.