cert.h 1.44 KB
#ifndef __BB_SK_CERT_HDR__
#define __BB_SK_CERT_HDR__

/* utility functions for managing and verifying certs */

#include <PR/bbcert.h>
#include "skerror.h"
#include "util.h"

#define CHAIN_TYPE_DONT_CARE   0
#define CHAIN_TYPE_TICKET_PUB  1
#define CHAIN_TYPE_CONTENT_PUB 2

/*
 * XXX: these two verification functions are stubbed out now.
 *      once in place these function declarations should be
 *      moved to an appropriate header.
 */

/* terminate data arg with zero size element. */
int verifyRsaSig(
    SkDataChain *data,
    u8 *rsaPubkey,         /* size determined by sigType arg */
    BbRsaExponent rsaExp,
    u32 sigType,           /* signature type, BB_SIG_TYPE_* */
    BbGenericSig *signature /* compare against this */
    );   

int TESTverifyEccSig(
    SkDataChain *data,
    u8 *eccPubkey,         /* size determined by sigType arg */
    u32 sigType,           /* signature type, BB_SIG_TYPE_* */
    BbGenericSig *signature /* compare against this */
    );      

/*
 * Cert handling functions
 */

/* return size (>0) on success, error code (<0) on failure. */
int getCertSize(BbCertBase *cert);

/* return size (>0) on success, error code (<0) on failure. */
int getCertSigSize(BbCertBase *cert);

int getCertSig(BbCertBase *cert,BbGenericSig **sig);

int verifyCertSig(BbCertBase *cert, BbCertBase *signer);

/* serverType arg is CHAIN_TYPE_*, defined earlier in this file. */
int verifyCertChain(BbCertBase **chain, u32 chainType);

#endif