Documentation ¶
Index ¶
- Constants
- Variables
- func GetFileAlgoName(algo int) string
- func NEVRAcmp(a NEVRA, b NEVRA) int
- func Vercmp(first, second string) int
- func Verify(stream io.Reader, knownKeys openpgp.EntityList) (header *RpmHeader, sigs []*Signature, err error)
- type FileInfo
- type NEVRA
- type NEVRASlice
- type NoSuchTagError
- type PayloadReader
- type Rpm
- type RpmHeader
- func ReadHeader(f io.Reader) (*RpmHeader, error)
- func RewriteWithSignatures(infile *os.File, outpath string, sigPgp, sigRsa []byte) (*RpmHeader, error)
- func SignRpmFile(infile *os.File, outpath string, key *packet.PrivateKey, ...) (header *RpmHeader, err error)
- func SignRpmStream(stream io.Reader, key *packet.PrivateKey, opts *SignatureOptions) (header *RpmHeader, err error)
- func (hdr *RpmHeader) DumpSignatureHeader(sameSize bool) ([]byte, error)
- func (hdr *RpmHeader) Get(tag int) (interface{}, error)
- func (hdr *RpmHeader) GetBytes(tag int) ([]byte, error)
- func (hdr *RpmHeader) GetFiles() ([]FileInfo, error)
- func (hdr *RpmHeader) GetInt(tag int) (int, error)
- func (hdr *RpmHeader) GetInts(tag int) ([]int, error)
- func (hdr *RpmHeader) GetNEVRA() (*NEVRA, error)
- func (hdr *RpmHeader) GetString(tag int) (string, error)
- func (hdr *RpmHeader) GetStrings(tag int) ([]string, error)
- func (hdr *RpmHeader) GetUint64Fallback(intTag, longTag int) (uint64, error)
- func (hdr *RpmHeader) HasTag(tag int) bool
- func (hdr *RpmHeader) InstalledSize() (int64, error)
- func (hdr *RpmHeader) OriginalSignatureHeaderSize() int
- func (hdr *RpmHeader) PayloadSize() (int64, error)
- type Signature
- type SignatureOptions
- type VersionSlice
Constants ¶
View Source
const ( // PGP Hash Algorithms PGPHASHALGO_MD5 = 1 // MD5 PGPHASHALGO_SHA1 = 2 // SHA1 PGPHASHALGO_RIPEMD160 = 3 // RIPEMD160 PGPHASHALGO_MD2 = 5 // MD2 PGPHASHALGO_TIGER192 = 6 // TIGER192 PGPHASHALGO_HAVAL_5_160 = 7 // HAVAL-5-160 PGPHASHALGO_SHA256 = 8 // SHA256 PGPHASHALGO_SHA384 = 9 // SHA384 PGPHASHALGO_SHA512 = 10 // SHA512 PGPHASHALGO_SHA224 = 11 // SHA224 )
View Source
const ( RPM_NULL_TYPE = 0 RPM_CHAR_TYPE = 1 RPM_INT8_TYPE = 2 RPM_INT16_TYPE = 3 RPM_INT32_TYPE = 4 RPM_INT64_TYPE = 5 RPM_STRING_TYPE = 6 RPM_BIN_TYPE = 7 RPM_STRING_ARRAY_TYPE = 8 RPM_I18NSTRING_TYPE = 9 NAME = 1000 VERSION = 1001 RELEASE = 1002 EPOCH = 1003 SUMMARY = 1004 DESCRIPTION = 1005 BUILDTIME = 1006 BUILDHOST = 1007 SIZE = 1009 DISTRIBUTION = 1010 VENDOR = 1011 GIF = 1012 XPM = 1013 LICENSE = 1014 PACKAGER = 1015 GROUP = 1016 CHANGELOG = 1017 SOURCE = 1018 PATCH = 1019 URL = 1020 OS = 1021 ARCH = 1022 PREIN = 1023 POSTIN = 1024 PREUN = 1025 POSTUN = 1026 OLDFILENAMES = 1027 FILESIZES = 1028 FILEMODES = 1030 FILERDEVS = 1033 FILEMTIMES = 1034 FILEDIGESTS = 1035 // AKA FILEMD5S FILELINKTOS = 1036 FILEFLAGS = 1037 // bitmask: RPMFILE_* are bitmasks to interpret FILEUSERNAME = 1039 FILEGROUPNAME = 1040 ICON = 1043 SOURCERPM = 1044 FILEVERIFYFLAGS = 1045 // bitmask: RPMVERIFY_* are bitmasks to interpret ARCHIVESIZE = 1046 PROVIDENAME = 1047 REQUIREFLAGS = 1048 REQUIRENAME = 1049 REQUIREVERSION = 1050 RPMVERSION = 1064 TRIGGERSCRIPTS = 1065 TRIGGERNAME = 1066 TRIGGERVERSION = 1067 TRIGGERFLAGS = 1068 // bitmask: RPMSENSE_* are bitmasks to interpret TRIGGERINDEX = 1069 VERIFYSCRIPT = 1079 PREINPROG = 1085 POSTINPROG = 1086 PREUNPROG = 1087 POSTUNPROG = 1088 OBSOLETENAME = 1090 FILEDEVICES = 1095 FILEINODES = 1096 PROVIDEFLAGS = 1112 PROVIDEVERSION = 1113 OBSOLETEFLAGS = 1114 OBSOLETEVERSION = 1115 VERIFYSCRIPTPROG = 1091 TRIGGERSCRIPTPROG = 1092 DIRINDEXES = 1116 BASENAMES = 1117 DIRNAMES = 1118 PAYLOADFORMAT = 1124 PAYLOADCOMPRESSOR = 1125 FILECOLORS = 1140 // BLINK*, FLINK*, and TRIGGERPREIN included from SUSE fork of RPM BLINKPKGID = 1164 BLINKHDRID = 1165 BLINKNEVRA = 1166 FLINKPKGID = 1167 FLINKHDRID = 1168 FLINKNEVRA = 1169 TRIGGERPREIN = 1170 LONGFILESIZES = 5008 LONGSIZE = 5009 FILECAPS = 5010 FILEDIGESTALGO = 5011 BUGURL = 5012 VCS = 5034 ENCODING = 5062 SIG_BASE = 256 SIG_DSA = SIG_BASE + 11 // DSA signature over header only SIG_RSA = SIG_BASE + 12 // RSA signature over header only SIG_SHA1 = SIG_BASE + 13 // SHA1 over header only (hex) SIG_LONGSIZE = SIG_BASE + 15 // header + compressed payload (uint64) SIG_LONGARCHIVESIZE = SIG_BASE + 15 // uncompressed payload bytes (uint64) SIG_SIZE = _SIGHEADER_TAG_BASE + 1000 // Header + Payload size SIG_PGP = _SIGHEADER_TAG_BASE + 1002 // Signature over header + payload SIG_MD5 = _SIGHEADER_TAG_BASE + 1004 // MD5SUM of header + payload SIG_GPG = _SIGHEADER_TAG_BASE + 1005 // (same as SIG_PGP) SIG_PAYLOADSIZE = _SIGHEADER_TAG_BASE + 1007 // uncompressed payload bytes (uint32) SIG_RESERVEDSPACE = _SIGHEADER_TAG_BASE + 1008 // blank space that can be replaced by a signature // FILEFLAGS bitmask elements: RPMFILE_NONE = 0 RPMFILE_CONFIG = 1 << 0 RPMFILE_DOC = 1 << 1 RPMFILE_ICON = 1 << 2 RPMFILE_MISSINGOK = 1 << 3 RPMFILE_NOREPLACE = 1 << 4 RPMFILE_SPECFILE = 1 << 5 RPMFILE_GHOST = 1 << 6 RPMFILE_LICENSE = 1 << 7 RPMFILE_README = 1 << 8 RPMFILE_EXCLUDE = 1 << 9 RPMFILE_UNPATCHED = 1 << 10 RPMFILE_PUBKEY = 1 << 11 RPMFILE_POLICY = 1 << 12 // FILEVERIFYFLAGS bitmask elements: RPMVERIFY_NONE = 0 RPMVERIFY_MD5 = 1 << 0 RPMVERIFY_FILEDIGEST = 1 << 0 RPMVERIFY_FILESIZE = 1 << 1 RPMVERIFY_LINKTO = 1 << 2 RPMVERIFY_USER = 1 << 3 RPMVERIFY_GROUP = 1 << 4 RPMVERIFY_MTIME = 1 << 5 RPMVERIFY_MODE = 1 << 6 RPMVERIFY_RDEV = 1 << 7 RPMVERIFY_CAPS = 1 << 8 RPMVERIFY_CONTEXTS = 1 << 15 // TRIGGERFLAGS bitmask elements -- not all rpmsenseFlags make sense // in TRIGGERFLAGS RPMSENSE_ANY = 0 RPMSENSE_LESS = 1 << 1 RPMSENSE_GREATER = 1 << 2 RPMSENSE_EQUAL = 1 << 3 RPMSENSE_TRIGGERIN = 1 << 16 RPMSENSE_TRIGGERUN = 1 << 17 RPMSENSE_TRIGGERPOSTUN = 1 << 18 RPMSENSE_TRIGGERPREIN = 1 << 25 // Header region tags RPMTAG_HEADERSIGNATURES = 62 RPMTAG_HEADERIMMUTABLE = 63 RPMTAG_HEADERREGIONS = 64 )
Variables ¶
View Source
var ( R_NONALNUMTILDE = regexp.MustCompile(`^([^a-zA-Z0-9~]*)(.*)$`) R_NUM = regexp.MustCompile(`^([\d]+)(.*)$`) R_ALPHA = regexp.MustCompile(`^([a-zA-Z]+)(.*)$`) )
Functions ¶
func GetFileAlgoName ¶
Types ¶
type NEVRASlice ¶
type NEVRASlice []NEVRA
func (NEVRASlice) Len ¶
func (s NEVRASlice) Len() int
func (NEVRASlice) Less ¶
func (s NEVRASlice) Less(i, j int) bool
func (NEVRASlice) Sort ¶
func (s NEVRASlice) Sort()
func (NEVRASlice) Swap ¶
func (s NEVRASlice) Swap(i, j int)
type NoSuchTagError ¶
type NoSuchTagError struct {
Tag int
}
func NewNoSuchTagError ¶
func NewNoSuchTagError(tag int) NoSuchTagError
func (NoSuchTagError) Error ¶
func (err NoSuchTagError) Error() string
type PayloadReader ¶
type Rpm ¶
type Rpm struct { Header *RpmHeader // contains filtered or unexported fields }
func (*Rpm) ExpandPayload ¶
func (*Rpm) PayloadReaderExtended ¶
func (rpm *Rpm) PayloadReaderExtended() (PayloadReader, error)
type RpmHeader ¶
type RpmHeader struct {
// contains filtered or unexported fields
}
func RewriteWithSignatures ¶
func SignRpmFile ¶
func SignRpmFile(infile *os.File, outpath string, key *packet.PrivateKey, opts *SignatureOptions) (header *RpmHeader, err error)
func SignRpmStream ¶
func SignRpmStream(stream io.Reader, key *packet.PrivateKey, opts *SignatureOptions) (header *RpmHeader, err error)
Read an RPM and sign it, returning the set of headers updated with the new signature.
func (*RpmHeader) DumpSignatureHeader ¶
Dump the lead and signature header, optionally adding or changing padding to make it the same size as when it was originally read. Otherwise padding is removed to make it as small as possible.
func (*RpmHeader) GetUint64Fallback ¶
func (*RpmHeader) InstalledSize ¶
Return the approximate disk space needed to install the package
func (*RpmHeader) OriginalSignatureHeaderSize ¶
func (*RpmHeader) PayloadSize ¶
Return the size of the uncompressed payload in bytes
type VersionSlice ¶
type VersionSlice []string
VersionSlice provides the Sort interface for sorting version strings.
func (VersionSlice) Len ¶
func (vs VersionSlice) Len() int
Len is the number of elements in the collection.
func (VersionSlice) Less ¶
func (vs VersionSlice) Less(i, j int) bool
Less reports wheather the element with index i should sort before the element with index j.
func (VersionSlice) Swap ¶
func (vs VersionSlice) Swap(i, j int)
Swap swaps the elements with indexes i and j.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.