File: x509v3ext.h

package info (click to toggle)
xca 2.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,328 kB
  • sloc: cpp: 30,584; sh: 341; xml: 74; makefile: 56; python: 34
file content (82 lines) | stat: -rw-r--r-- 2,675 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* vi: set sw=4 ts=4:
 *
 * Copyright (C) 2001 - 2010 Christian Hohnstaedt.
 *
 * All rights reserved.
 */

#ifndef __X509V3EXT_H
#define __X509V3EXT_H

#include <QList>
#include <QStringList>
#include <QRegularExpression>
#include <openssl/x509.h>
#include <openssl/x509v3.h>

class QString;

class x509v3ext
{
   private:
	X509_EXTENSION *ext{};
	const ASN1_OBJECT *object() const;
   public:
	x509v3ext();
	x509v3ext(const X509_EXTENSION *n);
	x509v3ext(const x509v3ext &n);
	x509v3ext(int nid, const QString &et, X509V3_CTX *ctx);
	~x509v3ext();
	x509v3ext &set(const X509_EXTENSION *n);
	x509v3ext &create(int nid, const QString &et, X509V3_CTX *ctx = NULL);
	x509v3ext &create_ia5(int nid, const QString &et,
				X509V3_CTX *ctx = NULL);
	x509v3ext &operator = (const x509v3ext &x);
	// bool operator == (const x509v3ext &x) const;
	QString getObject() const;
	int getCritical() const;
	ASN1_OCTET_STRING *getData() const;
	QString getValue() const;
	QString getHtmlValue() const;
	QString getConsoleValue(const QString &indent) const;
	QString getHtml() const;
	QString getConsole(const QString &indent) const;
	X509_EXTENSION *get() const;
	bool isValid() const;
	int nid() const;
	void *d2i() const;
	bool genConf(QString *single, QString *adv) const;
	bool parse_generic(QString *single, QString *adv) const;
    protected:
	QString parse_critical() const;
	bool parse_certpol(QString *single, QString *adv) const;
	bool parse_ainfo(QString *single, QString *adv) const;
	bool parse_Crldp(QString *single, QString *adv) const;
	bool parse_eku(QString *single, QString *adv) const;
	bool parse_generalName(QString *single, QString *adv) const;
	bool parse_ia5(QString *single, QString *adv) const;
	bool parse_bc(QString *single, QString *adv) const;
	bool parse_bitstring(QString *single, QString *adv) const;
	bool parse_sKeyId(QString *single, QString *adv) const;
	bool parse_aKeyId(QString *single, QString *adv) const;
	bool parse_inhibitAnyPolicy(QString *, QString *adv) const;
	bool parse_policyConstraints(QString *, QString *adv) const;
	bool parse_policyMappings(QString *, QString *adv) const;
	bool parse_nameConstraints(QString *, QString *adv) const;
};

class extList : public QList<x509v3ext>
{
    public:
	void setStack(const STACK_OF(X509_EXTENSION) *st, int start=0);
	STACK_OF(X509_EXTENSION) *getStack() const;
	QString getHtml(const QString &sep) const;
	QString getConsole(const QString &indent) const;
	bool delByNid(int nid);
	int delInvalid();
	int idxByNid(int nid) const;
	bool genConf(int nid, QString *single, QString *adv = NULL);
	void genGenericConf(QString *adv);
	bool search(const QRegularExpression &pattern) const;
};
#endif