C# Class Opc.Ua.RsaUtils

Defines functions to implement RSA cryptography.
ファイルを表示 Open project: OPCFoundation/UA-.NETStandardLibrary Class Usage Examples

Public Methods

Method Description
Decrypt ( ArraySegment dataToDecrypt, X509Certificate2 encryptingCertificate, bool useOaep, ArraySegment outputBuffer ) : ArraySegment

Des the message using RSA OAEP encryption.

Decrypt ( ArraySegment dataToDecrypt, X509Certificate2 encryptingCertificate, bool useOaep ) : byte[]

Encrypts the data using RSA PKCS#1 v1.5 encryption.

Encrypt ( ArraySegment dataToEncrypt, X509Certificate2 encryptingCertificate, bool useOaep, ArraySegment outputBuffer ) : ArraySegment

Encrypts the data using RSA PKCS#1 v1.5 or OAEP encryption.

Encrypt ( byte dataToEncrypt, X509Certificate2 encryptingCertificate, bool useOaep ) : byte[]

Encrypts the data using RSA PKCS#1 v1.5 encryption.

GetCipherTextBlockSize ( X509Certificate2 encryptingCertificate, bool useOaep ) : int

Return the ciphertext block size for RSA OAEP encryption.

GetPlainTextBlockSize ( X509Certificate2 encryptingCertificate, bool useOaep ) : int

Return the plaintext block size for RSA OAEP encryption.

RsaPkcs15Sha1_Sign ( ArraySegment dataToSign, X509Certificate2 signingCertificate ) : byte[]

Computes an RSA/SHA1 PKCS#1 v1.5 signature.

RsaPkcs15Sha1_Verify ( ArraySegment dataToVerify, byte signature, X509Certificate2 signingCertificate ) : bool

Verifies an RSA/SHA1 PKCS#1 v1.5 signature.

RsaPkcs15Sha256_Sign ( ArraySegment dataToSign, X509Certificate2 signingCertificate ) : byte[]

Computes an RSA/SHA256 PKCS#1 v1.5 signature.

RsaPkcs15Sha256_Verify ( ArraySegment dataToVerify, byte signature, X509Certificate2 signingCertificate ) : bool

Verifies an RSA/SHA256 PKCS#1 v1.5 signature.

RsaPkcs15_GetSignatureLength ( X509Certificate2 signingCertificate ) : int

Returns the length of a RSA PKCS#1 v1.5 signature of a digest.

Method Details

Decrypt() public static method

Des the message using RSA OAEP encryption.
public static Decrypt ( ArraySegment dataToDecrypt, X509Certificate2 encryptingCertificate, bool useOaep, ArraySegment outputBuffer ) : ArraySegment
dataToDecrypt ArraySegment
encryptingCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
useOaep bool
outputBuffer ArraySegment
return ArraySegment

Decrypt() public static method

Encrypts the data using RSA PKCS#1 v1.5 encryption.
public static Decrypt ( ArraySegment dataToDecrypt, X509Certificate2 encryptingCertificate, bool useOaep ) : byte[]
dataToDecrypt ArraySegment
encryptingCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
useOaep bool
return byte[]

Encrypt() public static method

Encrypts the data using RSA PKCS#1 v1.5 or OAEP encryption.
public static Encrypt ( ArraySegment dataToEncrypt, X509Certificate2 encryptingCertificate, bool useOaep, ArraySegment outputBuffer ) : ArraySegment
dataToEncrypt ArraySegment
encryptingCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
useOaep bool
outputBuffer ArraySegment
return ArraySegment

Encrypt() public static method

Encrypts the data using RSA PKCS#1 v1.5 encryption.
public static Encrypt ( byte dataToEncrypt, X509Certificate2 encryptingCertificate, bool useOaep ) : byte[]
dataToEncrypt byte
encryptingCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
useOaep bool
return byte[]

GetCipherTextBlockSize() public static method

Return the ciphertext block size for RSA OAEP encryption.
public static GetCipherTextBlockSize ( X509Certificate2 encryptingCertificate, bool useOaep ) : int
encryptingCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
useOaep bool
return int

GetPlainTextBlockSize() public static method

Return the plaintext block size for RSA OAEP encryption.
public static GetPlainTextBlockSize ( X509Certificate2 encryptingCertificate, bool useOaep ) : int
encryptingCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
useOaep bool
return int

RsaPkcs15Sha1_Sign() public static method

Computes an RSA/SHA1 PKCS#1 v1.5 signature.
public static RsaPkcs15Sha1_Sign ( ArraySegment dataToSign, X509Certificate2 signingCertificate ) : byte[]
dataToSign ArraySegment
signingCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
return byte[]

RsaPkcs15Sha1_Verify() public static method

Verifies an RSA/SHA1 PKCS#1 v1.5 signature.
public static RsaPkcs15Sha1_Verify ( ArraySegment dataToVerify, byte signature, X509Certificate2 signingCertificate ) : bool
dataToVerify ArraySegment
signature byte
signingCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
return bool

RsaPkcs15Sha256_Sign() public static method

Computes an RSA/SHA256 PKCS#1 v1.5 signature.
public static RsaPkcs15Sha256_Sign ( ArraySegment dataToSign, X509Certificate2 signingCertificate ) : byte[]
dataToSign ArraySegment
signingCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
return byte[]

RsaPkcs15Sha256_Verify() public static method

Verifies an RSA/SHA256 PKCS#1 v1.5 signature.
public static RsaPkcs15Sha256_Verify ( ArraySegment dataToVerify, byte signature, X509Certificate2 signingCertificate ) : bool
dataToVerify ArraySegment
signature byte
signingCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
return bool

RsaPkcs15_GetSignatureLength() public static method

Returns the length of a RSA PKCS#1 v1.5 signature of a digest.
public static RsaPkcs15_GetSignatureLength ( X509Certificate2 signingCertificate ) : int
signingCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
return int