我使用.NET 4.5实现NuGet包OC.Core.Crypto
配置
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BouncyCastle" version="1.7.0" targetFramework="net45" />
<package id="log4net" version="1.2.10" targetFramework="net45" />
<package id="OC.Core" version="1.1.14" targetFramework="net45" />
<package id="OC.Core.Crypto" version="1.2.2" targetFramework="net45" />
</packages>
当我使用OC.Core.Crypto.Hash
时发生错误; OC.Core.Crypto.Hash Dependency OC.Core version=1.1.12.29464
我试图将OC.Core修改为版本1.1.12.29464,但NuGet无法找到该包。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using OC.Core;
using OC.Core.Crypto;
namespace qdPayCallBack
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void btnGenerate_Click(object sender, EventArgs e)
{
RsaKeyPair rsaKeyPair = new RsaKeyPair(1024);
priKey.Text = rsaKeyPair.PrivateKey;
pubKey.Text = rsaKeyPair.PublicKey;
}
private void btnSign_Click(object sender, EventArgs e)
{
RsaSigner rsa = new RsaSigner(pubKey.Text, priKey.Text);
OC.Core.Crypto.Hash hash = new OC.Core.Crypto.Hash();//this has an error
//错误 2 类型“OC.Core.Object”在未被引用的程序集中定义。必须添加对程序集“OC.Core, Version=1.1.12.29464, Culture=neutral, PublicKeyToken=null”的引用。 D:\C#\qdPayCallBack\qdPayCallBack\Form1.cs 36 13 qdPayCallBack
sign.Text = rsa.Sign(text.Text);
}
private void btnVerify_Click(object sender, EventArgs e)
{
RsaSigner rsa = new RsaSigner(pubKey.Text, priKey.Text);
//Hash hash = new Hash();
result.Text = rsa.IsSignatureValid(text.Text, sign.Text).ToString();
}
}
}