This documentation is archived and is not being maintained.

DSACryptoServiceProvider.CreateSignature Method

Creates the DSA signature for the specified data.

[Visual Basic]
Overrides Public Function CreateSignature( _
   ByVal rgbHash() As Byte _
) As Byte()
[C#]
public override byte[] CreateSignature(
 byte[] rgbHash
);
[C++]
public: unsigned char CreateSignature(
 unsigned char rgbHash __gc[]
)  __gc[];
[JScript]
public override function CreateSignature(
   rgbHash : Byte[]
) : Byte[];

Parameters

rgbHash
The data to be signed.

Return Value

The digital signature for the specified data.

Example

[Visual Basic] 
Try
    'Create a new instance of DSACryptoServiceProvider.
    Dim DSA As New DSACryptoServiceProvider()

    'The hash to sign.
    Dim Hash As Byte() = {59, 4, 248, 102, 77, 97, 142, 201, 210, 12, 224, 93, 25, 41, 100, 197, 213, 134, 130, 135}

    'Sign the hash.
    Dim SignedHash As Byte() = DSA.CreateSignature(Hash)


Catch e As CryptographicException
    Console.WriteLine(e.Message)
End Try

[C#] 
try
{
    //Create a new instance of DSACryptoServiceProvider.
    DSACryptoServiceProvider DSA = new DSACryptoServiceProvider();

    //The hash to sign.
    byte[] Hash = {59,4,248,102,77,97,142,201,210,12,224,93,25,41,100,197,213,134,130,135};
    
    //Sign the hash.
    byte[] SignedHash = DSA.CreateSignature(Hash);


}
catch(CryptographicException e)
{
    Console.WriteLine(e.Message);
}

[C++] 
try {
    //Create a new instance of DSACryptoServiceProvider.
    DSACryptoServiceProvider* DSA = new DSACryptoServiceProvider();

    //The hash to sign.
    Byte Hash[] = {59,4,248,102,77,97,142,201,210,12,224,93,25,41,100,197,213,134,130,135};

    //Sign the hash.
    Byte SignedHash[] = DSA->CreateSignature(Hash);
} catch (CryptographicException* e) {
    Console::WriteLine(e->Message);
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

DSACryptoServiceProvider Class | DSACryptoServiceProvider Members | System.Security.Cryptography Namespace | Cryptographic Services

Show: