SignData Method (Byte[], Int32, Int32, Object)
Collapse the table of content
Expand the table of content

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

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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)

public byte[] SignData(
	byte[] buffer,
	int offset,
	int count,
	Object halg


Type: System.Byte []
The input data for which to compute the hash.
Type: System.Int32
The offset into the array from which to begin using data.
Type: System.Int32
The number of bytes in the array to use as data.
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.


The halg parameter is null.


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], "") or SignData(new byte[5], "sha1"), or SignData(new byte[5], "SHA1").

Windows Phone OS

Supported in: 8.1, 8.0, 7.1

Windows Phone

© 2017 Microsoft