]> git.ipfire.org Git - thirdparty/openssl.git/blame - include/openssl/x509_acert.h.in
x509_acert: Add and retrieve certificate extensions
[thirdparty/openssl.git] / include / openssl / x509_acert.h.in
CommitLineData
7dcee34c
DHG
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{-
13use 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
24typedef struct X509_acert_st X509_ACERT;
25typedef struct X509_acert_info_st X509_ACERT_INFO;
26typedef struct ossl_object_digest_info_st OSSL_OBJECT_DIGEST_INFO;
27typedef struct ossl_issuer_serial_st OSSL_ISSUER_SERIAL;
28typedef struct X509_acert_issuer_v2form_st X509_ACERT_ISSUER_V2FORM;
29
30DECLARE_ASN1_FUNCTIONS(X509_ACERT)
31DECLARE_ASN1_DUP_FUNCTION(X509_ACERT)
32DECLARE_ASN1_ITEM(X509_ACERT_INFO)
33DECLARE_ASN1_ALLOC_FUNCTIONS(X509_ACERT_INFO)
34DECLARE_ASN1_ALLOC_FUNCTIONS(OSSL_OBJECT_DIGEST_INFO)
35DECLARE_ASN1_ALLOC_FUNCTIONS(OSSL_ISSUER_SERIAL)
36DECLARE_ASN1_ALLOC_FUNCTIONS(X509_ACERT_ISSUER_V2FORM)
37
38# ifndef OPENSSL_NO_STDIO
39X509_ACERT *d2i_X509_ACERT_fp(FILE *fp, X509_ACERT **acert);
40int i2d_X509_ACERT_fp(FILE *fp, const X509_ACERT *acert);
41# endif
42
43DECLARE_PEM_rw(X509_ACERT, X509_ACERT)
44
45X509_ACERT *d2i_X509_ACERT_bio(BIO *bp, X509_ACERT **acert);
46int i2d_X509_ACERT_bio(BIO *bp, const X509_ACERT *acert);
47
b97fb22f
DHG
48int X509_ACERT_sign(X509_ACERT *x, EVP_PKEY *pkey, const EVP_MD *md);
49int X509_ACERT_sign_ctx(X509_ACERT *x, EVP_MD_CTX *ctx);
50int X509_ACERT_verify(X509_ACERT *a, EVP_PKEY *r);
51
9e1a8b5e
DHG
52# define X509_ACERT_VERSION_2 1
53
54const GENERAL_NAMES *X509_ACERT_get0_holder_entityName(const X509_ACERT *x);
55const OSSL_ISSUER_SERIAL *X509_ACERT_get0_holder_baseCertId(const X509_ACERT *x);
56const OSSL_OBJECT_DIGEST_INFO * X509_ACERT_get0_holder_digest(const X509_ACERT *x);
57const X509_NAME *X509_ACERT_get0_issuerName(const X509_ACERT *x);
58long X509_ACERT_get_version(const X509_ACERT *x);
59void X509_ACERT_get0_signature(const X509_ACERT *x,
60 const ASN1_BIT_STRING **psig,
61 const X509_ALGOR **palg);
62int X509_ACERT_get_signature_nid(const X509_ACERT *x);
63const X509_ALGOR *X509_ACERT_get0_info_sigalg(const X509_ACERT *x);
64const ASN1_INTEGER *X509_ACERT_get0_serialNumber(const X509_ACERT *x);
65const ASN1_TIME *X509_ACERT_get0_notBefore(const X509_ACERT *x);
66const ASN1_TIME *X509_ACERT_get0_notAfter(const X509_ACERT *x);
67const ASN1_BIT_STRING *X509_ACERT_get0_issuerUID(const X509_ACERT *x);
68
6b167313
DHG
69int X509_ACERT_print(BIO *bp, X509_ACERT *x);
70int X509_ACERT_print_ex(BIO *bp, X509_ACERT *x, unsigned long nmflags,
71 unsigned long cflag);
72
62960b87
DHG
73int X509_ACERT_get_attr_count(const X509_ACERT *x);
74int X509_ACERT_get_attr_by_NID(const X509_ACERT *x, int nid, int lastpos);
75int X509_ACERT_get_attr_by_OBJ(const X509_ACERT *x, const ASN1_OBJECT *obj,
76 int lastpos);
77X509_ATTRIBUTE *X509_ACERT_get_attr(const X509_ACERT *x, int loc);
78X509_ATTRIBUTE *X509_ACERT_delete_attr(X509_ACERT *x, int loc);
79
1eeec94f
DHG
80void *X509_ACERT_get_ext_d2i(const X509_ACERT *x, int nid, int *crit, int *idx);
81int X509_ACERT_add1_ext_i2d(X509_ACERT *x, int nid, void *value, int crit,
82 unsigned long flags);
83const STACK_OF(X509_EXTENSION) *X509_ACERT_get0_extensions(const X509_ACERT *x);
84
9e1a8b5e
DHG
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 */
88int X509_ACERT_set_version(X509_ACERT *x, long version);
89void X509_ACERT_set0_holder_entityName(X509_ACERT *x, GENERAL_NAMES *name);
90void X509_ACERT_set0_holder_baseCertId(X509_ACERT *x, OSSL_ISSUER_SERIAL *isss);
91void X509_ACERT_set0_holder_digest(X509_ACERT *x,
92 OSSL_OBJECT_DIGEST_INFO *dinfo);
93
62960b87
DHG
94int X509_ACERT_add1_attr(X509_ACERT *x, X509_ATTRIBUTE *attr);
95int X509_ACERT_add1_attr_by_OBJ(X509_ACERT *x, const ASN1_OBJECT *obj,
96 int type, const void *bytes, int len);
97int X509_ACERT_add1_attr_by_NID(X509_ACERT *x, int nid, int type,
98 const void *bytes, int len);
99int X509_ACERT_add1_attr_by_txt(X509_ACERT *x, const char *attrname, int type,
100 const unsigned char *bytes, int len);
101
9e1a8b5e
DHG
102int X509_ACERT_set1_issuerName(X509_ACERT *x, const X509_NAME *name);
103int X509_ACERT_set1_serialNumber(X509_ACERT *x, const ASN1_INTEGER *serial);
104int X509_ACERT_set1_notBefore(X509_ACERT *x, const ASN1_GENERALIZEDTIME *time);
105int X509_ACERT_set1_notAfter(X509_ACERT *x, const ASN1_GENERALIZEDTIME *time);
106
107void OSSL_OBJECT_DIGEST_INFO_get0_digest(const OSSL_OBJECT_DIGEST_INFO *o,
108 int *digestedObjectType,
109 const X509_ALGOR **digestAlgorithm,
110 const ASN1_BIT_STRING **digest);
111
112int OSSL_OBJECT_DIGEST_INFO_set1_digest(OSSL_OBJECT_DIGEST_INFO *o,
113 int digestedObjectType,
114 X509_ALGOR *digestAlgorithm,
115 ASN1_BIT_STRING *digest);
116
117const X509_NAME *OSSL_ISSUER_SERIAL_get0_issuer(const OSSL_ISSUER_SERIAL *isss);
118const ASN1_INTEGER *OSSL_ISSUER_SERIAL_get0_serial(const OSSL_ISSUER_SERIAL *isss);
119const ASN1_BIT_STRING *OSSL_ISSUER_SERIAL_get0_issuerUID(const OSSL_ISSUER_SERIAL *isss);
120
121int OSSL_ISSUER_SERIAL_set1_issuer(OSSL_ISSUER_SERIAL *isss,
122 const X509_NAME *issuer);
123int OSSL_ISSUER_SERIAL_set1_serial(OSSL_ISSUER_SERIAL *isss,
124 const ASN1_INTEGER *serial);
125int OSSL_ISSUER_SERIAL_set1_issuerUID(OSSL_ISSUER_SERIAL *isss,
126 const ASN1_BIT_STRING *uid);
7dcee34c 127#endif