926
940
RPMDIGEST_NONE = 0
927
941
} rpmDigestFlags;
944
* Return string representation of am OpenPGP value.
945
* @param type type of value
946
* @param val byte value to lookup
947
* @return string value of byte
949
const char * pgpValString(pgpValType type, uint8_t val);
930
951
/** \ingroup rpmpgp
931
952
* Return (native-endian) integer from big-endian representation.
1012
1033
pgpArmor pgpReadPkts(const char * fn, uint8_t ** pkt, size_t * pktlen);
1014
1035
/** \ingroup rpmpgp
1036
* Parse armored OpenPGP packets from memory.
1037
* @param armor armored OpenPGP packet string
1038
* @retval pkt dearmored OpenPGP packet(s) (malloced)
1039
* @retval pktlen dearmored OpenPGP packet(s) length in bytes
1040
* @return type of armor found
1042
pgpArmor pgpParsePkts(const char *armor, uint8_t ** pkt, size_t * pktlen);
1015
1045
* Wrap a OpenPGP packets in ascii armor for transport.
1016
1046
* @param atype type of armor
1017
1047
* @param s binary pkt data
1033
1063
void pgpCleanDig(pgpDig dig);
1035
1065
/** \ingroup rpmpgp
1036
* Destroy a container for parsed OpenPGP packates.
1066
* Destroy a container for parsed OpenPGP packet(s).
1037
1067
* @param dig container
1038
1068
* @return NULL always
1040
1070
pgpDig pgpFreeDig(pgpDig dig);
1042
1072
/** \ingroup rpmpgp
1073
* Verify a PGP signature.
1074
* @param dig container
1075
* @param hashctx digest context
1076
* @return RPMRC_OK on success
1078
rpmRC pgpVerifySig(pgpDig dig, DIGEST_CTX hashctx);
1081
* Return a string identification of a PGP signature/pubkey.
1082
* @param digp signature/pubkey container
1083
* @return string describing the item and parameters
1085
char *pgpIdentItem(pgpDigParams digp);
1043
1088
* Perform cryptography initialization.
1044
1089
* It must be called before any cryptography can be used within rpm.
1045
1090
* It's not normally necessary to call it directly as it's called in
1101
1146
size_t * lenp, int asAscii);
1149
* Create a new digest bundle.
1150
* @return New digest bundle
1152
rpmDigestBundle rpmDigestBundleNew(void);
1155
* Free a digest bundle and all contained digest contexts.
1156
* @param bundle digest bundle
1157
* @return NULL always
1159
rpmDigestBundle rpmDigestBundleFree(rpmDigestBundle bundle);
1162
* Add a new type of digest to a bundle.
1163
* @param bundle digest bundle
1164
* @param algo type of digest
1165
* @param flags bit(s) to control digest operation
1166
* @return 0 on success
1168
int rpmDigestBundleAdd(rpmDigestBundle bundle, pgpHashAlgo algo,
1169
rpmDigestFlags flags);
1172
* Update contexts within bundle with next plain text buffer.
1173
* @param bundle digest bundle
1174
* @param data next data buffer
1175
* @param len no. bytes of data
1176
* @return 0 on success
1178
int rpmDigestBundleUpdate(rpmDigestBundle bundle, const void *data, size_t len);
1181
* Return digest from a bundle and destroy context, see rpmDigestFinal().
1183
* @param bundle digest bundle
1184
* @param algo type of digest to return
1185
* @retval datap address of returned digest
1186
* @retval lenp address of digest length
1187
* @param asAscii return digest as ascii string?
1188
* @return 0 on success
1190
int rpmDigestBundleFinal(rpmDigestBundle bundle,
1191
pgpHashAlgo algo, void ** datap, size_t * lenp, int asAscii);
1194
* Duplicate a digest context from a bundle.
1195
* @param bundle digest bundle
1196
* @param algo type of digest to dup
1197
* @return duplicated digest context
1199
DIGEST_CTX rpmDigestBundleDupCtx(rpmDigestBundle bundle, pgpHashAlgo algo);
1103
1201
#ifdef __cplusplus