represents the private part of a key pair for a public-key cryptographic system.
- PrivateKey objects can be used with functions such as Encrypt, Decrypt and GenerateDigitalSignature.
- For encryption, data can only be decrypted with a particular PrivateKey object if it was encrypted with the corresponding PublicKey object.
- Corresponding pairs of PrivateKey and PublicKey objects can be generated with GenerateAsymmetricKeyPair.
- PrivateKey[…]["prop"] can be used to extract properties of the private key.
- Basic properties for a PrivateKey include:
"Type" type of cryptography "PrivateByteArray" private key as a byte array "PublicByteArray" public key as a byte array "PrivateHexString" private key as a hex string "PublicHexString" public key as a hex string "PrivateKeySize" size of private key in bits "PublicKeySize" size of public key in bits
- Possible types of cryptography include "RSA" and "EllipticCurve".
- Additional properties for "RSA" include:
"PrivateExponent" private exponent "PublicExponent" public exponent "PublicModulus" public modulus "Padding" padding mode
- Additional properties for "EllipticCurve" include:
"CurveName" name of elliptic curve (e.g. "sec256k1") "PrivateMultiplier" private multiplier "PublicCurvePoint" public curve point "Compressed" whether the public key is in compressed form
- Possible settings for "CurveName" are listed in $CryptographicEllipticCurveNames.
- PrivateKey[…]["Parameters"] gives all the information contained in the object as an association.
- PrivateKey[…]["Properties"] gives a list of available properties.
Examplesopen allclose all
Basic Examples (2)
You can use PrivateKey as a constructor for a valid private key object.
Construct a valid PrivateKey object from an existing key provided as a hex string:
Properties & Relations (2)
Use a ByteArray representation:
To reconstruct a PrivateKey object for RSA, provide both the private exponent and the public modulus:
Recreate the same object as initially obtained from GenerateAsymmetricKeyPair:
Wolfram Research (2015), PrivateKey, Wolfram Language function, https://reference.wolfram.com/language/ref/PrivateKey.html (updated 2020).
Wolfram Language. 2015. "PrivateKey." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/PrivateKey.html.
Wolfram Language. (2015). PrivateKey. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PrivateKey.html