#ifndef _CERT_H_
#define _CERT_H_ 1
#include "SecCmsBase.h"
#include <Security/nameTemplates.h>
#include <Security/SecCertificate.h>
#include <CoreFoundation/CFDate.h>
#include <Security/SecTrust.h>
#include "cmstpriv.h"
#include <security_asn1/seccomon.h>
SEC_BEGIN_PROTOS
#if !USE_CDSA_CRYPTO
bool CERT_CheckIssuerAndSerial(SecCertificateRef cert, SecAsn1Item *issuer, SecAsn1Item *serial);
#endif
typedef void CERTVerifyLog;
void CERT_NormalizeX509NameNSS(NSS_Name *nssName);
SecIdentityRef CERT_FindIdentityByUsage(SecKeychainRef keychainOrArray,
char *nickname, SECCertUsage usage, Boolean validOnly, void *proto_win);
SecCertificateRef CERT_FindUserCertByUsage(SecKeychainRef dbhandle,
char *nickname,SECCertUsage usage,Boolean validOnly,void *proto_win);
SecCertificateRef CERT_FindCertByNicknameOrEmailAddr(SecKeychainRef dbhandle, char *name);
SecPublicKeyRef SECKEY_CopyPublicKey(SecPublicKeyRef pubKey);
void SECKEY_DestroyPublicKey(SecPublicKeyRef pubKey);
SecPublicKeyRef SECKEY_CopyPrivateKey(SecPublicKeyRef privKey);
void SECKEY_DestroyPrivateKey(SecPublicKeyRef privKey);
void CERT_DestroyCertificate(SecCertificateRef cert);
SecCertificateRef CERT_DupCertificate(SecCertificateRef cert);
CF_RETURNS_RETAINED CFArrayRef CERT_CertChainFromCert(SecCertificateRef cert, SECCertUsage usage,Boolean includeRoot);
CFArrayRef CERT_CertListFromCert(SecCertificateRef cert);
CFArrayRef CERT_DupCertList(CFArrayRef oldList);
SecPublicKeyRef CERT_ExtractPublicKey(SecCertificateRef cert);
SECStatus CERT_CheckCertUsage (SecCertificateRef cert,unsigned char usage);
SecCertificateRef CERT_FindCertByEmailAddr(SecKeychainRef keychainOrArray, char *emailAddr);
SecCertificateRef CERT_FindCertByDERCert(SecKeychainRef keychainOrArray, const SecAsn1Item *derCert);
SecCertificateRef CERT_FindCertByIssuerAndSN (CFTypeRef keychainOrArray, const SecCmsIssuerAndSN *issuerAndSN);
SecCertificateRef CERT_FindCertBySubjectKeyID (CFTypeRef keychainOrArray, const SecAsn1Item *subjKeyID);
SecIdentityRef CERT_FindIdentityByIssuerAndSN (CFTypeRef keychainOrArray, const SecCmsIssuerAndSN *issuerAndSN);
SecCertificateRef CERT_FindCertificateByIssuerAndSN (CFTypeRef keychainOrArray, const SecCmsIssuerAndSN *issuerAndSN);
SecIdentityRef CERT_FindIdentityBySubjectKeyID (CFTypeRef keychainOrArray, const SecAsn1Item *subjKeyID);
SecAsn1Item *CERT_FindSMimeProfile(SecCertificateRef cert);
SECStatus CERT_FindSubjectKeyIDExtension (SecCertificateRef cert, SecAsn1Item *retItem);
SecCmsIssuerAndSN *CERT_GetCertIssuerAndSN(PRArenaPool *pl, SecCertificateRef cert);
SECStatus CERT_ImportCerts(SecKeychainRef keychain, SECCertUsage usage,unsigned int ncerts,
SecAsn1Item **derCerts,SecCertificateRef **retCerts, Boolean keepCerts,Boolean caOnly, char *nickname);
SECStatus CERT_SaveSMimeProfile(SecCertificateRef cert, SecAsn1Item *emailProfile,SecAsn1Item *profileTime);
SECStatus CERT_VerifyCertName(SecCertificateRef cert, const char *hostname);
#if USE_CDSA_CRYPTO
SECStatus CERT_VerifyCert(SecKeychainRef keychainOrArray, SecCertificateRef cert,
CFTypeRef policies, CFAbsoluteTime stime, SecTrustRef *trustRef);
#else
SECStatus CERT_VerifyCert(SecKeychainRef keychainOrArray, CFArrayRef cert,
CFTypeRef policies, CFAbsoluteTime stime, SecTrustRef *trustRef);
#endif
CFTypeRef CERT_PolicyForCertUsage(SECCertUsage certUsage);
SEC_END_PROTOS
#endif