📄 pgpkeys.h
字号:
PGPPublicKeyAlgorithm pubKeyAlgorithm,
PGPKeyRef *outRef);
PGPBoolean PGPKeySetIsMember(PGPKeyRef key, PGPKeySetRef set);
PGPError PGPCountKeys( PGPKeySetRef keys, PGPUInt32 *numKeys);
PGPError PGPIncKeySetRefCount( PGPKeySetRef keys);
PGPError PGPFreeKeySet( PGPKeySetRef keys);
PGPBoolean PGPKeySetIsMutable( PGPKeySetRef keys);
PGPBoolean PGPKeySetNeedsCommit( PGPKeySetRef keys);
PGPError PGPAddKeys( PGPKeySetRef keysToAdd, PGPKeySetRef set );
PGPError PGPRemoveKeys( PGPKeySetRef keysToRemove, PGPKeySetRef set );
/* Key manipulation functions */
PGPError PGPDisableKey( PGPKeyRef key);
PGPError PGPEnableKey( PGPKeyRef key);
PGPError PGPRemoveSubKey( PGPSubKeyRef subkey);
PGPError PGPRemoveUserID( PGPUserIDRef userID);
PGPError PGPSetPrimaryUserID( PGPUserIDRef userid);
PGPError PGPCertifyPrimaryUserID( PGPUserIDRef userid,
PGPOptionListRef firstOption, ...);
PGPError PGPGetSigCertifierKey( PGPSigRef cert, PGPKeySetRef allkeys,
PGPKeyRef *certkey);
PGPError PGPGetSigX509CertifierSig( PGPSigRef cert,
PGPKeySetRef allkeys, PGPSigRef *certsig);
PGPError PGPRemoveSig( PGPSigRef cert);
PGPError PGPCountAdditionalRecipientRequests( PGPKeyRef basekey,
PGPUInt32 * numARKeys);
PGPError PGPGetIndexedAdditionalRecipientRequestKey(
PGPKeyRef basekey, PGPKeySetRef allkeys, PGPUInt32 nth,
PGPKeyRef *arkey, PGPKeyID *arkeyid,
PGPByte *arclass );
PGPError PGPCountRevocationKeys( PGPKeyRef basekey,
PGPUInt32 * numRevKeys);
PGPError PGPGetIndexedRevocationKey(
PGPKeyRef basekey, PGPKeySetRef allkeys, PGPUInt32 nth,
PGPKeyRef *revkey, PGPKeyID *revkeyid );
PGPError PGPGetCRLDistributionPoints(
PGPKeyRef cakey, PGPKeySetRef keyset,
PGPUInt32 *pnDistPoints, PGPByte **pDpoints,
PGPSize **pdpointLengths );
/* Wrapper functions */
PGPError PGPGenerateKey( PGPContextRef context, PGPKeyRef *key,
PGPOptionListRef firstOption, ...);
PGPError PGPGenerateSubKey( PGPContextRef context,
PGPSubKeyRef *subkey,
PGPOptionListRef firstOption, ...);
PGPUInt32 PGPGetKeyEntropyNeeded( PGPContextRef context,
PGPOptionListRef firstOption, ...);
PGPError PGPExportKeySet( PGPKeySetRef keys,
PGPOptionListRef firstOption, ...);
PGPError PGPExport( PGPContextRef context,
PGPOptionListRef firstOption, ...);
PGPError PGPImportKeySet( PGPContextRef context,
PGPKeySetRef *keys,
PGPOptionListRef firstOption, ...);
PGPError PGPSignUserID( PGPUserIDRef userID,
PGPKeyRef certifyingKey,
PGPOptionListRef firstOption, ...);
PGPError PGPAddUserID( PGPKeyRef key, char const *userID,
PGPOptionListRef firstOption, ...);
PGPError PGPAddAttributeUserID( PGPKeyRef key,
PGPAttributeType attributeType,
PGPByte *attributeData, PGPSize attributeLength,
PGPOptionListRef firstOption, ...);
PGPError PGPRevokeSig( PGPSigRef cert, PGPKeySetRef allkeys,
PGPOptionListRef firstOption, ...);
PGPError PGPRevokeKey( PGPKeyRef key,
PGPOptionListRef firstOption, ...);
PGPError PGPRevokeSubKey( PGPSubKeyRef subkey,
PGPOptionListRef firstOption, ...);
PGPError PGPChangePassphrase( PGPKeyRef key,
PGPOptionListRef firstOption, ...);
PGPError PGPChangeSubKeyPassphrase( PGPSubKeyRef subkey,
PGPOptionListRef firstOption, ...);
PGPBoolean PGPPassphraseIsValid( PGPKeyRef key,
PGPOptionListRef firstOption, ...);
PGPError PGPSetKeyAxiomatic( PGPKeyRef key,
PGPOptionListRef firstOption, ...);
/*
* Trust values for PGPSetKeyTrust and kPGPKeyPropTrust property:
*
* kPGPKeyTrust_Undefined (do not pass to PGPSetKeyTrust)
* kPGPKeyTrust_Unknown (unknown)
* kPGPKeyTrust_Never (never)
* kPGPKeyTrust_Marginal (sometimes)
* kPGPKeyTrust_Complete (always)
* kPGPKeyTrust_Ultimate (do not pass to PGPSetKeyTrust)
*/
/* old trust model */
PGPError PGPSetKeyTrust( PGPKeyRef key, PGPUInt32 trust);
PGPError PGPUnsetKeyAxiomatic( PGPKeyRef key);
/* Get property functions */
PGPError PGPGetKeyBoolean( PGPKeyRef key, PGPKeyPropName propname,
PGPBoolean *prop);
PGPError PGPGetKeyNumber( PGPKeyRef key, PGPKeyPropName propname,
PGPInt32 *prop);
/* 'buffer' is NOT null-terminated */
/* returns kPGPError_BufferTooSmall if buffer is too small, but
fill buffer to capacity */
PGPError PGPGetKeyPropertyBuffer( PGPKeyRef key,
PGPKeyPropName propname,
PGPSize bufferSize, void *data, PGPSize *fullSize);
PGPError PGPGetKeyTime( PGPKeyRef key, PGPKeyPropName propname,
PGPTime *prop);
PGPError PGPGetSubKeyBoolean( PGPSubKeyRef subkey,
PGPKeyPropName propname, PGPBoolean *prop);
PGPError PGPGetSubKeyNumber( PGPSubKeyRef subkey,
PGPKeyPropName propname, PGPInt32 *prop);
/* returns kPGPError_BufferTooSmall if buffer is too small, but
fill buffer to capacity */
PGPError PGPGetSubKeyPropertyBuffer( PGPSubKeyRef subkey,
PGPKeyPropName propname,
PGPSize bufferSize, void *prop, PGPSize *fullSize);
PGPError PGPGetSubKeyTime( PGPSubKeyRef subkey,
PGPKeyPropName propname, PGPTime *prop);
PGPError PGPGetUserIDNumber( PGPUserIDRef userID,
PGPUserIDPropName propname, PGPInt32 *prop);
PGPError PGPGetUserIDBoolean( PGPUserIDRef userID,
PGPUserIDPropName propname, PGPBoolean *prop);
/* 'string' is always NULL-terminated */
/* returns kPGPError_BufferTooSmall if buffer is too small, but
fill buffer to capacity */
PGPError PGPGetUserIDStringBuffer( PGPUserIDRef userID,
PGPUserIDPropName propname,
PGPSize bufferSize,
char * string,
PGPSize * fullSize);
/* 'buffer' is NOT null-terminated */
/* returns kPGPError_BufferTooSmall if buffer is too small, but
fill buffer to capacity */
PGPError PGPGetSigPropertyBuffer( PGPSigRef cert,
PGPSigPropName propname,
PGPSize bufferSize, void *data, PGPSize *fullSize);
PGPError PGPGetSigBoolean( PGPSigRef cert,
PGPSigPropName propname, PGPBoolean *prop);
PGPError PGPGetSigNumber( PGPSigRef cert, PGPSigPropName propname,
PGPInt32 *prop);
PGPError PGPGetKeyIDOfCertifier( PGPSigRef sig, PGPKeyID *outID );
PGPError PGPGetSigTime( PGPSigRef cert, PGPSigPropName propname,
PGPTime *prop);
PGPError PGPGetHashAlgUsed( PGPKeyRef key, PGPHashAlgorithm *hashAlg);
/* Convenience property functions */
PGPError PGPGetPrimaryUserID( PGPKeyRef key, PGPUserIDRef *outRef );
PGPError PGPGetPrimaryAttributeUserID (PGPKeyRef key,
PGPAttributeType attributeType, PGPUserIDRef *outRef);
/* 'string' is always a C string and
*fullSize includes the '\0' terminator */
/* returns kPGPError_BufferTooSmall if buffer is too small, but
fill buffer to capacity */
PGPError PGPGetPrimaryUserIDNameBuffer( PGPKeyRef key,
PGPSize bufferSize,
char * string, PGPSize *fullSize );
PGPError PGPGetPrimaryUserIDValidity(PGPKeyRef key,
PGPValidity *validity);
PGPInt32 PGPCompareKeys(PGPKeyRef a, PGPKeyRef b,
PGPKeyOrdering order);
PGPInt32 PGPCompareUserIDStrings(char const *a, char const *b);
PGPError PGPOrderKeySet( PGPKeySetRef src,
PGPKeyOrdering order, PGPKeyListRef *outRef );
PGPError PGPIncKeyListRefCount( PGPKeyListRef keys);
PGPError PGPFreeKeyList( PGPKeyListRef keys);
/* Key iteration functions */
PGPError PGPNewKeyIter (PGPKeyListRef keys, PGPKeyIterRef *outRef);
PGPError PGPCopyKeyIter (PGPKeyIterRef orig, PGPKeyIterRef *outRef);
PGPError PGPFreeKeyIter (PGPKeyIterRef iter);
PGPInt32 PGPKeyIterIndex (PGPKeyIterRef iter);
PGPError PGPKeyIterRewind (PGPKeyIterRef iter);
PGPInt32 PGPKeyIterSeek (PGPKeyIterRef iter, PGPKeyRef key);
PGPError PGPKeyIterMove (PGPKeyIterRef iter, PGPInt32 relOffset,
PGPKeyRef *outRef);
PGPError PGPKeyIterNext (PGPKeyIterRef iter, PGPKeyRef *outRef);
PGPError PGPKeyIterPrev (PGPKeyIterRef iter, PGPKeyRef *outRef);
PGPError PGPKeyIterKey (PGPKeyIterRef iter, PGPKeyRef *outRef);
PGPError PGPKeyIterSubKey (PGPKeyIterRef iter,
PGPSubKeyRef *outRef );
PGPError PGPKeyIterUserID (PGPKeyIterRef iter,
PGPUserIDRef *outRef );
PGPError PGPKeyIterSig (PGPKeyIterRef iter,
PGPSigRef *outRef );
PGPError PGPKeyIterNextSubKey (PGPKeyIterRef iter,
PGPSubKeyRef *outRef );
PGPError PGPKeyIterPrevSubKey (PGPKeyIterRef iter,
PGPSubKeyRef *outRef);
PGPError PGPKeyIterRewindSubKey (PGPKeyIterRef iter);
PGPError PGPKeyIterNextUserID (PGPKeyIterRef iter,
PGPUserIDRef *outRef);
PGPError PGPKeyIterPrevUserID (PGPKeyIterRef iter,
PGPUserIDRef *outRef);
PGPError PGPKeyIterRewindUserID (PGPKeyIterRef iter);
PGPError PGPKeyIterNextUIDSig (PGPKeyIterRef iter,
PGPSigRef *outRef);
PGPError PGPKeyIterPrevUIDSig (PGPKeyIterRef iter,
PGPSigRef *outRef);
PGPError PGPKeyIterRewindUIDSig (PGPKeyIterRef iter);
/* Get/set default private key */
PGPError PGPGetDefaultPrivateKey( PGPKeySetRef keyset,
PGPKeyRef *outRef );
PGPError PGPSetDefaultPrivateKey( PGPKeyRef key);
/* Get/set user value */
PGPError PGPSetKeyUserVal( PGPKeyRef key, PGPUserValue userValue);
PGPError PGPSetUserIDUserVal( PGPUserIDRef userid,
PGPUserValue userValue);
PGPError PGPSetSubKeyUserVal( PGPSubKeyRef subkey,
PGPUserValue userValue);
PGPError PGPSetSigUserVal( PGPSigRef cert,
PGPUserValue userValue);
PGPError PGPGetKeyUserVal( PGPKeyRef key,
PGPUserValue *userValue);
PGPError PGPGetUserIDUserVal( PGPUserIDRef userid,
PGPUserValue *userValue);
PGPError PGPGetSubKeyUserVal( PGPSubKeyRef subkey,
PGPUserValue *userValue);
PGPError PGPGetSigUserVal( PGPSigRef cert,
PGPUserValue *userValue);
/* Passphrase conversion to passkeybuffer */
/* The size of the output buffer is from the kPGPKeyPropLockingBits property */
PGPError PGPGetKeyPasskeyBuffer ( PGPKeyRef key,
void *passkeyBuffer, PGPOptionListRef firstOption,...);
PGPError PGPGetSubKeyPasskeyBuffer ( PGPSubKeyRef subkey,
void *passkeyBuffer, PGPOptionListRef firstOption,...);
/* Change key options which are stored in self signatures internally */
PGPError PGPAddKeyOptions( PGPKeyRef key,
PGPOptionListRef firstOption, ...);
PGPError PGPRemoveKeyOptions( PGPKeyRef key,
PGPOptionListRef firstOption, ...);
PGPError PGPUpdateKeyOptions( PGPKeyRef key,
PGPOptionListRef firstOption, ...);
/*____________________________________________________________________________
Key IDs
____________________________________________________________________________*/
PGPError PGPGetKeyIDFromString(
const char *string, PGPKeyID *id );
PGPError PGPGetKeyIDFromKey( PGPKeyRef key, PGPKeyID *id );
PGPError PGPGetKeyIDFromSubKey( PGPSubKeyRef key, PGPKeyID * id );
enum PGPKeyIDStringType_
{
kPGPKeyIDString_Abbreviated = 2,
kPGPKeyIDString_Full = 3,
PGP_ENUM_FORCE( PGPKeyIDStringType_ )
};
PGPENUM_TYPEDEF( PGPKeyIDStringType_, PGPKeyIDStringType );
#define kPGPMaxKeyIDStringSize ( 127 + 1 )
PGPError PGPGetKeyIDString( PGPKeyID const * ref,
PGPKeyIDStringType type,
char outString[ kPGPMaxKeyIDStringSize ] );
/* outputs opaque string of bytes for storage of maximum size as keyID*/
/* do NOT attempt to parse the output; it is opaque to you */
#define kPGPMaxExportedKeyIDSize ( sizeof( PGPKeyID ) )
PGPError PGPExportKeyID( PGPKeyID const * keyID,
PGPByte exportedData[ kPGPMaxExportedKeyIDSize ],
PGPSize *exportedLength );
/* must be in format output by PGPExportKeyID */
PGPError PGPImportKeyID( void const * data, PGPKeyID * id );
/* returns 0 if equal, -1 if key1 < key2, 1 if key1 > key2 */
PGPInt32 PGPCompareKeyIDs( PGPKeyID const * key, PGPKeyID const * key2);
/*____________________________________________________________________________
Getting contexts back from key related items. If the key is invalid,
you get kPGPInvalidRef back.
____________________________________________________________________________*/
PGPContextRef PGPGetKeyListContext( PGPKeyListRef ref );
PGPContextRef PGPGetKeySetContext( PGPKeySetRef ref );
PGPContextRef PGPGetKeyIterContext( PGPKeyIterRef ref );
PGPContextRef PGPGetKeyContext( PGPKeyRef ref );
PGPContextRef PGPGetSubKeyContext( PGPSubKeyRef ref );
PGPContextRef PGPGetUserIDContext( PGPUserIDRef ref );
/*____________________________________________________________________________
Getting parent objects from key related items. If the input is invalid,
you get kPGPInvalidRef back.
____________________________________________________________________________*/
PGPKeyRef PGPGetUserIDKey( PGPUserIDRef ref );
PGPUserIDRef PGPGetSigUserID( PGPSigRef ref );
PGPKeyRef PGPGetSigKey( PGPSigRef ref );
/*____________________________________________________________________________
Secret sharing functionality
____________________________________________________________________________*/
PGPError PGPSecretShareData(PGPContextRef context,
void const * input, PGPSize inputBytes,
PGPUInt32 threshold, PGPUInt32 nShares, void * output);
PGPError PGPSecretReconstructData(PGPContextRef context,
void * input, PGPSize outputBytes,
PGPUInt32 nShares, void * output);
/*____________________________________________________________________________
X509 certificate specific
____________________________________________________________________________*/
PGPError PGPVerifyX509CertificateChain (PGPContextRef context,
PGPByte *certchain, PGPByte *rootcerts);
PGPError PGPCreateDistinguishedName( PGPContextRef context,
char const *str,
PGPByte **pdname, PGPSize *pdnamelen );
#if PRAGMA_IMPORT_SUPPORTED
#pragma import reset
#endif
PGP_END_C_DECLARATIONS
#endif /* ] Included_pgpKeys_h */
/*__Editor_settings____
Local Variables:
tab-width: 4
End:
vi: ts=4 sw=4
vim: si
_____________________*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -