How to use hwcrypto.js check persons use usb-token
up vote
1
down vote
favorite
I am currently developing a web based signing system use hwcrypto
When user plug usb-token device to computer then click button, it prompt select certificate and enter password:
window.hwcrypto.getCertificate({lang: lang, filter: filter})
.then(function(cert) {
window.hwcrypto.sign(cert, {type: hashtype, hex: hash}, {lang: lang})
.then(function(signature){
// call jquery ajax to do some important thing
$.ajax({
url: 'index.php?action=very_important_action',
dataType: 'html',
success: function(response) {
console.log(response);
});
});
});
It works, but i worry users call ajax function directly not use usb-token. How can I protect that?
javascript
add a comment |
up vote
1
down vote
favorite
I am currently developing a web based signing system use hwcrypto
When user plug usb-token device to computer then click button, it prompt select certificate and enter password:
window.hwcrypto.getCertificate({lang: lang, filter: filter})
.then(function(cert) {
window.hwcrypto.sign(cert, {type: hashtype, hex: hash}, {lang: lang})
.then(function(signature){
// call jquery ajax to do some important thing
$.ajax({
url: 'index.php?action=very_important_action',
dataType: 'html',
success: function(response) {
console.log(response);
});
});
});
It works, but i worry users call ajax function directly not use usb-token. How can I protect that?
javascript
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am currently developing a web based signing system use hwcrypto
When user plug usb-token device to computer then click button, it prompt select certificate and enter password:
window.hwcrypto.getCertificate({lang: lang, filter: filter})
.then(function(cert) {
window.hwcrypto.sign(cert, {type: hashtype, hex: hash}, {lang: lang})
.then(function(signature){
// call jquery ajax to do some important thing
$.ajax({
url: 'index.php?action=very_important_action',
dataType: 'html',
success: function(response) {
console.log(response);
});
});
});
It works, but i worry users call ajax function directly not use usb-token. How can I protect that?
javascript
I am currently developing a web based signing system use hwcrypto
When user plug usb-token device to computer then click button, it prompt select certificate and enter password:
window.hwcrypto.getCertificate({lang: lang, filter: filter})
.then(function(cert) {
window.hwcrypto.sign(cert, {type: hashtype, hex: hash}, {lang: lang})
.then(function(signature){
// call jquery ajax to do some important thing
$.ajax({
url: 'index.php?action=very_important_action',
dataType: 'html',
success: function(response) {
console.log(response);
});
});
});
It works, but i worry users call ajax function directly not use usb-token. How can I protect that?
javascript
javascript
asked yesterday
Bùi văn Nguyện
37717
37717
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
I have a few approaches in mind, but it depends on your implementation -
- You can set the usb-token in your local storage, and the page that is being requested has the check that usb-token field should already be available in the local storage.
- You can check for every ajax request that is being made, by using
$.ajax.beforeSend
and check if you have usb-token available. - You can send the token as a query parameter and check in the page that is being requested, that if the parameter containing the token exists or not.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
I have a few approaches in mind, but it depends on your implementation -
- You can set the usb-token in your local storage, and the page that is being requested has the check that usb-token field should already be available in the local storage.
- You can check for every ajax request that is being made, by using
$.ajax.beforeSend
and check if you have usb-token available. - You can send the token as a query parameter and check in the page that is being requested, that if the parameter containing the token exists or not.
add a comment |
up vote
1
down vote
I have a few approaches in mind, but it depends on your implementation -
- You can set the usb-token in your local storage, and the page that is being requested has the check that usb-token field should already be available in the local storage.
- You can check for every ajax request that is being made, by using
$.ajax.beforeSend
and check if you have usb-token available. - You can send the token as a query parameter and check in the page that is being requested, that if the parameter containing the token exists or not.
add a comment |
up vote
1
down vote
up vote
1
down vote
I have a few approaches in mind, but it depends on your implementation -
- You can set the usb-token in your local storage, and the page that is being requested has the check that usb-token field should already be available in the local storage.
- You can check for every ajax request that is being made, by using
$.ajax.beforeSend
and check if you have usb-token available. - You can send the token as a query parameter and check in the page that is being requested, that if the parameter containing the token exists or not.
I have a few approaches in mind, but it depends on your implementation -
- You can set the usb-token in your local storage, and the page that is being requested has the check that usb-token field should already be available in the local storage.
- You can check for every ajax request that is being made, by using
$.ajax.beforeSend
and check if you have usb-token available. - You can send the token as a query parameter and check in the page that is being requested, that if the parameter containing the token exists or not.
answered yesterday
Aseem Upadhyay
1,056520
1,056520
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372325%2fhow-to-use-hwcrypto-js-check-persons-use-usb-token%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown