Plan 9 from Bell Labs’s /usr/web/sources/contrib/lucio/asn1/devel/oid.h

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


/*
**	@(#) oid.h - Definitions
**	@(#) $Id: oid.h,v 1.5 2003/12/08 07:14:21 lucio Exp $
*/

/*
** ==================================================================
**
**      $Logfile:$
**      $RCSfile: oid.h,v $
**      $Revision: 1.5 $
**      $Date: 2003/12/08 07:14:21 $
**      $Author: lucio $
**
** ==================================================================
**
**      $Log: oid.h,v $
**      Revision 1.5  2003/12/08 07:14:21  lucio
**      Weekend developments - mostly OID related
**
**      Revision 1.4  2003/12/05 16:00:44  lucio
**      Checkpoint - with a view to some homework.
**
**      Revision 1.3  2003/12/04 16:13:30  lucio
**      Checkpoint - OID rethink (incomplete)
**
**      Revision 1.2  2003/12/04 11:31:42  lucio
**      Streamlined - specially OID management
**
**      Revision 1.1  2003/11/30 18:45:17  lucio
**      OID definitions
**
** ==================================================================
*/

#define	OIDMAX	(256)

enum {
	OID_RSAENCRYPTION = 0,
	OID_MD2RSAENCRYPTION,
	OID_MD4RSAENCRYPTION,
	OID_MD5RSAENCRYPTION,
	OID_SHA1RSAENCRYPTION,
	OID_MD2,
	OID_MD4,
	OID_MD5,
	OID_RSA,
};

enum {
	OID_MSGDATA = 0,
	OID_MSGSIGNEDDATA,
	OID_MSGENVELOPEDDATA,
	OID_MSGSIGNEDANDENVELOPEDDATA,
	OID_MSGDIGESTEDDATA,
	OID_MSGENCRYPTEDDATA,
};

typedef struct oidalg OidAlg;
struct oidalg {
	char *str;
	uchar *ber;
	int len;
	void (*proc)(BerObj *, int);
};

typedef struct oidcrypt OidCrypt;
struct oidcrypt {
	char *str;
	uchar *ber;
	int len;
	void (*proc)(BerObj *, int);
};

typedef struct oidhier OidHier;
struct oidhier {
	uchar *oid;			// ASN.1 representation
	int len;			// ASN.1 length
	long long roid;		// relative value
	char *name;			// common name
	char *descr;		// description
	char **alias;		// other names (nil-terminated)
	OidHier *next;		// sibling
	OidHier *down;		// progeny
};

typedef struct oidobj OidObj;
struct oidobj {
	BerObj *obj;
	OidHier *hier;
};

/*
extern char *BER_CN_OBJECTID;
extern int LEN_BER_CN;
extern char *BER_COUNTRY_OBJECTID;
extern int LEN_BER_COUNTRY;
extern char *BER_LOCALITY_OBJECTID;
extern int LEN_BER_LOCALITY;
extern char *BER_MD2RSAENCRYPTION_OBJECTID;
extern int LEN_BER_MD2RSAENCRYPTION;
extern char *BER_MD2_OBJECTID;
extern int LEN_BER_MD2;
extern char *BER_MD5_OBJECTID;
extern int LEN_BER_MD5;
extern char *BER_ORGUNIT_OBJECTID;
extern int LEN_BER_ORGUNIT;
extern char *BER_ORG_OBJECTID;
extern int LEN_BER_ORG;
extern char *BER_RSAENCRYPTION_OBJECTID;
extern int LEN_BER_RSAENCRYPTION;
extern char *BER_RSA_OBJECTID;
extern int LEN_BER_RSA;
extern char *IDAT_AUTHORITYREVOCATIONLIST_OBJECTID;
extern int LEN_IDAT_AUTHORITYREVOCATIONLIST;
extern char *IDAT_CACERTIFICATE_OBJECTID;
extern int LEN_IDAT_CACERTIFICATE;
extern char *IDAT_CERTIFICATEREVOCATIONLIST_OBJECTID;
extern int LEN_IDAT_CERTIFICATEREVOCATIONLIST;
extern char *IDAT_CROSSCERTIFICATEPAIR_OBJECTID;
extern int LEN_IDAT_CROSSCERTIFICATEPAIR;
extern char *IDAT_USERCERTIFICATE_OBJECTID;
extern int LEN_IDAT_USERCERTIFICATE;
extern char *IDAT_USERPASSWORD_OBJECTID;
extern int LEN_IDAT_USERPASSWORD;
extern char *PEM_DATA_OBJECTID;
extern int LEN_PEM_DATA;
extern char *PEM_SIGNEDDATA_OBJECTID;
extern int LEN_PEM_SIGNEDDATA;
*/

#pragma varargck type "N" OidObj *

OidHier *oid_initdb (OidHier *h);
int oid_fmtdn (Fmt *f);		// %N - distinguished name
OidHier *oid_append (OidHier *h, BerObj *oid, char *name, char *descr, ...);
void oid_hdump (OidHier *h);

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.