尝试使用OpenSSL验证签名时出错

时间:2017-05-26 14:53:46

标签: openssl rsa digital-signature

我有一个file.txt,一个cert.pem和一个file.sign。 将公钥从cert.pem提取到pubkey.pem后,我使用以下命令验证file.sign并查看它是否与file.txt匹配:

x590 -pubkey -noout -in cert.pem -out pubkey.pem // Extract pubkey

dgst -sha256 -verify pubkey.pem -signature file.sign file.txt // Verify signature

我有错误:

Verification failure
error in dgst

如果签名与数据file.txt不匹配,则不会打印error in dgst吗?我在这里错过了什么吗?

1 个答案:

答案 0 :(得分:0)

至少在OpenSSL 1.0.1e-fips版本中,' -pubkey' & openssl x509'选项命令输出stdout的键。它不会被写入' -out'所指示的文件。论点。 尝试:

    var width = 960,
    height = 1160;

// SVG element as a JavaScript object that we can manipulate later
var svg = d3.select("#map").append("svg")
      .attr("width", width)
      .attr("height", height);

var center = [24.679341, 46.680381];

// Instantiate the projection object
var projection = d3.geo.conicConformal()
      .center(center)
      .clipAngle(180)
          // Size of the map itself, you may want to play around with this in
          // relation to your canvas size
      .scale(10000)
          // Center the map in the middle of the canvas
      .translate([width / 2, height / 2])
      .precision(.1);

// Assign the projection to a path
var path = d3.geo.path().projection(projection);

d3.json("https://code.highcharts.com/mapdata/countries/sa/sa-all.geo.json", function(err, data) {
  $.each(data.features, function(i, feature) {
    svg.append("path")
      .datum(feature.geometry)
      .attr("class", "border")
      .attr("stroke", "black")
      .attr("fill", "blue");
  });
});