rpm  5.4.10
Typedefs | Enumerations | Functions
signature.h File Reference

Generate and verify rpm package signatures. More...

#include <rpmtag.h>
Include dependency graph for signature.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef enum pgpVersion_e pgpVersion
 Identify PGP versions. More...
 

Enumerations

enum  pgpVersion_e { PGP_NOTDETECTED = -1, PGP_UNKNOWN = 0, PGP_2 = 2, PGP_5 = 5 }
 Identify PGP versions. More...
 

Functions

int rpmTempFile (const char *prefix, const char **fnptr, void *fdptr)
 Return file handle for a temporaray file. More...
 
int rpmAddSignature (Header sigh, const char *file, rpmSigTag sigTag, const char *passPhrase)
 Generate signature(s) from a header+payload file, save in signature header. More...
 
int rpmCheckPassPhrase (const char *passPhrase)
 Check for valid pass phrase by invoking a helper. More...
 
rpmRC rpmVerifySignature (void *_dig, char *result)
 Verify a signature from a package. More...
 

Detailed Description

Generate and verify rpm package signatures.

Definition in file signature.h.

Typedef Documentation

§ pgpVersion

typedef enum pgpVersion_e pgpVersion

Identify PGP versions.

Note
Greater than 0 is a valid PGP version.

Enumeration Type Documentation

§ pgpVersion_e

Identify PGP versions.

Note
Greater than 0 is a valid PGP version.
Enumerator
PGP_NOTDETECTED 
PGP_UNKNOWN 
PGP_2 
PGP_5 

Definition at line 15 of file signature.h.

Function Documentation

§ rpmAddSignature()

int rpmAddSignature ( Header  sigh,
const char *  file,
rpmSigTag  sigTag,
const char *  passPhrase 
)

Generate signature(s) from a header+payload file, save in signature header.

Parameters
sighsignature header
fileheader+payload file name
sigTagtype of signature(s) to add
passPhraseprivate key pass phrase
Returns
0 on success, -1 on failure

Definition at line 433 of file signature.c.

References alloca(), _HE_s::c, dodigest(), headerPut(), makeHDRSignature(), _HE_s::p, PGPHASHALGO_MD5, rpmDataType_u::ptr, RPM_BIN_TYPE, RPM_UINT32_TYPE, RPMSIGTAG_DSA, RPMSIGTAG_GPG, RPMSIGTAG_MD5, RPMSIGTAG_RSA, RPMSIGTAG_SHA1, RPMSIGTAG_SIZE, Stat(), _HE_s::t, _HE_s::tag, and rpmDataType_u::ui32p.

Referenced by rpmReSign(), and writeRPM().

§ rpmCheckPassPhrase()

int rpmCheckPassPhrase ( const char *  passPhrase)

Check for valid pass phrase by invoking a helper.

Parameters
passPhrasepass phrase
Returns
0 on valid, 1 on invalid

Definition at line 489 of file signature.c.

References _, _free(), environ, errno, rpmExpand(), rpmIsVerbose, rpmkuPassPhrase(), rpmlog(), RPMLOG_ERR, setenv(), and unsetenv().

Referenced by main().

§ rpmTempFile()

int rpmTempFile ( const char *  prefix,
const char **  fnptr,
void *  fdptr 
)

Return file handle for a temporaray file.

A unique temporaray file path will be generated using rpmGenPath(prefix, "%{_tmppath}/", "rpm-tmp.XXXXX") where "XXXXXX" is filled in using rand(3). The file is opened, and the link count and (dev,ino) location are verified after opening. The file name and the open file handle are returned.

Parameters
prefixleading part of temp file path
Return values
*fnptrtemp file name (or NULL)
*fdptrtemp file handle
Returns
0 on success

Definition at line 30 of file signature.c.

References _, _free(), errno, Fclose(), Ferror(), Fileno(), Fopen(), rpmGenPath(), rpmioMkpath(), rpmlog(), RPMLOG_ERR, S_ISLNK, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by makeHDRSignature(), manageFile(), runScript(), and writeRPM().

§ rpmVerifySignature()

rpmRC rpmVerifySignature ( void *  _dig,
char *  result 
)

Verify a signature from a package.

Parameters
_digcontainer
Return values
resultdetailed text result of signature verification
Returns
result of signature verification

Definition at line 941 of file signature.c.

References _, pgpGetSig(), pgpGetSiglen(), pgpGetSigtag(), RPMRC_NOTFOUND, RPMSIGTAG_DSA, RPMSIGTAG_MD5, RPMSIGTAG_RSA, RPMSIGTAG_SHA1, RPMSIGTAG_SIZE, verifyDSA(), verifyMD5(), verifyRSA(), verifySHA1(), and verifySize().

Referenced by headerCheck(), rpmReadPackageFile(), and rpmVerifySignatures().