Documentation
¶
Overview ¶
Package crypto implements XBPS' signature signing and verification using crypto/rsa.
XBPS SHA1-SHA256 workaround ¶
xbps specifies sha1 as algorithm for RSA_{sign,verify} but uses a sha256 message and length.
xbps still uses full sha256 hashes for the verification, the describes issue is just a parsing issue which with strict ASN1/PKCS1 implementations.
As a workaround this implementation disables golangs PKCS1v15 prefix by using crypto.Hash(0) as hash argument for rsa.VerifyPKCS1v15 and rsa.SignPKCS1v15 and uses a precomputed ASN1 prefix instead.
The ANS1 prefix comes from xbps generated signature, dumped using the openssl command:
openssl rsautl -verify -in foo-1.0_1.noarch.xbps.sig -inkey ~/.ssh/id_rsa -raw -hexdump
XBPS implementation:
https://github.com/void-linux/xbps/blob/b4eebaf/lib/verifysig.c#L66
Original bug report:
https://github.com/voidlinux/xbps/issues/146
Note: golang also hardcodes the ASN1 prefix for performance reasons:
https://github.com/golang/go/blob/dca707b/src/crypto/rsa/pkcs1v15.go#L210
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.