怎样使用capicom控件进行签名
答案:2 悬赏:20 手机版
解决时间 2021-03-03 17:29
- 提问者网友:我们很暧昧
- 2021-03-02 20:16
怎样使用capicom控件进行签名
最佳答案
- 五星知识达人网友:佘樂
- 2021-03-02 21:11
var CAPICOM_CURRENT_USER_STORE = 2
var CAPICOM_MY_STORE = "My"
var CAPICOM_STORE_OPEN_READ_ONLY = 0
var CAPICOM_STORE_OPEN_EXISTING_ONLY = 128
var CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12
var CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128
var CAPICOM_CERT_INFO_SUBJECT_EMAIL_NAME = 2
var CAPICOM_HASH_ALGORITHM_SHA1 = 0
var CAPICOM_VERIFY_SIGNATURE_AND_CERTIFICATE = 1
var CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0
var CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1
var CAPICOM_CERT_INFO_SUBJECT_EMAIL_NAME = 2
var CAPICOM_CERT_INFO_ISSUER_EMAIL_NAME = 3
var CAPICOM_ENCODE_BASE64 = 0;
var CAPICOM_VERIFY_SIGNATURE_ONLY = 0;
function certLogin()
{
var store = new ActiveXObject("CAPICOM.Store");
var oSigner = new ActiveXObject("CAPICOM.Signer");
var oSignedData = new ActiveXObject("CAPICOM.SignedData");
store.Open(CAPICOM_CURRENT_USER_STORE, CAPICOM_MY_STORE,
CAPICOM_STORE_OPEN_READ_ONLY | CAPICOM_STORE_OPEN_EXISTING_ONLY);
var certs = store.Certificates.Find(CAPICOM_CERTIFICATE_FIND_KEY_USAGE,
CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE, true);
certs = certs.Select();//弹出证书选择框
var cert = certs (1);
oSigner.Certificate = cert;
oSignedData.Content = "123456";
var signResult = oSignedData.Sign(oSigner, false, CAPICOM_ENCODE_BASE64);
return signResult;
}
var CAPICOM_MY_STORE = "My"
var CAPICOM_STORE_OPEN_READ_ONLY = 0
var CAPICOM_STORE_OPEN_EXISTING_ONLY = 128
var CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12
var CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128
var CAPICOM_CERT_INFO_SUBJECT_EMAIL_NAME = 2
var CAPICOM_HASH_ALGORITHM_SHA1 = 0
var CAPICOM_VERIFY_SIGNATURE_AND_CERTIFICATE = 1
var CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0
var CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1
var CAPICOM_CERT_INFO_SUBJECT_EMAIL_NAME = 2
var CAPICOM_CERT_INFO_ISSUER_EMAIL_NAME = 3
var CAPICOM_ENCODE_BASE64 = 0;
var CAPICOM_VERIFY_SIGNATURE_ONLY = 0;
function certLogin()
{
var store = new ActiveXObject("CAPICOM.Store");
var oSigner = new ActiveXObject("CAPICOM.Signer");
var oSignedData = new ActiveXObject("CAPICOM.SignedData");
store.Open(CAPICOM_CURRENT_USER_STORE, CAPICOM_MY_STORE,
CAPICOM_STORE_OPEN_READ_ONLY | CAPICOM_STORE_OPEN_EXISTING_ONLY);
var certs = store.Certificates.Find(CAPICOM_CERTIFICATE_FIND_KEY_USAGE,
CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE, true);
certs = certs.Select();//弹出证书选择框
var cert = certs (1);
oSigner.Certificate = cert;
oSignedData.Content = "123456";
var signResult = oSignedData.Sign(oSigner, false, CAPICOM_ENCODE_BASE64);
return signResult;
}
全部回答
- 1楼网友:你可爱的野爹
- 2021-03-02 22:23
fasdfasdfsadfasdfasdf
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯