]> git.ipfire.org Git - thirdparty/openssl.git/blob - include/openssl/x509_acert.h.in
Fix typo in CONTRIBUTING.md
[thirdparty/openssl.git] / include / openssl / x509_acert.h.in
1 /*
2 * {- join("\n * ", @autowarntext) -}
3 *
4 * Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.
5 *
6 * Licensed under the Apache License 2.0 (the "License"). You may not use
7 * this file except in compliance with the License. You can obtain a copy
8 * in the file LICENSE in the source distribution or at
9 * https://www.openssl.org/source/license.html
10 */
11
12 {-
13 use OpenSSL::stackhash qw(generate_stack_macros);
14 -}
15
16 #ifndef OPENSSL_X509_ACERT_H
17 # define OPENSSL_X509_ACERT_H
18 # pragma once
19
20 # include <openssl/x509v3.h>
21 # include <openssl/x509.h>
22 # include <openssl/pem.h>
23
24 typedef struct X509_acert_st X509_ACERT;
25 typedef struct X509_acert_info_st X509_ACERT_INFO;
26 typedef struct ossl_object_digest_info_st OSSL_OBJECT_DIGEST_INFO;
27 typedef struct ossl_issuer_serial_st OSSL_ISSUER_SERIAL;
28 typedef struct X509_acert_issuer_v2form_st X509_ACERT_ISSUER_V2FORM;
29
30 DECLARE_ASN1_FUNCTIONS(X509_ACERT)
31 DECLARE_ASN1_DUP_FUNCTION(X509_ACERT)
32 DECLARE_ASN1_ITEM(X509_ACERT_INFO)
33 DECLARE_ASN1_ALLOC_FUNCTIONS(X509_ACERT_INFO)
34 DECLARE_ASN1_ALLOC_FUNCTIONS(OSSL_OBJECT_DIGEST_INFO)
35 DECLARE_ASN1_ALLOC_FUNCTIONS(OSSL_ISSUER_SERIAL)
36 DECLARE_ASN1_ALLOC_FUNCTIONS(X509_ACERT_ISSUER_V2FORM)
37
38 # ifndef OPENSSL_NO_STDIO
39 X509_ACERT *d2i_X509_ACERT_fp(FILE *fp, X509_ACERT **acert);
40 int i2d_X509_ACERT_fp(FILE *fp, const X509_ACERT *acert);
41 # endif
42
43 DECLARE_PEM_rw(X509_ACERT, X509_ACERT)
44
45 X509_ACERT *d2i_X509_ACERT_bio(BIO *bp, X509_ACERT **acert);
46 int i2d_X509_ACERT_bio(BIO *bp, const X509_ACERT *acert);
47
48 int X509_ACERT_sign(X509_ACERT *x, EVP_PKEY *pkey, const EVP_MD *md);
49 int X509_ACERT_sign_ctx(X509_ACERT *x, EVP_MD_CTX *ctx);
50 int X509_ACERT_verify(X509_ACERT *a, EVP_PKEY *r);
51
52 # define X509_ACERT_VERSION_2 1
53
54 const GENERAL_NAMES *X509_ACERT_get0_holder_entityName(const X509_ACERT *x);
55 const OSSL_ISSUER_SERIAL *X509_ACERT_get0_holder_baseCertId(const X509_ACERT *x);
56 const OSSL_OBJECT_DIGEST_INFO * X509_ACERT_get0_holder_digest(const X509_ACERT *x);
57 const X509_NAME *X509_ACERT_get0_issuerName(const X509_ACERT *x);
58 long X509_ACERT_get_version(const X509_ACERT *x);
59 void X509_ACERT_get0_signature(const X509_ACERT *x,
60 const ASN1_BIT_STRING **psig,
61 const X509_ALGOR **palg);
62 int X509_ACERT_get_signature_nid(const X509_ACERT *x);
63 const X509_ALGOR *X509_ACERT_get0_info_sigalg(const X509_ACERT *x);
64 const ASN1_INTEGER *X509_ACERT_get0_serialNumber(const X509_ACERT *x);
65 const ASN1_TIME *X509_ACERT_get0_notBefore(const X509_ACERT *x);
66 const ASN1_TIME *X509_ACERT_get0_notAfter(const X509_ACERT *x);
67 const ASN1_BIT_STRING *X509_ACERT_get0_issuerUID(const X509_ACERT *x);
68
69 int X509_ACERT_print(BIO *bp, X509_ACERT *x);
70 int X509_ACERT_print_ex(BIO *bp, X509_ACERT *x, unsigned long nmflags,
71 unsigned long cflag);
72
73 int X509_ACERT_get_attr_count(const X509_ACERT *x);
74 int X509_ACERT_get_attr_by_NID(const X509_ACERT *x, int nid, int lastpos);
75 int X509_ACERT_get_attr_by_OBJ(const X509_ACERT *x, const ASN1_OBJECT *obj,
76 int lastpos);
77 X509_ATTRIBUTE *X509_ACERT_get_attr(const X509_ACERT *x, int loc);
78 X509_ATTRIBUTE *X509_ACERT_delete_attr(X509_ACERT *x, int loc);
79
80 void *X509_ACERT_get_ext_d2i(const X509_ACERT *x, int nid, int *crit, int *idx);
81 int X509_ACERT_add1_ext_i2d(X509_ACERT *x, int nid, void *value, int crit,
82 unsigned long flags);
83 const STACK_OF(X509_EXTENSION) *X509_ACERT_get0_extensions(const X509_ACERT *x);
84
85 # define OSSL_OBJECT_DIGEST_INFO_PUBLIC_KEY 0
86 # define OSSL_OBJECT_DIGEST_INFO_PUBLIC_KEY_CERT 1
87 # define OSSL_OBJECT_DIGEST_INFO_OTHER 2 /* must not be used in RFC 5755 profile */
88 int X509_ACERT_set_version(X509_ACERT *x, long version);
89 void X509_ACERT_set0_holder_entityName(X509_ACERT *x, GENERAL_NAMES *name);
90 void X509_ACERT_set0_holder_baseCertId(X509_ACERT *x, OSSL_ISSUER_SERIAL *isss);
91 void X509_ACERT_set0_holder_digest(X509_ACERT *x,
92 OSSL_OBJECT_DIGEST_INFO *dinfo);
93
94 int X509_ACERT_add1_attr(X509_ACERT *x, X509_ATTRIBUTE *attr);
95 int X509_ACERT_add1_attr_by_OBJ(X509_ACERT *x, const ASN1_OBJECT *obj,
96 int type, const void *bytes, int len);
97 int X509_ACERT_add1_attr_by_NID(X509_ACERT *x, int nid, int type,
98 const void *bytes, int len);
99 int X509_ACERT_add1_attr_by_txt(X509_ACERT *x, const char *attrname, int type,
100 const unsigned char *bytes, int len);
101 int X509_ACERT_add_attr_nconf(CONF *conf, const char *section,
102 X509_ACERT *acert);
103
104 int X509_ACERT_set1_issuerName(X509_ACERT *x, const X509_NAME *name);
105 int X509_ACERT_set1_serialNumber(X509_ACERT *x, const ASN1_INTEGER *serial);
106 int X509_ACERT_set1_notBefore(X509_ACERT *x, const ASN1_GENERALIZEDTIME *time);
107 int X509_ACERT_set1_notAfter(X509_ACERT *x, const ASN1_GENERALIZEDTIME *time);
108
109 void OSSL_OBJECT_DIGEST_INFO_get0_digest(const OSSL_OBJECT_DIGEST_INFO *o,
110 int *digestedObjectType,
111 const X509_ALGOR **digestAlgorithm,
112 const ASN1_BIT_STRING **digest);
113
114 int OSSL_OBJECT_DIGEST_INFO_set1_digest(OSSL_OBJECT_DIGEST_INFO *o,
115 int digestedObjectType,
116 X509_ALGOR *digestAlgorithm,
117 ASN1_BIT_STRING *digest);
118
119 const X509_NAME *OSSL_ISSUER_SERIAL_get0_issuer(const OSSL_ISSUER_SERIAL *isss);
120 const ASN1_INTEGER *OSSL_ISSUER_SERIAL_get0_serial(const OSSL_ISSUER_SERIAL *isss);
121 const ASN1_BIT_STRING *OSSL_ISSUER_SERIAL_get0_issuerUID(const OSSL_ISSUER_SERIAL *isss);
122
123 int OSSL_ISSUER_SERIAL_set1_issuer(OSSL_ISSUER_SERIAL *isss,
124 const X509_NAME *issuer);
125 int OSSL_ISSUER_SERIAL_set1_serial(OSSL_ISSUER_SERIAL *isss,
126 const ASN1_INTEGER *serial);
127 int OSSL_ISSUER_SERIAL_set1_issuerUID(OSSL_ISSUER_SERIAL *isss,
128 const ASN1_BIT_STRING *uid);
129
130 # define OSSL_IETFAS_OCTETS 0
131 # define OSSL_IETFAS_OID 1
132 # define OSSL_IETFAS_STRING 2
133
134 typedef struct OSSL_IETF_ATTR_SYNTAX_VALUE_st OSSL_IETF_ATTR_SYNTAX_VALUE;
135 typedef struct OSSL_IETF_ATTR_SYNTAX_st OSSL_IETF_ATTR_SYNTAX;
136 {-
137 generate_stack_macros("OSSL_IETF_ATTR_SYNTAX_VALUE");
138 -}
139
140 DECLARE_ASN1_ITEM(OSSL_IETF_ATTR_SYNTAX_VALUE)
141 DECLARE_ASN1_ALLOC_FUNCTIONS(OSSL_IETF_ATTR_SYNTAX_VALUE)
142 DECLARE_ASN1_FUNCTIONS(OSSL_IETF_ATTR_SYNTAX)
143
144 const GENERAL_NAMES *
145 OSSL_IETF_ATTR_SYNTAX_get0_policyAuthority(const OSSL_IETF_ATTR_SYNTAX *a);
146 void OSSL_IETF_ATTR_SYNTAX_set0_policyAuthority(OSSL_IETF_ATTR_SYNTAX *a,
147 GENERAL_NAMES *names);
148
149 int OSSL_IETF_ATTR_SYNTAX_get_value_num(const OSSL_IETF_ATTR_SYNTAX *a);
150 void *OSSL_IETF_ATTR_SYNTAX_get0_value(const OSSL_IETF_ATTR_SYNTAX *a,
151 int ind, int *type);
152 int OSSL_IETF_ATTR_SYNTAX_add1_value(OSSL_IETF_ATTR_SYNTAX *a, int type,
153 void *data);
154 int OSSL_IETF_ATTR_SYNTAX_print(BIO *bp, OSSL_IETF_ATTR_SYNTAX *a, int indent);
155
156 #endif