使用 Javascript 进行数字签名 [英] Digital signature with Javascript

查看:101
本文介绍了使用 Javascript 进行数字签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我被这个问题困住了:

So I'm stuck with this problem:

我有这个用于数字签名小程序

这个想法是从客户端的KEY文件中提取私钥,这样私钥就永远不会离开客户端的计算机,是安全要求,无法避免:(

the idea is to extract the private key from the KEY file in the client side, in that way the private key never leaves the client's computer, that is a requirement for security, it can't be avoid :(

我正在寻找 API 或框架,但找不到解决此问题的方法,

I'm looking for APIs or frameworks, but I can't found a way to solve this,

使用 jsrsasign 示例使用 PEM 文件,但我的用户有 .CER + .KEY + 密码, 在 java 中我可以做到,但我需要在 javascript 中或在客户端的 something 中完成.

with jsrsasign the examples uses a PEM file but my users have .CER + .KEY + password, in java I can do it, but I need to do it in javascript or in something on the client side.

并且,阅读Web Cryptography API 和一些examples 我发现,他们生成私钥和公钥来签名但他们永远不要阅读现有的证书

and, reading the Web Cryptography API and some examples I found, they generate NEW private and public keys to sign BUT they never READ an existing CERTIFICATE

有人有这个问题或知道我可以使用的框架吗?请嘻嘻!

does anybody have this problem or know a framework I could use? please heeeelp!

推荐答案

所以答案是使用 JSRSASIGN (http://kjur.github.io/jsrsasign/) 在 github 中发布的示例中它使用 PEM 文件,我构建了一个示例以使用 CER+ KEY + PASSWORD >> https://github.com/alfredomova/firmaJs-with-jsrsasign-example,

So the answer was to use JSRSASIGN (http://kjur.github.io/jsrsasign/) in the examples posted in github it uses PEM files, I build an example to use CER+ KEY + PASSWORD >> https://github.com/alfredomova/firmaJs-with-jsrsasign-example,

对于那个特定的例子,我使用了 sparkMD5(https://github.com/satazor/SparkMD5)计算文件的哈希值.

for that specific example i used sparkMD5(https://github.com/satazor/SparkMD5) to calculate the file's hash.

这篇关于使用 Javascript 进行数字签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆