Overview
Comment: | Added SHA512 support and support for returning a promise when signing |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
a5d56f2277893de26b2e19a275c32e76 |
User & Date: | rkeene on 2019-01-31 07:15:16 |
Other Links: | manifest | tags |
Context
2019-01-31
| ||
07:16 | Added SSH agent support check-in: 5d6a50ef48 user: rkeene tags: trunk | |
07:15 | Added SHA512 support and support for returning a promise when signing check-in: a5d56f2277 user: rkeene tags: trunk | |
04:41 | Upgrade to latest JS RSA check-in: f0d2c2ccee user: rkeene tags: trunk | |
Changes
Modified build/chrome/cackey.js from [3c60365638] to [d291048f9c].
︙ | ︙ | |||
77 78 79 80 81 82 83 | return; } for (idx = 0; idx < message.certificates.length; idx++) { certificates.push( { certificate: message.certificates[idx], | | | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | return; } for (idx = 0; idx < message.certificates.length; idx++) { certificates.push( { certificate: message.certificates[idx], supportedHashes: ['SHA1', 'SHA256', 'SHA512', 'MD5_SHA1'] } ); } chromeCallback(certificates, function(rejectedCerts) { if (chrome.runtime.lastError) { |
︙ | ︙ | |||
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 | * Handler for messages from Chrome related to signing a hash of some sort */ function cackeySignMessage(signRequest, chromeCallback) { var callbackId; var command; var certificateId; var digest, digestHeader; /* * Prefix the digest with the ASN.1 header required of it */ switch (signRequest.hash) { case "SHA1": digestHeader = new Uint8Array([0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14]); break; case "SHA256": digestHeader = new Uint8Array([0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20]); break; case "MD5_SHA1": digestHeader = new Uint8Array(); break; default: console.error("[cackey] Asked to sign a message with a hash we do not support: " + signRequest.hash); chromeCallback(); | > > > > > > > > > > > > > > > > > > > > > > > | | 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | * Handler for messages from Chrome related to signing a hash of some sort */ function cackeySignMessage(signRequest, chromeCallback) { var callbackId; var command; var certificateId; var digest, digestHeader; var promiseHandle = null, promiseResolve, promiseReject; if (!chromeCallback) { /* * If no callback supplied, arrange for a promise to be returned instead */ promiseHandle = new Promise(function(resolve, reject) { promiseResolve = resolve; promiseReject = reject; }); chromeCallback = function(payload) { if (!payload) { promiseReject(new Error("Signing payload is empty or not supplied")); } else { promiseResolve(payload); } }; } /* * Prefix the digest with the ASN.1 header required of it */ switch (signRequest.hash) { case "SHA1": digestHeader = new Uint8Array([0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14]); break; case "SHA256": digestHeader = new Uint8Array([0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20]); break; case "SHA512": digestHeader = new Uint8Array([0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05, 0x00, 0x04, 0x40]); break; case "MD5_SHA1": case "RAW": digestHeader = new Uint8Array(); break; default: console.error("[cackey] Asked to sign a message with a hash we do not support: " + signRequest.hash); chromeCallback(); return(promiseHandle); } digest = new Uint8Array(digestHeader.length + signRequest.digest.byteLength); digest.set(digestHeader, 0); digest.set(new Uint8Array(signRequest.digest), digestHeader.length); delete digestHeader; |
︙ | ︙ | |||
543 544 545 546 547 548 549 | cackeyOutstandingCallbacks[callbackId] = chromeCallback; if (goog.DEBUG) { console.log("[cackey] Thrown."); } }, chromeCallback); | | | 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | cackeyOutstandingCallbacks[callbackId] = chromeCallback; if (goog.DEBUG) { console.log("[cackey] Thrown."); } }, chromeCallback); return(promiseHandle); } /* * Unititalizes the CACKey PCSC connection */ function cackeyUninitPCSC() { console.log("[cackey] cackeyUninitPCSC() called"); |
︙ | ︙ |