Type Method
create()
Creates a new secp256k1 context and randomizes it with cryptographically secure bytes for side-channel protection.
- iOS 13.0+
- macCatalyst 13.0+
- macOS 10.15+
- tvOS 13.0+
- visionOS 1.0+
- watchOS 6.0+
static func create() -> OpaquePointer
Return Value
An opaque pointer to the newly created and randomized secp256k1 context.
Discussion
This method allocates a new secp256k1 context using secp256k1_context_create with the rawValue flags, then calls secp256k1_context_randomize with 32 bytes of secure randomness from SecureBytes. Randomization seeds an internal counter that blinds intermediate values during secret scalar multiplication with the elliptic curve base point, protecting ECDSA signing, Schnorr signing, and public key generation against timing and power analysis attacks.
Precondition
Context creation and randomization must both succeed. A precondition failure occurs if secp256k1_context_create returns nil or if secp256k1_context_randomize fails.