public override byte[] Sign(byte[] data, SignatureHashAlgorithm hashAlgorithm)
        {
            HashAlgorithm hashAlgorithm2 = hashAlgorithm.CreateAlgorithm();

            byte[] array = hashAlgorithm2.ComputeHash(data);
            CngNative.BCRYPT_PKCS1_PADDING_INFO bCRYPT_PKCS1_PADDING_INFO = default(CngNative.BCRYPT_PKCS1_PADDING_INFO);
            bCRYPT_PKCS1_PADDING_INFO.pszAlgId = hashAlgorithm.Name;
            int num;

            CngNative.ErrorCode status = CngNative.NCryptSignHashPkcs1(base.KeyHandle, ref bCRYPT_PKCS1_PADDING_INFO, array, array.Length, null, 0, out num, CngNative.AsymmetricPaddingMode.Pkcs1);
            CngNative.VerifyStatus(status);
            byte[] array2 = new byte[num];
            status = CngNative.NCryptSignHashPkcs1(base.KeyHandle, ref bCRYPT_PKCS1_PADDING_INFO, array, array.Length, array2, array2.Length, out num, CngNative.AsymmetricPaddingMode.Pkcs1);
            CngNative.VerifyStatus(status);
            return(array2);
        }
 internal static extern CngNative.ErrorCode NCryptSignHashPkcs1(SafeCryptKeyHandle hKey, [In] ref CngNative.BCRYPT_PKCS1_PADDING_INFO pPaddingInfo, [MarshalAs(UnmanagedType.LPArray)][In] byte[] pbHashValue, int cbHashValue, [MarshalAs(UnmanagedType.LPArray)] byte[] pbSignature, int cbSignature, out int pcbResult, CngNative.AsymmetricPaddingMode dwFlags);