cert.h
来自「支持SSL v2/v3, TLS, PKCS #5, PKCS #7, PKCS」· C头文件 代码 · 共 1,391 行 · 第 1/3 页
H
1,391 行
CERT_NumPermCertsForNickname(CERTCertDBHandle *handle, char *nickname);intCERT_NumCertsForCertSubject(CERTCertificate *cert);intCERT_NumPermCertsForCertSubject(CERTCertificate *cert);SECStatusCERT_TraverseCertsForSubject(CERTCertDBHandle *handle, CERTSubjectList *subjectList, CERTCertCallback cb, void *cbarg);/* currently a stub for address book */PRBoolCERT_IsCertRevoked(CERTCertificate *cert);voidCERT_DestroyCertArray(CERTCertificate **certs, unsigned int ncerts);/* convert an email address to lower case */char *CERT_FixupEmailAddr(char *emailAddr);/* decode string representation of trust flags into trust struct */SECStatusCERT_DecodeTrustString(CERTCertTrust *trust, char *trusts);/* encode trust struct into string representation of trust flags */char *CERT_EncodeTrustString(CERTCertTrust *trust);/* find the next or prev cert in a subject list */CERTCertificate *CERT_PrevSubjectCert(CERTCertificate *cert);CERTCertificate *CERT_NextSubjectCert(CERTCertificate *cert);/* * import a collection of certs into the temporary or permanent cert * database */SECStatusCERT_ImportCerts(CERTCertDBHandle *certdb, SECCertUsage usage, unsigned int ncerts, SECItem **derCerts, CERTCertificate ***retCerts, PRBool keepCerts, PRBool caOnly, char *nickname);SECStatusCERT_SaveImportedCert(CERTCertificate *cert, SECCertUsage usage, PRBool caOnly, char *nickname);char *CERT_MakeCANickname(CERTCertificate *cert);PRBoolCERT_IsCACert(CERTCertificate *cert, unsigned int *rettype);SECStatusCERT_SaveSMimeProfile(CERTCertificate *cert, SECItem *emailProfile, SECItem *profileTime);/* * find the smime symmetric capabilities profile for a given cert */SECItem *CERT_FindSMimeProfile(CERTCertificate *cert);intCERT_GetDBContentVersion(CERTCertDBHandle *handle);voidCERT_SetDBContentVersion(int version, CERTCertDBHandle *handle);SECStatusCERT_AddNewCerts(CERTCertDBHandle *handle);CERTPackageTypeCERT_CertPackageType(SECItem *package, SECItem *certitem);CERTCertificatePolicies *CERT_DecodeCertificatePoliciesExtension(SECItem *extnValue);voidCERT_DestroyCertificatePoliciesExtension(CERTCertificatePolicies *policies);CERTUserNotice *CERT_DecodeUserNotice(SECItem *noticeItem);voidCERT_DestroyUserNotice(CERTUserNotice *userNotice);typedef char * (* CERTPolicyStringCallback)(char *org, unsigned long noticeNumber, void *arg);voidCERT_SetCAPolicyStringCallback(CERTPolicyStringCallback cb, void *cbarg);char *CERT_GetCertCommentString(CERTCertificate *cert);PRBoolCERT_GovtApprovedBitSet(CERTCertificate *cert);SECStatusCERT_AddPermNickname(CERTCertificate *cert, char *nickname);/* * Given a cert, find the cert with the same subject name that * has the given key usage. If the given cert has the correct keyUsage, then * return it, otherwise search the list in order. */CERTCertificate *CERT_FindCertByUsage(CERTCertificate *basecert, unsigned int requiredKeyUsage);CERTCertList *CERT_MatchUserCert(CERTCertDBHandle *handle, SECCertUsage usage, int nCANames, char **caNames, void *proto_win);CERTCertList *CERT_NewCertList(void);voidCERT_DestroyCertList(CERTCertList *certs);/* remove the node and free the cert */voidCERT_RemoveCertListNode(CERTCertListNode *node);SECStatusCERT_AddCertToListTail(CERTCertList *certs, CERTCertificate *cert);typedef PRBool (* CERTSortCallback)(CERTCertificate *certa, CERTCertificate *certb, void *arg);SECStatusCERT_AddCertToListSorted(CERTCertList *certs, CERTCertificate *cert, CERTSortCallback f, void *arg);/* callback for CERT_AddCertToListSorted that sorts based on validity * period and a given time. */PRBoolCERT_SortCBValidity(CERTCertificate *certa, CERTCertificate *certb, void *arg);SECStatusCERT_CheckForEvilCert(CERTCertificate *cert);CERTGeneralName *CERT_GetCertificateNames(CERTCertificate *cert, PRArenaPool *arena);intCERT_GetNamesLength(CERTGeneralName *names);CERTCertificate *CERT_CompareNameSpace(CERTCertificate *cert, CERTGeneralName *namesList, SECItem *namesListIndex, PRArenaPool *arena, CERTCertDBHandle *handle);SECStatus CERT_EncodeSubjectKeyID(PRArenaPool *arena, char *value, int len, SECItem *encodedValue);char *CERT_GetNickName(CERTCertificate *cert, CERTCertDBHandle *handle, PRArenaPool *nicknameArena);/* * Creates or adds to a list of all certs with a give subject name, sorted by * validity time, newest first. Invalid certs are considered older than * valid certs. If validOnly is set, do not include invalid certs on list. */CERTCertList *CERT_CreateSubjectCertList(CERTCertList *certList, CERTCertDBHandle *handle, SECItem *name, int64 sorttime, PRBool validOnly);/* * Creates or adds to a list of all certs with a give nickname, sorted by * validity time, newest first. Invalid certs are considered older than valid * certs. If validOnly is set, do not include invalid certs on list. */CERTCertList *CERT_CreateNicknameCertList(CERTCertList *certList, CERTCertDBHandle *handle, char *nickname, int64 sorttime, PRBool validOnly);/* * Creates or adds to a list of all certs with a give email addr, sorted by * validity time, newest first. Invalid certs are considered older than valid * certs. If validOnly is set, do not include invalid certs on list. */CERTCertList *CERT_CreateEmailAddrCertList(CERTCertList *certList, CERTCertDBHandle *handle, char *emailAddr, int64 sorttime, PRBool validOnly);/* * remove certs from a list that don't have keyUsage and certType * that match the given usage. */SECStatusCERT_FilterCertListByUsage(CERTCertList *certList, SECCertUsage usage, PRBool ca);/* * check the key usage of a cert against a set of required values */SECStatusCERT_CheckKeyUsage(CERTCertificate *cert, unsigned int requiredUsage);/* * return required key usage and cert type based on cert usage */SECStatusCERT_KeyUsageAndTypeForCertUsage(SECCertUsage usage, PRBool ca, unsigned int *retKeyUsage, unsigned int *retCertType);/* * return required trust flags for various cert usages for CAs */SECStatusCERT_TrustFlagsForCACertUsage(SECCertUsage usage, unsigned int *retFlags, SECTrustType *retTrustType);/* * Find all user certificates that match the given criteria. * * "handle" - database to search * "usage" - certificate usage to match * "oneCertPerName" - if set then only return the "best" cert per * name * "validOnly" - only return certs that are curently valid * "proto_win" - window handle passed to pkcs11 */CERTCertList *CERT_FindUserCertsByUsage(CERTCertDBHandle *handle, SECCertUsage usage, PRBool oneCertPerName, PRBool validOnly, void *proto_win);/* * Find a user certificate that matchs the given criteria. * * "handle" - database to search * "nickname" - nickname to match * "usage" - certificate usage to match * "validOnly" - only return certs that are curently valid * "proto_win" - window handle passed to pkcs11 */CERTCertificate *CERT_FindUserCertByUsage(CERTCertDBHandle *handle, char *nickname, SECCertUsage usage, PRBool validOnly, void *proto_win);/* * Filter a list of certificates, removing those certs that do not have * one of the named CA certs somewhere in their cert chain. * * "certList" - the list of certificates to filter * "nCANames" - number of CA names * "caNames" - array of CA names in string(rfc 1485) form * "usage" - what use the certs are for, this is used when * selecting CA certs */SECStatusCERT_FilterCertListByCANames(CERTCertList *certList, int nCANames, char **caNames, SECCertUsage usage);/* * Collect the nicknames from all certs in a CertList. If the cert is not * valid, append a string to that nickname. * * "certList" - the list of certificates * "expiredString" - the string to append to the nickname of any expired cert * "notYetGoodString" - the string to append to the nickname of any cert * that is not yet valid */CERTCertNicknames *CERT_NicknameStringsFromCertList(CERTCertList *certList, char *expiredString, char *notYetGoodString);/* * Extract the nickname from a nickmake string that may have either * expiredString or notYetGoodString appended. * * Args: * "namestring" - the string containing the nickname, and possibly * one of the validity label strings * "expiredString" - the expired validity label string * "notYetGoodString" - the not yet good validity label string * * Returns the raw nickname */char *CERT_ExtractNicknameString(char *namestring, char *expiredString, char *notYetGoodString);/* * Given a certificate, return a string containing the nickname, and possibly * one of the validity strings, based on the current validity state of the * certificate. * * "arena" - arena to allocate returned string from. If NULL, then heap * is used. * "cert" - the cert to get nickname from * "expiredString" - the string to append to the nickname if the cert is * expired. * "notYetGoodString" - the string to append to the nickname if the cert is * not yet good. */char *CERT_GetCertNicknameWithValidity(PRArenaPool *arena, CERTCertificate *cert, char *expiredString, char *notYetGoodString);/* * Return the string representation of a DER encoded distinguished name * "dername" - The DER encoded name to convert */char *CERT_DerNameToAscii(SECItem *dername);/* * Supported usage values and types: * certUsageSSLClient * certUsageSSLServer * certUsageSSLServerWithStepUp * certUsageEmailSigner * certUsageEmailRecipient * certUsageObjectSigner */CERTCertificate *CERT_FindMatchingCert(CERTCertDBHandle *handle, SECItem *derName, CERTCertOwner owner, SECCertUsage usage, PRBool preferTrusted, int64 validTime, PRBool validOnly);/*********************************************************************//* A thread safe implementation of General Names *//*********************************************************************//* Destroy a Single CERTGeneralName */voidCERT_DestroyGeneralName(CERTGeneralName *name);/* Destroys a CERTGeneralNameList */voidCERT_DestroyGeneralNameList(CERTGeneralNameList *list);/* Creates a CERTGeneralNameList */CERTGeneralNameList *CERT_CreateGeneralNameList(CERTGeneralName *name);/* Compares two CERTGeneralNameList */SECStatusCERT_CompareGeneralNameLists(CERTGeneralNameList *a, CERTGeneralNameList *b);/* returns a copy of the first name of the type requested */void *CERT_GetGeneralNameFromListByType(CERTGeneralNameList *list, CERTGeneralNameType type, PRArenaPool *arena);/* Adds a name to the tail of the list */voidCERT_AddGeneralNameToList(CERTGeneralNameList *list, CERTGeneralNameType type, void *data, SECItem *oid);/* returns a duplicate of the CERTGeneralNameList */CERTGeneralNameList *CERT_DupGeneralNameList(CERTGeneralNameList *list);/* returns the length of a CERTGeneralName */intCERT_GetNamesLength(CERTGeneralName *names);/* * Acquire the global lock on the cert database. * This lock is currently used for the following operations: * adding or deleting a cert to either the temp or perm databases * converting a temp to perm or perm to temp * changing(maybe just adding?) the trust of a cert * adjusting the reference count of a cert */voidCERT_LockDB(CERTCertDBHandle *handle);/* * Free the global cert database lock. */voidCERT_UnlockDB(CERTCertDBHandle *handle);/* * Get the certificate status checking configuratino data for * the certificate database */CERTStatusConfig *CERT_GetStatusConfig(CERTCertDBHandle *handle);/* * Set the certificate status checking information for the * database. The input structure becomes part of the certificate * database and will be freed by calling the 'Destroy' function in * the configuration object. */voidCERT_SetStatusConfig(CERTCertDBHandle *handle, CERTStatusConfig *config);/* * Acquire the cert reference count lock * There is currently one global lock for all certs, but I'm putting a cert * arg here so that it will be easy to make it per-cert in the future if * that turns out to be necessary. */voidCERT_LockCertRefCount(CERTCertificate *cert);/* * Free the cert reference count lock */voidCERT_UnlockCertRefCount(CERTCertificate *cert);/* * Acquire the cert trust lock * There is currently one global lock for all certs, but I'm putting a cert * arg here so that it will be easy to make it per-cert in the future if * that turns out to be necessary. */voidCERT_LockCertTrust(CERTCertificate *cert);/* * Free the cert trust lock */voidCERT_UnlockCertTrust(CERTCertificate *cert);/* * Digest the cert's subject public key using the specified algorithm. * The necessary storage for the digest data is allocated. If "fill" is * non-null, the data is put there, otherwise a SECItem is allocated. * Allocation from "arena" if it is non-null, heap otherwise. Any problem * results in a NULL being returned (and an appropriate error set). */ extern SECItem *CERT_SPKDigestValueForCert(PRArenaPool *arena, CERTCertificate *cert, SECOidTag digestAlg, SECItem *fill);SEC_END_PROTOS#endif /* _CERT_H_ */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?