Freigeben über


DSACryptoServiceProvider.CreateSignature-Methode

Erstellt die DSA-Signatur für die angegebenen Daten.

Namespace: System.Security.Cryptography
Assembly: mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Overrides Function CreateSignature ( _
    rgbHash As Byte() _
) As Byte()
'Usage
Dim instance As DSACryptoServiceProvider
Dim rgbHash As Byte()
Dim returnValue As Byte()

returnValue = instance.CreateSignature(rgbHash)
public override byte[] CreateSignature (
    byte[] rgbHash
)
public:
virtual array<unsigned char>^ CreateSignature (
    array<unsigned char>^ rgbHash
) override
public byte[] CreateSignature (
    byte[] rgbHash
)
public override function CreateSignature (
    rgbHash : byte[]
) : byte[]

Parameter

  • rgbHash
    Die zu signierenden Daten.

Rückgabewert

Die digitale Signatur für die angegebenen Daten.

Beispiel

Im folgenden Codebeispiel werden Daten unter Verwendung der DSACryptoServiceProvider-Klasse signiert.

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
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);
}
try
{
   //Create a new instance of DSACryptoServiceProvider.
   DSACryptoServiceProvider^ DSA = gcnew DSACryptoServiceProvider;
   
   //The hash to sign.
   array<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.
   array<Byte>^ SignedHash = DSA->CreateSignature( Hash );
}
catch ( CryptographicException^ e ) 
{
   Console::WriteLine( e->Message );
}
try {
    // Create a new instance of DSACryptoServiceProvider.
    DSACryptoServiceProvider dsa = new DSACryptoServiceProvider();

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

    // Sign the hash.
    ubyte signedHash[] = dsa.CreateSignature(hash);
}
catch (CryptographicException e) {
    Console.WriteLine(e.get_Message());
}

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0

Siehe auch

Referenz

DSACryptoServiceProvider-Klasse
DSACryptoServiceProvider-Member
System.Security.Cryptography-Namespace

Weitere Ressourcen

Kryptografische Dienste