| Ticket UUID: | f8e09da9dc22e29ca64e7862c19b573f1d522d4c | |||
| Title: | pki::verify return always false if algo (hash algorithm) argument is provided | |||
| Type: | Bug | Version: | 0.10 | |
| Submitter: | anonymous | Created on: | 2019-06-26 13:10:54 | |
| Subsystem: | pki | Assigned To: | aku | |
| Priority: | 5 Medium | Severity: | Severe | |
| Status: | Closed | Last Modified: | 2020-02-19 08:11:08 | |
| Resolution: | By Design | Closed By: | aku | |
| Closed on: | 2019-06-27 18:08:25 | |||
| Description: |
e.g. the unit test of pki.test fail if $hash is provided to verify This original code of the test works ok set signed [::pki::sign $plain $key $hash] set verified [::pki::verify $signed $plain $key] but this fail (providing hash with the right hash algorithm used to sign) set signed [::pki::sign $plain $key $hash] set verified [::pki::verify $signed $plain $key $hash] | |||
| User Comments: |
RP. added on 2020-02-19 08:11:08:
Sorry, wrong ticket. RP. added on 2020-02-19 08:09:53: Thank you for your response. In my case message isn't signed by me, so I wanted additional security to make sure that only specific algorithm was used (force signee to use it). But maybe in fact it was not that necessary. Anyway I think that "algo" argument is misleading and as it works as you described it should be something like "is_raw" since any other option than "raw" makes no sense. aku added on 2019-06-27 18:08:25: Updated the documentation, see commit [3f868874e7] See https://core.tcl-lang.org/tcllib/doc/trunk/embedded/md/tcllib/files/modules/pki/pki.md#3 for the updated documentation. Restructured the testsuite a bit, moving the input assets into a separate directory, and large results into asset files as well, under the same directory. rkeene added on 2019-06-26 17:42:30: This is ultimately a documentation issue the [::pki::sign] command returns a PKCS#1 v1.5 signature which embeds the hashing algorithm as an ASN.1 header to the data UNLESS "raw" is specified as the "algorithm" for [::pki::sign] (in which case the data is only padded before being signed). The [::pki::verify] command knows to expect this PKCS#1 v1.5 structure so that the relevant hashing information can be obtained and stripped from the input so you don't need to specify the algorithm *UNLESS* it does not contain the PKCS#1 v1.5 header, in which case the hashing algorithm has to be specified. Since the only case where you have to specify the hashing algorithm is in the case where the prefix is missing, if you specify the hashing algorithm for the [::pki::verify] function it won't strip the header that [::pki::sign] added because it assumes you specified the algorithm because there wasn't a header, so it doesn't even check for a header. Summary: Don't specify the "algorithm" parameter for [pki::verify] unless you specified "raw" as the algorithm for [pki::sign]. | |||
Home
Blog
Docs
Downloads
Tickets
Timeline
Branches
Tags
Wiki