if (cc->trust) { CERTCertTrust *trust = cc->trust; c->trust.serverAuth = get_stan_trust(trust->sslFlags); c->trust.clientAuth = get_stan_trust(trust->sslFlags); c->trust.emailProtection = get_stan_trust(trust->emailFlags); c->trust.codeSigning= get_stan_trust(trust->objectSigningFlags); }
STAN_GetNSSCertificate(CERTCertificate *cc){    NSSCertificate *c;    NSSArena *arena;    c = cc->nssCertificate;    if (c) {    	return c;    }    /* i don't think this should happen.  but if it can, need to create     * NSSCertificate from CERTCertificate values here.  */    /* Yup, it can happen. */    arena = NSSArena_Create();    if (!arena) {	return NULL;    }    c = NSSCertificate_Create(arena);    if (!c) {	goto loser;    }    NSSITEM_FROM_SECITEM(&c->encoding, &cc->derCert);    c->type = NSSCertificateType_PKIX;    c->arena = arena;    nssItem_Create(arena,                   &c->issuer, cc->derIssuer.len, cc->derIssuer.data);    nssItem_Create(arena,                   &c->subject, cc->derSubject.len, cc->derSubject.data);    nssItem_Create(arena,                   &c->serial, cc->serialNumber.len, cc->serialNumber.data);    if (cc->nickname) {	c->nickname = nssUTF8_Create(arena,                                 nssStringType_UTF8String,                                 (NSSUTF8 *)cc->nickname,                                 PORT_Strlen(cc->nickname));    }    if (cc->emailAddr) {        c->email = nssUTF8_Create(arena,                                  nssStringType_PrintableString,                                  (NSSUTF8 *)cc->emailAddr,                                  PORT_Strlen(cc->emailAddr));    }    c->trustDomain = (NSSTrustDomain *)cc->dbhandle;    if (cc->slot) {	c->token = PK11Slot_GetNSSToken(cc->slot);	c->slot = c->token->slot;    }    cc->nssCertificate = c;    return c;loser:    nssArena_Destroy(arena);    return NULL;}