Crate rpm_sequoia
source ·Expand description
An implementation of RPM’s OpenPGP interface.
This library provides an implementation of RPM’s OpenPGP interface.
You should not link to this library directly.
If you are looking for an OpenPGP interface, consider using Sequoia, which this library is based on. If you want to use RPM’s OpenPGP interface, which you should only do if you are interacting with RPM, then you should link against RPM, which reexports this interface.
If you are investigating a bug in this library, set the
RPM_TRACE
environment variable to 1 to get a verbose trace of
the library’s execution:
$ LD_LIBRARY_PATH=/tmp/rpm-sequoia/release RPM_TRACE=1 ./rpmkeys \
--import ../tests/data/keys/CVE-2021-3521-badbind.asc
_rpmInitCrypto: entered
_rpmInitCrypto: -> success
_pgpParsePkts: entered
...
§Policy
When Sequoia evaluates the validity of an object (e.g., a cryptographic signature) it consults a policy. The policy is user defined. This library uses Sequoia’s standard policy.
Sequoia’s standard policy allows self-signatures (i.e., the signatures that bind a User ID or subkey to a certificate) made with SHA-1 until February 2023. It completely disallows data signatures made with SHA-1. The reason for this is that SHA-1 collision resistance is broken, but its second pre-image resistance is still okay.
As an added protection, Sequoia uses SHA-1 collision detection, which is a variant of SHA-1, which mitigates known attacks against SHA-1. SHA-1 CD has a very low false positive rate (2^-90) so it can be treated as a drop-in, fully compatible replacement for SHA-1.
§Configuration File
This library reads the crypto policy configuration in
/etc/crypto-policies/back-ends/sequoia.config
. If that file
doesn’t exist, it tries
/usr/share/crypto-policies/back-ends/rpm-sequoia.config
. This
can be overridden using the SEQUOIA_CRYPTO_POLICY
environment
variable. If set to the empty string, then no crypto policy will
be read and instead Sequoia’s default policy will be used.
Refer to the Fedora Crypto Policy project for information about the crypto policy.
Modules§
Structs§
- An optional OpenPGP certificate and an optional signature.
Functions§
- Wraps the data in ASCII armor.
- Release (malloc’d) data from container.
- Retrieve parameters for parsed OpenPGP packet(s).
- Returns the object’s public key or algorithm algorithm.
- “Compares” the two parameters and returns 1 if they differ and 0 if they match.
- Returns the object’s time.
- Frees the parameters.
- Returns the issuer or the Key ID.
- Returns the primary User ID, if any.
- Returns the object’s version.
- Destroy a container for parsed OpenPGP packet(s).
- Create a container for parsed OpenPGP packet(s).
- Strips the ASCII armor and returns the decoded data in
pkt
. - Parses OpenPGP data.
- Like _pgpPrtParams, but returns error messages and lints in
lint_str
. - Returns a
PgpDigParams
data structure for each subkey. - Parses and optionally prints to stdout a OpenPGP packet(s).
- Returns the length of the certificate in bytes.
- Lints the first certificate in pkts.
- Calculate OpenPGP public key fingerprint.
- Returns the Key ID of the public key or the secret key stored in
pkt
. - Merge the PGP packets of two certificates
- Returns the signature’s type.
- Verify a PGP signature.
- Verifies the signature.
- Like _pgpVerifySignature, but returns error messages and lints in
lint_str
. - int rpmFreeCrypto(void)
- int rpmInitCrypto(void)
- Prints the error and causes, if any.