Skip to content

Asymmetric Class ​

Definition ​

Public class for performing Asymmetric encryption and decryption

  • Namespace: JASE.Crypto
  • Assembly: JASE.Crypto.dll

Methods ​

NameDescription
byte[] Decrypt(byte[] input, X509Certificate2 certificate, RsaPadding padding = null, bool allowInvalidTime = null)Decrypts the input data using the private key of the specified X.509 certificate.
byte[] Decrypt(byte[] input, byte[] key, RsaPadding padding = null)Decrypts the specified data using an RSA private key provided as a byte array.
byte[] Decrypt(byte[] input, string keyInXml, RsaPadding padding = null)Decrypts the specified data using an RSA private key provided in XML format.
byte[] DecryptAndVerify(byte[] input, X509Certificate2 recipient, X509Certificate2 sender, bool allowInvalidTime = null)Decrypts and verifies the input data using the private key of the specified X.509 certificate.
byte[] Encrypt(byte[] input, X509Certificate2 certificate, RsaPadding padding = null, bool allowInvalidTime = null)Encrypts the input data using the public key of the specified X.509 certificate.
byte[] Encrypt(byte[] input, byte[] publicKey, RsaPadding padding = null)Encrypts the specified data using an RSA public key in raw byte array format.
byte[] Encrypt(byte[] input, string keyInXml, RsaPadding padding = null)Encrypts the specified data using an RSA public key provided in XML format.
byte[] EncryptAndSign(byte[] input, X509Certificate2 recipient, X509Certificate2 sender, bool allowInvalidTime = null)Sign the input byte array using the private key from the provided X509Certificate2
bool GenerateRsaKeyPair(out byte[] publicKey, out byte[] privateKey, int keySize)Generates a new RSA key pair and returns the keys as raw byte arrays.
bool GenerateRsaKeyPair(out string publicKey, out string privateKey, int keySize)Generates a new RSA key pair and returns the keys as XML-formatted strings.
bool GenerateSshRsaKeyPair(out string publicKey, out string privateKey, int keySize = null, KeyFormat privateKeyFormat = null, KeyFormat publicKeyFormat = null)Generate an Ssh compatible Rsa Key
ECCurve ResolveECCurve(ECCurve curve)Resolved ECCurve to System.Security.Cryptography.ECCurve
RSAEncryptionPadding ResolveRsaPadding(RsaPadding padding)Resolve RsaPadding to RSAEncryptionPadding
RSASignaturePadding ResolveSignaturePadding(RsaSignaturePadding padding)Resolve enum.RsaPadding to RSAEncryptionPadding
byte[] Sign(byte[] input, X509Certificate2 certificate, HashProvider hash = null, RsaSignaturePadding? padding = null)Sign the input byte array using the private key from the provided X509Certificate2
byte[] Sign(byte[] input, byte[] key, HashProvider hash = null)Signs the input data using the provided RSA private key, hash algorithm, and signature padding.
bool Verify(byte[] input, byte[] signature, X509Certificate2 certificate, HashProvider hash = null, RsaSignaturePadding? padding = null)Verifies the digital signature of the given data using the provided RSA public key.
bool Verify(byte[] message, byte[] signature, byte[] key, HashProvider hash = null)Verifies the digital signature of the given data using the provided RSA public key.
bool VerifyDataFromKey(string base64ExportedKey, byte[] input, byte[] signature, HashProvider hash)Verifies the data using a public key.
bool VerifyDataFromKey(string base64ExportedKey, string input, string signature, HashProvider hash)Verifies the data using a public key, with the input data and signature provided as strings.