Export (0) Print
Expand All

RSACryptoServiceProvider.SignData Method (Byte[], Int32, Int32, Object)

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

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

member SignData : 
        buffer:byte[] * 
        offset:int * 
        count:int * 
        halg:Object -> byte[] 

Parameters

buffer
Type: System.Byte[]

The input data for which to compute the hash.

offset
Type: System.Int32

The offset into the array from which to begin using data.

count
Type: System.Int32

The number of bytes in the array to use as data.

halg
Type: System.Object

The hash algorithm to use to create the hash value.

Return Value

Type: System.Byte[]
The RSA signature for the specified data.

ExceptionCondition
ArgumentNullException

The halg parameter is a null reference (Nothing in Visual Basic).

ArgumentException

The halg parameter is not a valid type.

This method creates a digital signature that is verified using the VerifyData method.

The halg parameter can accept a String, a HashAlgorithm, or a Type. The string value can be one of the following:

  • The object identifier (OID) friendly name of the hash algorithm to use, either a name registered in the crypto config file or one in the Crypto API OID table.

  • The OID value. The OID must be one recognized by the Crypto API.

For example, you could use SignData(new byte[5], "1.3.14.3.2.26") or SignData(new byte[5], "sha1"), or SignData(new byte[5], "SHA1").

The following code example signs and verifies data.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft