C# Class System.Security.Cryptography.DSACryptoServiceProvider

Inheritance: DSA, ICspAsymmetricAlgorithm
Datei anzeigen Open project: dotnet/corefx Class Usage Examples

Private Properties

Property Type Description
AcquireSafeProviderHandle System.Security.Cryptography.SafeProvHandle
DSACryptoServiceProvider System.Diagnostics
IsPublic bool

Public Methods

Method Description
CreateSignature ( byte rgbHash ) : byte[]

Creates the DSA signature for the specified data.

DSACryptoServiceProvider ( ) : System.Diagnostics

Initializes a new instance of the DSACryptoServiceProvider class.

DSACryptoServiceProvider ( CspParameters parameters ) : System.Diagnostics

Initializes a new instance of the DSACryptoServiceProvider class with the specified parameters for the cryptographic service provider (CSP).

DSACryptoServiceProvider ( int dwKeySize ) : System.Diagnostics

Initializes a new instance of the DSACryptoServiceProvider class with the specified key size.

ExportCspBlob ( bool includePrivateParameters ) : byte[]

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

ExportParameters ( bool includePrivateParameters ) : DSAParameters
ImportCspBlob ( byte keyBlob ) : void

Imports a blob that represents DSA key information.

ImportParameters ( DSAParameters parameters ) : void
SignData ( Stream inputStream ) : byte[]

Computes the hash value of the specified input stream and signs the resulting hash value.

SignData ( byte buffer ) : byte[]

Computes the hash value of the specified input stream and signs the resulting hash value.

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

Signs a byte array from the specified start point to the specified end point.

SignHash ( byte rgbHash, string str ) : byte[]

Computes the signature for the specified hash value by encrypting it with the private key.

VerifyData ( byte rgbData, byte rgbSignature ) : bool

Verifies the specified signature data by comparing it to the signature computed for the specified data.

VerifyHash ( byte rgbHash, string str, byte rgbSignature ) : bool

Verifies the specified signature data by comparing it to the signature computed for the specified hash value.

VerifySignature ( byte rgbHash, byte rgbSignature ) : bool

Protected Methods

Method Description
Dispose ( bool disposing ) : void
HashData ( Stream data, HashAlgorithmName hashAlgorithm ) : byte[]
HashData ( byte data, int offset, int count, HashAlgorithmName hashAlgorithm ) : byte[]

Private Methods

Method Description
AcquireSafeProviderHandle ( ) : System.Security.Cryptography.SafeProvHandle

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

DSACryptoServiceProvider ( int dwKeySize, CspParameters parameters ) : System.Diagnostics
IsPublic ( byte keyBlob ) : bool

Find whether a DSS key blob is public.

Method Details

CreateSignature() public method

Creates the DSA signature for the specified data.
public CreateSignature ( byte rgbHash ) : byte[]
rgbHash byte The data to be signed.
return byte[]

DSACryptoServiceProvider() public method

Initializes a new instance of the DSACryptoServiceProvider class.
public DSACryptoServiceProvider ( ) : System.Diagnostics
return System.Diagnostics

DSACryptoServiceProvider() public method

Initializes a new instance of the DSACryptoServiceProvider class with the specified parameters for the cryptographic service provider (CSP).
public DSACryptoServiceProvider ( CspParameters parameters ) : System.Diagnostics
parameters CspParameters The parameters for the CSP.
return System.Diagnostics

DSACryptoServiceProvider() public method

Initializes a new instance of the DSACryptoServiceProvider class with the specified key size.
public DSACryptoServiceProvider ( int dwKeySize ) : System.Diagnostics
dwKeySize int The size of the key for the asymmetric algorithm in bits.
return System.Diagnostics

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void

ExportCspBlob() public method

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

ExportParameters() public method

public ExportParameters ( bool includePrivateParameters ) : DSAParameters
includePrivateParameters bool
return DSAParameters

HashData() protected method

protected HashData ( Stream data, HashAlgorithmName hashAlgorithm ) : byte[]
data Stream
hashAlgorithm HashAlgorithmName
return byte[]

HashData() protected method

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

ImportCspBlob() public method

Imports a blob that represents DSA key information.
public ImportCspBlob ( byte keyBlob ) : void
keyBlob byte A byte array that represents a DSA key blob.
return void

ImportParameters() public method

public ImportParameters ( DSAParameters parameters ) : void
parameters DSAParameters
return void

SignData() public method

Computes the hash value of the specified input stream and signs the resulting hash value.
public SignData ( Stream inputStream ) : byte[]
inputStream Stream The input data for which to compute the hash.
return byte[]

SignData() public method

Computes the hash value of the specified input stream and signs the resulting hash value.
public SignData ( byte buffer ) : byte[]
buffer byte The input data for which to compute the hash.
return byte[]

SignData() public method

Signs a byte array from the specified start point to the specified end point.
public SignData ( byte buffer, int offset, int count ) : byte[]
buffer byte The input data to sign.
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.
return byte[]

SignHash() public method

Computes the signature for the specified hash value by encrypting it with the private key.
public SignHash ( byte rgbHash, string str ) : byte[]
rgbHash byte The hash value of the data to be signed.
str string The name of the hash algorithm used to create the hash value of the data.
return byte[]

VerifyData() public method

Verifies the specified signature data by comparing it to the signature computed for the specified data.
public VerifyData ( byte rgbData, byte rgbSignature ) : bool
rgbData byte The data that was signed.
rgbSignature byte The signature data to be verified.
return bool

VerifyHash() public method

Verifies the specified signature data by comparing it to the signature computed for the specified hash value.
public VerifyHash ( byte rgbHash, string str, byte rgbSignature ) : bool
rgbHash byte The hash value of the data to be signed.
str string The name of the hash algorithm used to create the hash value of the data.
rgbSignature byte The signature data to be verified.
return bool

VerifySignature() public method

public VerifySignature ( byte rgbHash, byte rgbSignature ) : bool
rgbHash byte
rgbSignature byte
return bool