C# 클래스 System.Security.Cryptography.RSACryptoServiceProvider

상속: RSA, ICspAsymmetricAlgorithm
파일 보기 프로젝트 열기: dotnet/corefx 1 사용 예제들

Private Properties

프로퍼티 타입 설명
AcquireSafeProviderHandle System.Security.Cryptography.SafeProvHandle
GetAlgorithmId int
GetHashAlgorithm HashAlgorithm
HashAlgorithmNameNullOrEmpty Exception
IsPublic bool
IsPublic bool
PaddingModeNotSupported Exception
RSACryptoServiceProvider System.Diagnostics
SignHash byte[]
VerifyHash bool

공개 메소드들

메소드 설명
Decrypt ( byte data, RSAEncryptionPadding padding ) : byte[]
Decrypt ( byte rgb, bool fOAEP ) : byte[]

Decrypt raw data, generally used for decrypting symmetric key material

Encrypt ( byte data, RSAEncryptionPadding padding ) : byte[]
Encrypt ( byte rgb, bool fOAEP ) : byte[]

Encrypt raw data, generally used for encrypting symmetric key material.

This method can only encrypt (keySize - 88 bits) of data, so should not be used for encrypting arbitrary byte arrays. Instead, encrypt a symmetric key with this method, and use the symmetric key to encrypt the sensitive data.

ExportCspBlob ( bool includePrivateParameters ) : byte[]

Exports a blob containing the key information associated with an RSACryptoServiceProvider object.

ExportParameters ( bool includePrivateParameters ) : RSAParameters

Exports the RSAParameters

ImportCspBlob ( byte keyBlob ) : void

Imports a blob that represents RSA key information

ImportParameters ( RSAParameters parameters ) : void

Imports the specified RSAParameters

RSACryptoServiceProvider ( ) : System.Diagnostics
RSACryptoServiceProvider ( CspParameters parameters ) : System.Diagnostics
RSACryptoServiceProvider ( int dwKeySize ) : System.Diagnostics
RSACryptoServiceProvider ( int dwKeySize, CspParameters parameters ) : System.Diagnostics
SignData ( Stream inputStream, Object halg ) : byte[]

Computes the hash value of a subset of the specified byte array using the specified hash algorithm, and signs the resulting hash value.

SignData ( byte buffer, Object halg ) : byte[]

Computes the hash value of a subset of the specified byte array using the specified hash algorithm, and signs the resulting hash value.

SignData ( byte buffer, int offset, int count, object halg ) : byte[]

Computes the hash value of a subset of the specified byte array using the specified hash algorithm, and signs the resulting hash value.

SignHash ( byte hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding ) : byte[]
SignHash ( byte rgbHash, string str ) : byte[]

Computes the hash value of a subset of the specified byte array using the specified hash algorithm, and signs the resulting hash value.

VerifyData ( byte buffer, object halg, byte signature ) : bool

Verifies the signature of a hash value.

VerifyHash ( byte hash, byte signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding ) : bool
VerifyHash ( byte rgbHash, string str, byte rgbSignature ) : bool

Verifies the signature of a hash value.

보호된 메소드들

메소드 설명
Dispose ( bool disposing ) : void

Dispose the key handles

HashData ( Stream data, HashAlgorithmName hashAlgorithm ) : byte[]
HashData ( byte data, int offset, int count, HashAlgorithmName hashAlgorithm ) : byte[]

비공개 메소드들

메소드 설명
AcquireSafeProviderHandle ( ) : System.Security.Cryptography.SafeProvHandle

This method helps Acquire the default CSP and avoids the need for static SafeProvHandle in CapiHelper class

GetAlgorithmId ( HashAlgorithmName hashAlgorithm ) : int
GetHashAlgorithm ( HashAlgorithmName hashAlgorithm ) : HashAlgorithm
HashAlgorithmNameNullOrEmpty ( ) : Exception
IsPublic ( RSAParameters rsaParams ) : bool

Since P is required, we will assume its presence is synonymous to a private key.

IsPublic ( byte keyBlob ) : bool

find whether an RSA key blob is public.

PaddingModeNotSupported ( ) : Exception
RSACryptoServiceProvider ( int keySize, CspParameters parameters, bool useDefaultKeySize ) : System.Diagnostics
SignHash ( byte rgbHash, int calgHash ) : byte[]

Computes the hash value of a subset of the specified byte array using the specified hash algorithm, and signs the resulting hash value.

VerifyHash ( byte rgbHash, int calgHash, byte rgbSignature ) : bool

Verifies the signature of a hash value.

메소드 상세

Decrypt() 공개 메소드

public Decrypt ( byte data, RSAEncryptionPadding padding ) : byte[]
data byte
padding RSAEncryptionPadding
리턴 byte[]

Decrypt() 공개 메소드

Decrypt raw data, generally used for decrypting symmetric key material
public Decrypt ( byte rgb, bool fOAEP ) : byte[]
rgb byte encrypted data
fOAEP bool true to use OAEP padding (PKCS #1 v2), false to use PKCS #1 type 2 padding
리턴 byte[]

Dispose() 보호된 메소드

Dispose the key handles
protected Dispose ( bool disposing ) : void
disposing bool
리턴 void

Encrypt() 공개 메소드

public Encrypt ( byte data, RSAEncryptionPadding padding ) : byte[]
data byte
padding RSAEncryptionPadding
리턴 byte[]

Encrypt() 공개 메소드

Encrypt raw data, generally used for encrypting symmetric key material.
This method can only encrypt (keySize - 88 bits) of data, so should not be used for encrypting arbitrary byte arrays. Instead, encrypt a symmetric key with this method, and use the symmetric key to encrypt the sensitive data.
public Encrypt ( byte rgb, bool fOAEP ) : byte[]
rgb byte raw data to encrypt
fOAEP bool true to use OAEP padding (PKCS #1 v2), false to use PKCS #1 type 2 padding
리턴 byte[]

ExportCspBlob() 공개 메소드

Exports a blob containing the key information associated with an RSACryptoServiceProvider object.
public ExportCspBlob ( bool includePrivateParameters ) : byte[]
includePrivateParameters bool
리턴 byte[]

ExportParameters() 공개 메소드

Exports the RSAParameters
public ExportParameters ( bool includePrivateParameters ) : RSAParameters
includePrivateParameters bool
리턴 RSAParameters

HashData() 보호된 메소드

protected HashData ( Stream data, HashAlgorithmName hashAlgorithm ) : byte[]
data System.IO.Stream
hashAlgorithm HashAlgorithmName
리턴 byte[]

HashData() 보호된 메소드

protected HashData ( byte data, int offset, int count, HashAlgorithmName hashAlgorithm ) : byte[]
data byte
offset int
count int
hashAlgorithm HashAlgorithmName
리턴 byte[]

ImportCspBlob() 공개 메소드

Imports a blob that represents RSA key information
public ImportCspBlob ( byte keyBlob ) : void
keyBlob byte
리턴 void

ImportParameters() 공개 메소드

Imports the specified RSAParameters
public ImportParameters ( RSAParameters parameters ) : void
parameters RSAParameters
리턴 void

RSACryptoServiceProvider() 공개 메소드

public RSACryptoServiceProvider ( ) : System.Diagnostics
리턴 System.Diagnostics

RSACryptoServiceProvider() 공개 메소드

public RSACryptoServiceProvider ( CspParameters parameters ) : System.Diagnostics
parameters CspParameters
리턴 System.Diagnostics

RSACryptoServiceProvider() 공개 메소드

public RSACryptoServiceProvider ( int dwKeySize ) : System.Diagnostics
dwKeySize int
리턴 System.Diagnostics

RSACryptoServiceProvider() 공개 메소드

public RSACryptoServiceProvider ( int dwKeySize, CspParameters parameters ) : System.Diagnostics
dwKeySize int
parameters CspParameters
리턴 System.Diagnostics

SignData() 공개 메소드

Computes the hash value of a subset of the specified byte array using the specified hash algorithm, and signs the resulting hash value.
public SignData ( Stream inputStream, Object halg ) : byte[]
inputStream System.IO.Stream The input data for which to compute the hash
halg Object The hash algorithm to use to create the hash value.
리턴 byte[]

SignData() 공개 메소드

Computes the hash value of a subset of the specified byte array using the specified hash algorithm, and signs the resulting hash value.
public SignData ( byte buffer, Object halg ) : byte[]
buffer byte The input data for which to compute the hash
halg Object The hash algorithm to use to create the hash value.
리턴 byte[]

SignData() 공개 메소드

Computes the hash value of a subset of the specified byte array using the specified hash algorithm, and signs the resulting hash value.
public SignData ( byte buffer, int offset, int count, object halg ) : byte[]
buffer byte The input data for which to compute the hash
offset int The offset into the array from which to begin using data
count int The number of bytes in the array to use as data.
halg object The hash algorithm to use to create the hash value.
리턴 byte[]

SignHash() 공개 메소드

public SignHash ( byte hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding ) : byte[]
hash byte
hashAlgorithm HashAlgorithmName
padding RSASignaturePadding
리턴 byte[]

SignHash() 공개 메소드

Computes the hash value of a subset of the specified byte array using the specified hash algorithm, and signs the resulting hash value.
public SignHash ( byte rgbHash, string str ) : byte[]
rgbHash byte The input data for which to compute the hash
str string The hash algorithm to use to create the hash value.
리턴 byte[]

VerifyData() 공개 메소드

Verifies the signature of a hash value.
public VerifyData ( byte buffer, object halg, byte signature ) : bool
buffer byte
halg object
signature byte
리턴 bool

VerifyHash() 공개 메소드

public VerifyHash ( byte hash, byte signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding ) : bool
hash byte
signature byte
hashAlgorithm HashAlgorithmName
padding RSASignaturePadding
리턴 bool

VerifyHash() 공개 메소드

Verifies the signature of a hash value.
public VerifyHash ( byte rgbHash, string str, byte rgbSignature ) : bool
rgbHash byte
str string
rgbSignature byte
리턴 bool