我在使用证书在C#中加密/解密字符串时遇到了一个很好的例子.我能够找到并实现签名和验证签名的示例,如下所示.有人能指出一个简单,类似的加密示例吗?
private static string Sign(RSACryptoServiceProvider privateKey, string content)
{
SHA1Managed sha1 = new SHA1Managed();
UnicodeEncoding encoding = new UnicodeEncoding ();
byte[] data = encoding.GetBytes(content);
byte[] hash = sha1.ComputeHash(data);
// Sign the hash
var signature = privateKey.SignHash(hash, CryptoConfig.MapNameToOID("SHA1"));
return Convert.ToBase64String(signature);
}
public static bool Verify(RSACryptoServiceProvider publicKey, string content, string hashString)
{
SHA1Managed sha1 = new SHA1Managed();
UnicodeEncoding encoding = new UnicodeEncoding ();
byte[] data = encoding.GetBytes(content);
byte[] hash = sha1.ComputeHash(data);
return publicKey.VerifyHash(hash, CryptoConfig.MapNameToOID("SHA1"), Convert.FromBase64String(hashString));
}
Run Code Online (Sandbox Code Playgroud) 因此,我们正在使用TFS 2012 RC,并通过添加一些自定义过渡状态来修改常规任务项的工作流程.
通过Visual Studio 2012 RC更新任务时,一切正常.我可以毫无问题地穿越所有州.但是,通过TFS Portal更新任务时,通过拖动板上的项目或打开表单并使用下拉菜单更改状态,我收到以下错误:"TF237165:Team Foundation无法更新工作项目,因为服务器上的验证错误.这可能是因为工作项类型已被修改或销毁,或者您没有更新工作项的权限.
但是,只有在移动到完成状态时才会发生这种情况.所有其他州工作正常.
所以,我不确定这意味着什么,因为它在Visual Studio中运行良好.如果我能在某处看到异常或更多信息会有什么帮助,但我不知道存储这些验证错误的位置.
任何帮助将不胜感激!
我们正在编写一个应用程序,它将使用T4生成Flex/Actionscript以编译为SWF.我们希望将此应用程序分发给不会拥有VS的用户.我搜索并搜索过,在你的应用程序重新分发microsoft.visualstudio.texttemplating.dll的任何地方找不到任何信息,除了这个代码plex项目(http://customtemplating.codeplex.com/)允许托管你自己的T4 builder(使用并包含microsoft.visualstudio.texttemplating.dll的副本).
那么,有没有人确切知道或者可以告诉我在哪里可以找到关于在我们的应用程序中包含此dll的信息?
先感谢您!伊利亚
.net ×1
c# ×1
certificate ×1
encryption ×1
licensing ×1
t4 ×1
templates ×1
tfs ×1
tfs2012 ×1
x509 ×1