Microsoft.Protocols.TestSuites.MS_WOPI.RSACryptoContext.SignData C# (CSharp) Method

SignData() private static method

A method is used to sign the data with specified key-pairs. The signed data only pass the validation by using the public key part of the specified key-pairs.
private static SignData ( byte originalData, byte fullkeyBlob ) : byte[]
originalData byte A parameter represents the binaries data which will be signed with old key-pairs.
fullkeyBlob byte A parameter represents the binaries data of the unique key-pairs which is match the asymmetric encrypt algorithm.
return byte[]
        private static byte[] SignData(byte[] originalData, byte[] fullkeyBlob)
        {
            if (null == originalData || 0 == originalData.Length)
            {
                throw new ArgumentNullException("originalData");
            }

            if (null == fullkeyBlob || 0 == fullkeyBlob.Length)
            {
                throw new ArgumentNullException("fullkeyBlob");
            }

            using (RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider())
            {
                rsaProvider.ImportCspBlob(fullkeyBlob);
                SHA256Managed sha = new SHA256Managed();
                byte[] signedData = rsaProvider.SignData(originalData, sha);
                sha.Dispose();
                return signedData;
            }
        }