Static Methodswift-crypto 3.8.0_CryptoExtras
_createFromNumbers(n:e:d:)
Construct a private key with the specified parameters.
RSA.swift:631static func _createFromNumbers(n: some ContiguousBytes, e: some ContiguousBytes, d: some ContiguousBytes) throws -> _RSA.Encryption.PrivateKey
Parameters
The use of this API is strongly discouraged for performance reasons, as it requires the factorization of the modulus, which is resource-intensive. It is recommended to use the other initializers to construct a private key, unless you have only the modulus, public exponent, and private exponent to construct the key.
Other members in extension
Type members
init<Bytes>(derRepresentation: Bytes
) throws Construct an RSA private key from a DER representation.
init(keySize: _RSA.Signing.KeySize
) throws Randomly generate a new RSA private key of a given size.
init(n: some ContiguousBytes, e: some ContiguousBytes, d: some ContiguousBytes, p: some ContiguousBytes, q: some ContiguousBytes
) throws Construct an RSA private key with the specified parameters.
init(pemRepresentation: String
) throws Construct an RSA private key from a PEM representation.
init<Bytes>(unsafeDERRepresentation: Bytes
) throws Construct an RSA public key from a DER representation.
init(unsafeKeySize: _RSA.Signing.KeySize
) throws Randomly generate a new RSA private key of a given size.
init(unsafePEMRepresentation: String
) throws Construct an RSA public key from a PEM representation.
Instance members
var derRepresentation: Data
var keySizeInBits: Int
var pemRepresentation: String
var pkcs8PEMRepresentation: String
var publicKey: _RSA.Encryption.PublicKey
func decrypt<D>(D, padding: _RSA.Encryption.Padding
) throws -> Data Decrypt a message encrypted with this key’s public key and using the specified padding mode.