I finally managed to check out some simple PGP message blocks. However, I found that for some reason, my implementation limits me to checking data 9-16 bytes long. Not less. no more.
Is there any instruction somewhere ( RFC4880 or elsewhere) that indicates how to process plaintext data of any length? maybe there is some kind of gasket that I missed? PKCS1?
I am sure I have correctly formatted the data for the hash, since the instructions in RFC 4880 from 5.2.4 speak for text documents, just replace all \n
with \r\n
and add the trailer. since my test values were single rows of data, nothing needed to be replaced
all of these values are in base 10, unless otherwise indicated:
does not work:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 abcd -----BEGIN PGP SIGNATURE----- Version: BCPG v1.39 iFsEARECABsFAk/tB28UHGFiYyA8bWFrY21AYWFhLmNvbT4ACgkQMFIlRc933Ya2 RwCfdMyI08Iz0rDXVHOPlGA3s5Y9j/8An2He7+hHjWfGJNoOJT7gAxqJaoLo =I2rT -----END PGP SIGNATURE----- data hashed (in hex): 6162636404011102001b05024fed076f141c616263203c6d616b636d406161612e636f6d3e04ff00000021 r = 666804200764671083282351405489424949903645052927 s = 558743769080942454889260816818443017172325925608 w = 702955297882281869313155599553522395227576660460 // s^-1 mod q u1 = 190417717173929082607343542521304347388874234334 u2 = 306786785479358548892951170619047936651163362761 v = g^u1 * y^u2 % p % q = 737052148656331043521702886300418501784667890334 v != r
working:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 0123456789abcdef -----BEGIN PGP SIGNATURE----- Version: BCPG v1.39 iFsEARECABsFAk/tCE0UHGFiYyA8bWFrY21AYWFhLmNvbT4ACgkQMFIlRc933YYG IQCfercgPsXFnah6otgQdEMbv9OeCgIAnRIyOLirbqSlBugBT6Ex/Adz4+7L =bzab -----END PGP SIGNATURE----- data hashed (in hex): 3031323334353637383961626364656604011102001b05024fed084d141c616263203c6d616b636d406161612e636f6d3e04ff00000021 r = 700580719365380086754774917458461236187098909186 s = 103881812262595813943381509986903840453887782603 w = 178510125628083028184051840492924307896586330444 // s^-1 mod q u1 = 78831508775508876446567239486098677466912246622 u2 = 572875590470993668032596348682349224460207395691 v = g^u1 * y^u2 % p % q = 700580719365380086754774917458461236187098909186 v == r
what data did I not include in the hash / what did I do wrong?
EDIT: here is the public key on request, even if the corresponding values are already published)
-----BEGIN PGP PUBLIC KEY BLOCK----- Version: BCPG v1.39 mQGiBE5B0h8RBAD533Z5bK1IpBx02QyQL0QoJE4uFRIMGDiwXuwmZzVl+R7Vlurd GRLsCCbE6vOOh7XQVZGzLEBy9WNzZ9m+EbCfSVAYkjS6FhLws6hG6irrnS+b3JBf gFJ8vNGF9Z7bhx+7y7NBk0IMyWkGnUkcnav73t5FQUI2faEBN4c/yAGJZwCgjcB7 3akWk9XVWvTCsiMXxpyvkukEALXsvB6cOoFEtQq9cQHjP63fBlvD94dhhMiM0cH6 hW9JotxdK+cxFGG9ZIWgoN2PWbMJka/H4W5EL6tS+YiNAR7I1Ozkt6X16GjnQUzZ MlSpleK+KiKVN2anRaPEoOIinHrE3ZXd6QlJ/4+OJn4IVWmSEaJpFf4QNgvEu4rh xinyBAD2RNzREOA+wpnFZ4lDt9NZXmXdxQME/l0J9XcvWhpGsxA/MATQKImy7N49 7GT/M38F+TrpBobag1O3buE99fOLyws4Tbc+sZMdHxoiGZDAIRNQS2rv475E6ktj 7vd5CYvOkA6+8sX1+hPcNlkHtHB1OFkJRsYp6k0zkyC9adjBM7QTYWJjIDxtYWtj bUBhYWEuY29tPohGBBMRAgAGBQJOQdIfAAoJEDBSJUXPd92GRSQAoItbtbToOg7a /hcg2sA/aBEQNwuxAKCGR69vmSoCWoBP5waPk0UsjM3BSbjMBE5B0h8QAgCUlP7A lfO4XuKGVCs4NvyBpd0KA0m0wjndOHRNSIz44x24vLfTO0GrueWjPMqRRLHO8zLJ S/BXO/BHo6ypjN87Af0VPV1hcq20MEW2iujh3hBwthNwBWhtKdPXOndJGZaB7lsh LJuWv9z6WyDNXj/SBEiV1gnPm0ELeg8Syhy5pCjMAf9QHehP2eCFqfEwTAnaOlA6 CU+rYHKPZaI9NUwCA7qD2d93/l08/+ZtFvejZW1RWrJ8qfLDRtlPgRzigoF/CXbR iEYEGBECAAYFAk5B0h8ACgkQMFIlRc933YZRrACfUnWTjHHN+QsEEoJrwRvFmvzj bR4An24pTpeeN+I6R59O/sdmYsAhjULX =sStS -----END PGP PUBLIC KEY BLOCK-----
source share