VirtualBox

source: vbox/trunk/src/libs/openssl-3.1.0/gen-includes/openssl/x509.h@ 99371

Last change on this file since 99371 was 99371, checked in by vboxsync, 20 months ago

openssl-3.1.0: After generating headers and asm (kmk recreate-headers recreate-headers)

File size: 69.9 KB
Line 
1/*
2 * WARNING: do not edit!
3 * Generated by Makefile from x509.h.in
4 *
5 * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
6 * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
7 *
8 * Licensed under the Apache License 2.0 (the "License"). You may not use
9 * this file except in compliance with the License. You can obtain a copy
10 * in the file LICENSE in the source distribution or at
11 * https://www.openssl.org/source/license.html
12 */
13
14
15
16#ifndef OPENSSL_X509_H
17# define OPENSSL_X509_H
18# pragma once
19
20# include <openssl/macros.h>
21# ifndef OPENSSL_NO_DEPRECATED_3_0
22# define HEADER_X509_H
23# endif
24
25# include <openssl/e_os2.h>
26# include <openssl/types.h>
27# include <openssl/symhacks.h>
28# include <openssl/buffer.h>
29# include <openssl/evp.h>
30# include <openssl/bio.h>
31# include <openssl/asn1.h>
32# include <openssl/safestack.h>
33# include <openssl/ec.h>
34
35# ifndef OPENSSL_NO_DEPRECATED_1_1_0
36# include <openssl/rsa.h>
37# include <openssl/dsa.h>
38# include <openssl/dh.h>
39# endif
40
41# include <openssl/sha.h>
42# include <openssl/x509err.h>
43# ifndef OPENSSL_NO_STDIO
44# include <stdio.h>
45# endif
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
51/* Needed stacks for types defined in other headers */
52SKM_DEFINE_STACK_OF_INTERNAL(X509_NAME, X509_NAME, X509_NAME)
53#define sk_X509_NAME_num(sk) OPENSSL_sk_num(ossl_check_const_X509_NAME_sk_type(sk))
54#define sk_X509_NAME_value(sk, idx) ((X509_NAME *)OPENSSL_sk_value(ossl_check_const_X509_NAME_sk_type(sk), (idx)))
55#define sk_X509_NAME_new(cmp) ((STACK_OF(X509_NAME) *)OPENSSL_sk_new(ossl_check_X509_NAME_compfunc_type(cmp)))
56#define sk_X509_NAME_new_null() ((STACK_OF(X509_NAME) *)OPENSSL_sk_new_null())
57#define sk_X509_NAME_new_reserve(cmp, n) ((STACK_OF(X509_NAME) *)OPENSSL_sk_new_reserve(ossl_check_X509_NAME_compfunc_type(cmp), (n)))
58#define sk_X509_NAME_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_NAME_sk_type(sk), (n))
59#define sk_X509_NAME_free(sk) OPENSSL_sk_free(ossl_check_X509_NAME_sk_type(sk))
60#define sk_X509_NAME_zero(sk) OPENSSL_sk_zero(ossl_check_X509_NAME_sk_type(sk))
61#define sk_X509_NAME_delete(sk, i) ((X509_NAME *)OPENSSL_sk_delete(ossl_check_X509_NAME_sk_type(sk), (i)))
62#define sk_X509_NAME_delete_ptr(sk, ptr) ((X509_NAME *)OPENSSL_sk_delete_ptr(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr)))
63#define sk_X509_NAME_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr))
64#define sk_X509_NAME_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr))
65#define sk_X509_NAME_pop(sk) ((X509_NAME *)OPENSSL_sk_pop(ossl_check_X509_NAME_sk_type(sk)))
66#define sk_X509_NAME_shift(sk) ((X509_NAME *)OPENSSL_sk_shift(ossl_check_X509_NAME_sk_type(sk)))
67#define sk_X509_NAME_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_NAME_sk_type(sk),ossl_check_X509_NAME_freefunc_type(freefunc))
68#define sk_X509_NAME_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr), (idx))
69#define sk_X509_NAME_set(sk, idx, ptr) ((X509_NAME *)OPENSSL_sk_set(ossl_check_X509_NAME_sk_type(sk), (idx), ossl_check_X509_NAME_type(ptr)))
70#define sk_X509_NAME_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr))
71#define sk_X509_NAME_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr))
72#define sk_X509_NAME_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr), pnum)
73#define sk_X509_NAME_sort(sk) OPENSSL_sk_sort(ossl_check_X509_NAME_sk_type(sk))
74#define sk_X509_NAME_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_NAME_sk_type(sk))
75#define sk_X509_NAME_dup(sk) ((STACK_OF(X509_NAME) *)OPENSSL_sk_dup(ossl_check_const_X509_NAME_sk_type(sk)))
76#define sk_X509_NAME_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_NAME) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_NAME_sk_type(sk), ossl_check_X509_NAME_copyfunc_type(copyfunc), ossl_check_X509_NAME_freefunc_type(freefunc)))
77#define sk_X509_NAME_set_cmp_func(sk, cmp) ((sk_X509_NAME_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_compfunc_type(cmp)))
78SKM_DEFINE_STACK_OF_INTERNAL(X509, X509, X509)
79#define sk_X509_num(sk) OPENSSL_sk_num(ossl_check_const_X509_sk_type(sk))
80#define sk_X509_value(sk, idx) ((X509 *)OPENSSL_sk_value(ossl_check_const_X509_sk_type(sk), (idx)))
81#define sk_X509_new(cmp) ((STACK_OF(X509) *)OPENSSL_sk_new(ossl_check_X509_compfunc_type(cmp)))
82#define sk_X509_new_null() ((STACK_OF(X509) *)OPENSSL_sk_new_null())
83#define sk_X509_new_reserve(cmp, n) ((STACK_OF(X509) *)OPENSSL_sk_new_reserve(ossl_check_X509_compfunc_type(cmp), (n)))
84#define sk_X509_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_sk_type(sk), (n))
85#define sk_X509_free(sk) OPENSSL_sk_free(ossl_check_X509_sk_type(sk))
86#define sk_X509_zero(sk) OPENSSL_sk_zero(ossl_check_X509_sk_type(sk))
87#define sk_X509_delete(sk, i) ((X509 *)OPENSSL_sk_delete(ossl_check_X509_sk_type(sk), (i)))
88#define sk_X509_delete_ptr(sk, ptr) ((X509 *)OPENSSL_sk_delete_ptr(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr)))
89#define sk_X509_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr))
90#define sk_X509_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr))
91#define sk_X509_pop(sk) ((X509 *)OPENSSL_sk_pop(ossl_check_X509_sk_type(sk)))
92#define sk_X509_shift(sk) ((X509 *)OPENSSL_sk_shift(ossl_check_X509_sk_type(sk)))
93#define sk_X509_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_sk_type(sk),ossl_check_X509_freefunc_type(freefunc))
94#define sk_X509_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr), (idx))
95#define sk_X509_set(sk, idx, ptr) ((X509 *)OPENSSL_sk_set(ossl_check_X509_sk_type(sk), (idx), ossl_check_X509_type(ptr)))
96#define sk_X509_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr))
97#define sk_X509_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr))
98#define sk_X509_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr), pnum)
99#define sk_X509_sort(sk) OPENSSL_sk_sort(ossl_check_X509_sk_type(sk))
100#define sk_X509_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_sk_type(sk))
101#define sk_X509_dup(sk) ((STACK_OF(X509) *)OPENSSL_sk_dup(ossl_check_const_X509_sk_type(sk)))
102#define sk_X509_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_sk_type(sk), ossl_check_X509_copyfunc_type(copyfunc), ossl_check_X509_freefunc_type(freefunc)))
103#define sk_X509_set_cmp_func(sk, cmp) ((sk_X509_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_sk_type(sk), ossl_check_X509_compfunc_type(cmp)))
104SKM_DEFINE_STACK_OF_INTERNAL(X509_REVOKED, X509_REVOKED, X509_REVOKED)
105#define sk_X509_REVOKED_num(sk) OPENSSL_sk_num(ossl_check_const_X509_REVOKED_sk_type(sk))
106#define sk_X509_REVOKED_value(sk, idx) ((X509_REVOKED *)OPENSSL_sk_value(ossl_check_const_X509_REVOKED_sk_type(sk), (idx)))
107#define sk_X509_REVOKED_new(cmp) ((STACK_OF(X509_REVOKED) *)OPENSSL_sk_new(ossl_check_X509_REVOKED_compfunc_type(cmp)))
108#define sk_X509_REVOKED_new_null() ((STACK_OF(X509_REVOKED) *)OPENSSL_sk_new_null())
109#define sk_X509_REVOKED_new_reserve(cmp, n) ((STACK_OF(X509_REVOKED) *)OPENSSL_sk_new_reserve(ossl_check_X509_REVOKED_compfunc_type(cmp), (n)))
110#define sk_X509_REVOKED_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_REVOKED_sk_type(sk), (n))
111#define sk_X509_REVOKED_free(sk) OPENSSL_sk_free(ossl_check_X509_REVOKED_sk_type(sk))
112#define sk_X509_REVOKED_zero(sk) OPENSSL_sk_zero(ossl_check_X509_REVOKED_sk_type(sk))
113#define sk_X509_REVOKED_delete(sk, i) ((X509_REVOKED *)OPENSSL_sk_delete(ossl_check_X509_REVOKED_sk_type(sk), (i)))
114#define sk_X509_REVOKED_delete_ptr(sk, ptr) ((X509_REVOKED *)OPENSSL_sk_delete_ptr(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr)))
115#define sk_X509_REVOKED_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr))
116#define sk_X509_REVOKED_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr))
117#define sk_X509_REVOKED_pop(sk) ((X509_REVOKED *)OPENSSL_sk_pop(ossl_check_X509_REVOKED_sk_type(sk)))
118#define sk_X509_REVOKED_shift(sk) ((X509_REVOKED *)OPENSSL_sk_shift(ossl_check_X509_REVOKED_sk_type(sk)))
119#define sk_X509_REVOKED_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_REVOKED_sk_type(sk),ossl_check_X509_REVOKED_freefunc_type(freefunc))
120#define sk_X509_REVOKED_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr), (idx))
121#define sk_X509_REVOKED_set(sk, idx, ptr) ((X509_REVOKED *)OPENSSL_sk_set(ossl_check_X509_REVOKED_sk_type(sk), (idx), ossl_check_X509_REVOKED_type(ptr)))
122#define sk_X509_REVOKED_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr))
123#define sk_X509_REVOKED_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr))
124#define sk_X509_REVOKED_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr), pnum)
125#define sk_X509_REVOKED_sort(sk) OPENSSL_sk_sort(ossl_check_X509_REVOKED_sk_type(sk))
126#define sk_X509_REVOKED_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_REVOKED_sk_type(sk))
127#define sk_X509_REVOKED_dup(sk) ((STACK_OF(X509_REVOKED) *)OPENSSL_sk_dup(ossl_check_const_X509_REVOKED_sk_type(sk)))
128#define sk_X509_REVOKED_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_REVOKED) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_copyfunc_type(copyfunc), ossl_check_X509_REVOKED_freefunc_type(freefunc)))
129#define sk_X509_REVOKED_set_cmp_func(sk, cmp) ((sk_X509_REVOKED_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_compfunc_type(cmp)))
130SKM_DEFINE_STACK_OF_INTERNAL(X509_CRL, X509_CRL, X509_CRL)
131#define sk_X509_CRL_num(sk) OPENSSL_sk_num(ossl_check_const_X509_CRL_sk_type(sk))
132#define sk_X509_CRL_value(sk, idx) ((X509_CRL *)OPENSSL_sk_value(ossl_check_const_X509_CRL_sk_type(sk), (idx)))
133#define sk_X509_CRL_new(cmp) ((STACK_OF(X509_CRL) *)OPENSSL_sk_new(ossl_check_X509_CRL_compfunc_type(cmp)))
134#define sk_X509_CRL_new_null() ((STACK_OF(X509_CRL) *)OPENSSL_sk_new_null())
135#define sk_X509_CRL_new_reserve(cmp, n) ((STACK_OF(X509_CRL) *)OPENSSL_sk_new_reserve(ossl_check_X509_CRL_compfunc_type(cmp), (n)))
136#define sk_X509_CRL_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_CRL_sk_type(sk), (n))
137#define sk_X509_CRL_free(sk) OPENSSL_sk_free(ossl_check_X509_CRL_sk_type(sk))
138#define sk_X509_CRL_zero(sk) OPENSSL_sk_zero(ossl_check_X509_CRL_sk_type(sk))
139#define sk_X509_CRL_delete(sk, i) ((X509_CRL *)OPENSSL_sk_delete(ossl_check_X509_CRL_sk_type(sk), (i)))
140#define sk_X509_CRL_delete_ptr(sk, ptr) ((X509_CRL *)OPENSSL_sk_delete_ptr(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr)))
141#define sk_X509_CRL_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr))
142#define sk_X509_CRL_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr))
143#define sk_X509_CRL_pop(sk) ((X509_CRL *)OPENSSL_sk_pop(ossl_check_X509_CRL_sk_type(sk)))
144#define sk_X509_CRL_shift(sk) ((X509_CRL *)OPENSSL_sk_shift(ossl_check_X509_CRL_sk_type(sk)))
145#define sk_X509_CRL_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_CRL_sk_type(sk),ossl_check_X509_CRL_freefunc_type(freefunc))
146#define sk_X509_CRL_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr), (idx))
147#define sk_X509_CRL_set(sk, idx, ptr) ((X509_CRL *)OPENSSL_sk_set(ossl_check_X509_CRL_sk_type(sk), (idx), ossl_check_X509_CRL_type(ptr)))
148#define sk_X509_CRL_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr))
149#define sk_X509_CRL_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr))
150#define sk_X509_CRL_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr), pnum)
151#define sk_X509_CRL_sort(sk) OPENSSL_sk_sort(ossl_check_X509_CRL_sk_type(sk))
152#define sk_X509_CRL_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_CRL_sk_type(sk))
153#define sk_X509_CRL_dup(sk) ((STACK_OF(X509_CRL) *)OPENSSL_sk_dup(ossl_check_const_X509_CRL_sk_type(sk)))
154#define sk_X509_CRL_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_CRL) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_CRL_sk_type(sk), ossl_check_X509_CRL_copyfunc_type(copyfunc), ossl_check_X509_CRL_freefunc_type(freefunc)))
155#define sk_X509_CRL_set_cmp_func(sk, cmp) ((sk_X509_CRL_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_compfunc_type(cmp)))
156
157
158/* Flags for X509_get_signature_info() */
159/* Signature info is valid */
160# define X509_SIG_INFO_VALID 0x1
161/* Signature is suitable for TLS use */
162# define X509_SIG_INFO_TLS 0x2
163
164# define X509_FILETYPE_PEM 1
165# define X509_FILETYPE_ASN1 2
166# define X509_FILETYPE_DEFAULT 3
167
168# define X509v3_KU_DIGITAL_SIGNATURE 0x0080
169# define X509v3_KU_NON_REPUDIATION 0x0040
170# define X509v3_KU_KEY_ENCIPHERMENT 0x0020
171# define X509v3_KU_DATA_ENCIPHERMENT 0x0010
172# define X509v3_KU_KEY_AGREEMENT 0x0008
173# define X509v3_KU_KEY_CERT_SIGN 0x0004
174# define X509v3_KU_CRL_SIGN 0x0002
175# define X509v3_KU_ENCIPHER_ONLY 0x0001
176# define X509v3_KU_DECIPHER_ONLY 0x8000
177# define X509v3_KU_UNDEF 0xffff
178
179struct X509_algor_st {
180 ASN1_OBJECT *algorithm;
181 ASN1_TYPE *parameter;
182} /* X509_ALGOR */ ;
183
184typedef STACK_OF(X509_ALGOR) X509_ALGORS;
185
186typedef struct X509_val_st {
187 ASN1_TIME *notBefore;
188 ASN1_TIME *notAfter;
189} X509_VAL;
190
191typedef struct X509_sig_st X509_SIG;
192
193typedef struct X509_name_entry_st X509_NAME_ENTRY;
194
195SKM_DEFINE_STACK_OF_INTERNAL(X509_NAME_ENTRY, X509_NAME_ENTRY, X509_NAME_ENTRY)
196#define sk_X509_NAME_ENTRY_num(sk) OPENSSL_sk_num(ossl_check_const_X509_NAME_ENTRY_sk_type(sk))
197#define sk_X509_NAME_ENTRY_value(sk, idx) ((X509_NAME_ENTRY *)OPENSSL_sk_value(ossl_check_const_X509_NAME_ENTRY_sk_type(sk), (idx)))
198#define sk_X509_NAME_ENTRY_new(cmp) ((STACK_OF(X509_NAME_ENTRY) *)OPENSSL_sk_new(ossl_check_X509_NAME_ENTRY_compfunc_type(cmp)))
199#define sk_X509_NAME_ENTRY_new_null() ((STACK_OF(X509_NAME_ENTRY) *)OPENSSL_sk_new_null())
200#define sk_X509_NAME_ENTRY_new_reserve(cmp, n) ((STACK_OF(X509_NAME_ENTRY) *)OPENSSL_sk_new_reserve(ossl_check_X509_NAME_ENTRY_compfunc_type(cmp), (n)))
201#define sk_X509_NAME_ENTRY_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_NAME_ENTRY_sk_type(sk), (n))
202#define sk_X509_NAME_ENTRY_free(sk) OPENSSL_sk_free(ossl_check_X509_NAME_ENTRY_sk_type(sk))
203#define sk_X509_NAME_ENTRY_zero(sk) OPENSSL_sk_zero(ossl_check_X509_NAME_ENTRY_sk_type(sk))
204#define sk_X509_NAME_ENTRY_delete(sk, i) ((X509_NAME_ENTRY *)OPENSSL_sk_delete(ossl_check_X509_NAME_ENTRY_sk_type(sk), (i)))
205#define sk_X509_NAME_ENTRY_delete_ptr(sk, ptr) ((X509_NAME_ENTRY *)OPENSSL_sk_delete_ptr(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr)))
206#define sk_X509_NAME_ENTRY_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr))
207#define sk_X509_NAME_ENTRY_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr))
208#define sk_X509_NAME_ENTRY_pop(sk) ((X509_NAME_ENTRY *)OPENSSL_sk_pop(ossl_check_X509_NAME_ENTRY_sk_type(sk)))
209#define sk_X509_NAME_ENTRY_shift(sk) ((X509_NAME_ENTRY *)OPENSSL_sk_shift(ossl_check_X509_NAME_ENTRY_sk_type(sk)))
210#define sk_X509_NAME_ENTRY_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_NAME_ENTRY_sk_type(sk),ossl_check_X509_NAME_ENTRY_freefunc_type(freefunc))
211#define sk_X509_NAME_ENTRY_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr), (idx))
212#define sk_X509_NAME_ENTRY_set(sk, idx, ptr) ((X509_NAME_ENTRY *)OPENSSL_sk_set(ossl_check_X509_NAME_ENTRY_sk_type(sk), (idx), ossl_check_X509_NAME_ENTRY_type(ptr)))
213#define sk_X509_NAME_ENTRY_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr))
214#define sk_X509_NAME_ENTRY_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr))
215#define sk_X509_NAME_ENTRY_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr), pnum)
216#define sk_X509_NAME_ENTRY_sort(sk) OPENSSL_sk_sort(ossl_check_X509_NAME_ENTRY_sk_type(sk))
217#define sk_X509_NAME_ENTRY_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_NAME_ENTRY_sk_type(sk))
218#define sk_X509_NAME_ENTRY_dup(sk) ((STACK_OF(X509_NAME_ENTRY) *)OPENSSL_sk_dup(ossl_check_const_X509_NAME_ENTRY_sk_type(sk)))
219#define sk_X509_NAME_ENTRY_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_NAME_ENTRY) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_copyfunc_type(copyfunc), ossl_check_X509_NAME_ENTRY_freefunc_type(freefunc)))
220#define sk_X509_NAME_ENTRY_set_cmp_func(sk, cmp) ((sk_X509_NAME_ENTRY_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_compfunc_type(cmp)))
221
222
223# define X509_EX_V_NETSCAPE_HACK 0x8000
224# define X509_EX_V_INIT 0x0001
225typedef struct X509_extension_st X509_EXTENSION;
226SKM_DEFINE_STACK_OF_INTERNAL(X509_EXTENSION, X509_EXTENSION, X509_EXTENSION)
227#define sk_X509_EXTENSION_num(sk) OPENSSL_sk_num(ossl_check_const_X509_EXTENSION_sk_type(sk))
228#define sk_X509_EXTENSION_value(sk, idx) ((X509_EXTENSION *)OPENSSL_sk_value(ossl_check_const_X509_EXTENSION_sk_type(sk), (idx)))
229#define sk_X509_EXTENSION_new(cmp) ((STACK_OF(X509_EXTENSION) *)OPENSSL_sk_new(ossl_check_X509_EXTENSION_compfunc_type(cmp)))
230#define sk_X509_EXTENSION_new_null() ((STACK_OF(X509_EXTENSION) *)OPENSSL_sk_new_null())
231#define sk_X509_EXTENSION_new_reserve(cmp, n) ((STACK_OF(X509_EXTENSION) *)OPENSSL_sk_new_reserve(ossl_check_X509_EXTENSION_compfunc_type(cmp), (n)))
232#define sk_X509_EXTENSION_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_EXTENSION_sk_type(sk), (n))
233#define sk_X509_EXTENSION_free(sk) OPENSSL_sk_free(ossl_check_X509_EXTENSION_sk_type(sk))
234#define sk_X509_EXTENSION_zero(sk) OPENSSL_sk_zero(ossl_check_X509_EXTENSION_sk_type(sk))
235#define sk_X509_EXTENSION_delete(sk, i) ((X509_EXTENSION *)OPENSSL_sk_delete(ossl_check_X509_EXTENSION_sk_type(sk), (i)))
236#define sk_X509_EXTENSION_delete_ptr(sk, ptr) ((X509_EXTENSION *)OPENSSL_sk_delete_ptr(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr)))
237#define sk_X509_EXTENSION_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr))
238#define sk_X509_EXTENSION_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr))
239#define sk_X509_EXTENSION_pop(sk) ((X509_EXTENSION *)OPENSSL_sk_pop(ossl_check_X509_EXTENSION_sk_type(sk)))
240#define sk_X509_EXTENSION_shift(sk) ((X509_EXTENSION *)OPENSSL_sk_shift(ossl_check_X509_EXTENSION_sk_type(sk)))
241#define sk_X509_EXTENSION_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_EXTENSION_sk_type(sk),ossl_check_X509_EXTENSION_freefunc_type(freefunc))
242#define sk_X509_EXTENSION_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr), (idx))
243#define sk_X509_EXTENSION_set(sk, idx, ptr) ((X509_EXTENSION *)OPENSSL_sk_set(ossl_check_X509_EXTENSION_sk_type(sk), (idx), ossl_check_X509_EXTENSION_type(ptr)))
244#define sk_X509_EXTENSION_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr))
245#define sk_X509_EXTENSION_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr))
246#define sk_X509_EXTENSION_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr), pnum)
247#define sk_X509_EXTENSION_sort(sk) OPENSSL_sk_sort(ossl_check_X509_EXTENSION_sk_type(sk))
248#define sk_X509_EXTENSION_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_EXTENSION_sk_type(sk))
249#define sk_X509_EXTENSION_dup(sk) ((STACK_OF(X509_EXTENSION) *)OPENSSL_sk_dup(ossl_check_const_X509_EXTENSION_sk_type(sk)))
250#define sk_X509_EXTENSION_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_EXTENSION) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_copyfunc_type(copyfunc), ossl_check_X509_EXTENSION_freefunc_type(freefunc)))
251#define sk_X509_EXTENSION_set_cmp_func(sk, cmp) ((sk_X509_EXTENSION_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_compfunc_type(cmp)))
252
253typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS;
254typedef struct x509_attributes_st X509_ATTRIBUTE;
255SKM_DEFINE_STACK_OF_INTERNAL(X509_ATTRIBUTE, X509_ATTRIBUTE, X509_ATTRIBUTE)
256#define sk_X509_ATTRIBUTE_num(sk) OPENSSL_sk_num(ossl_check_const_X509_ATTRIBUTE_sk_type(sk))
257#define sk_X509_ATTRIBUTE_value(sk, idx) ((X509_ATTRIBUTE *)OPENSSL_sk_value(ossl_check_const_X509_ATTRIBUTE_sk_type(sk), (idx)))
258#define sk_X509_ATTRIBUTE_new(cmp) ((STACK_OF(X509_ATTRIBUTE) *)OPENSSL_sk_new(ossl_check_X509_ATTRIBUTE_compfunc_type(cmp)))
259#define sk_X509_ATTRIBUTE_new_null() ((STACK_OF(X509_ATTRIBUTE) *)OPENSSL_sk_new_null())
260#define sk_X509_ATTRIBUTE_new_reserve(cmp, n) ((STACK_OF(X509_ATTRIBUTE) *)OPENSSL_sk_new_reserve(ossl_check_X509_ATTRIBUTE_compfunc_type(cmp), (n)))
261#define sk_X509_ATTRIBUTE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_ATTRIBUTE_sk_type(sk), (n))
262#define sk_X509_ATTRIBUTE_free(sk) OPENSSL_sk_free(ossl_check_X509_ATTRIBUTE_sk_type(sk))
263#define sk_X509_ATTRIBUTE_zero(sk) OPENSSL_sk_zero(ossl_check_X509_ATTRIBUTE_sk_type(sk))
264#define sk_X509_ATTRIBUTE_delete(sk, i) ((X509_ATTRIBUTE *)OPENSSL_sk_delete(ossl_check_X509_ATTRIBUTE_sk_type(sk), (i)))
265#define sk_X509_ATTRIBUTE_delete_ptr(sk, ptr) ((X509_ATTRIBUTE *)OPENSSL_sk_delete_ptr(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr)))
266#define sk_X509_ATTRIBUTE_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr))
267#define sk_X509_ATTRIBUTE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr))
268#define sk_X509_ATTRIBUTE_pop(sk) ((X509_ATTRIBUTE *)OPENSSL_sk_pop(ossl_check_X509_ATTRIBUTE_sk_type(sk)))
269#define sk_X509_ATTRIBUTE_shift(sk) ((X509_ATTRIBUTE *)OPENSSL_sk_shift(ossl_check_X509_ATTRIBUTE_sk_type(sk)))
270#define sk_X509_ATTRIBUTE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_ATTRIBUTE_sk_type(sk),ossl_check_X509_ATTRIBUTE_freefunc_type(freefunc))
271#define sk_X509_ATTRIBUTE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr), (idx))
272#define sk_X509_ATTRIBUTE_set(sk, idx, ptr) ((X509_ATTRIBUTE *)OPENSSL_sk_set(ossl_check_X509_ATTRIBUTE_sk_type(sk), (idx), ossl_check_X509_ATTRIBUTE_type(ptr)))
273#define sk_X509_ATTRIBUTE_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr))
274#define sk_X509_ATTRIBUTE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr))
275#define sk_X509_ATTRIBUTE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr), pnum)
276#define sk_X509_ATTRIBUTE_sort(sk) OPENSSL_sk_sort(ossl_check_X509_ATTRIBUTE_sk_type(sk))
277#define sk_X509_ATTRIBUTE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_ATTRIBUTE_sk_type(sk))
278#define sk_X509_ATTRIBUTE_dup(sk) ((STACK_OF(X509_ATTRIBUTE) *)OPENSSL_sk_dup(ossl_check_const_X509_ATTRIBUTE_sk_type(sk)))
279#define sk_X509_ATTRIBUTE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_ATTRIBUTE) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_copyfunc_type(copyfunc), ossl_check_X509_ATTRIBUTE_freefunc_type(freefunc)))
280#define sk_X509_ATTRIBUTE_set_cmp_func(sk, cmp) ((sk_X509_ATTRIBUTE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_compfunc_type(cmp)))
281
282typedef struct X509_req_info_st X509_REQ_INFO;
283typedef struct X509_req_st X509_REQ;
284typedef struct x509_cert_aux_st X509_CERT_AUX;
285typedef struct x509_cinf_st X509_CINF;
286
287/* Flags for X509_print_ex() */
288
289# define X509_FLAG_COMPAT 0
290# define X509_FLAG_NO_HEADER 1L
291# define X509_FLAG_NO_VERSION (1L << 1)
292# define X509_FLAG_NO_SERIAL (1L << 2)
293# define X509_FLAG_NO_SIGNAME (1L << 3)
294# define X509_FLAG_NO_ISSUER (1L << 4)
295# define X509_FLAG_NO_VALIDITY (1L << 5)
296# define X509_FLAG_NO_SUBJECT (1L << 6)
297# define X509_FLAG_NO_PUBKEY (1L << 7)
298# define X509_FLAG_NO_EXTENSIONS (1L << 8)
299# define X509_FLAG_NO_SIGDUMP (1L << 9)
300# define X509_FLAG_NO_AUX (1L << 10)
301# define X509_FLAG_NO_ATTRIBUTES (1L << 11)
302# define X509_FLAG_NO_IDS (1L << 12)
303# define X509_FLAG_EXTENSIONS_ONLY_KID (1L << 13)
304
305/* Flags specific to X509_NAME_print_ex() */
306
307/* The field separator information */
308
309# define XN_FLAG_SEP_MASK (0xf << 16)
310
311# define XN_FLAG_COMPAT 0/* Traditional; use old X509_NAME_print */
312# define XN_FLAG_SEP_COMMA_PLUS (1 << 16)/* RFC2253 ,+ */
313# define XN_FLAG_SEP_CPLUS_SPC (2 << 16)/* ,+ spaced: more readable */
314# define XN_FLAG_SEP_SPLUS_SPC (3 << 16)/* ;+ spaced */
315# define XN_FLAG_SEP_MULTILINE (4 << 16)/* One line per field */
316
317# define XN_FLAG_DN_REV (1 << 20)/* Reverse DN order */
318
319/* How the field name is shown */
320
321# define XN_FLAG_FN_MASK (0x3 << 21)
322
323# define XN_FLAG_FN_SN 0/* Object short name */
324# define XN_FLAG_FN_LN (1 << 21)/* Object long name */
325# define XN_FLAG_FN_OID (2 << 21)/* Always use OIDs */
326# define XN_FLAG_FN_NONE (3 << 21)/* No field names */
327
328# define XN_FLAG_SPC_EQ (1 << 23)/* Put spaces round '=' */
329
330/*
331 * This determines if we dump fields we don't recognise: RFC2253 requires
332 * this.
333 */
334
335# define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24)
336
337# define XN_FLAG_FN_ALIGN (1 << 25)/* Align field names to 20
338 * characters */
339
340/* Complete set of RFC2253 flags */
341
342# define XN_FLAG_RFC2253 (ASN1_STRFLGS_RFC2253 | \
343 XN_FLAG_SEP_COMMA_PLUS | \
344 XN_FLAG_DN_REV | \
345 XN_FLAG_FN_SN | \
346 XN_FLAG_DUMP_UNKNOWN_FIELDS)
347
348/* readable oneline form */
349
350# define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | \
351 ASN1_STRFLGS_ESC_QUOTE | \
352 XN_FLAG_SEP_CPLUS_SPC | \
353 XN_FLAG_SPC_EQ | \
354 XN_FLAG_FN_SN)
355
356/* readable multiline form */
357
358# define XN_FLAG_MULTILINE (ASN1_STRFLGS_ESC_CTRL | \
359 ASN1_STRFLGS_ESC_MSB | \
360 XN_FLAG_SEP_MULTILINE | \
361 XN_FLAG_SPC_EQ | \
362 XN_FLAG_FN_LN | \
363 XN_FLAG_FN_ALIGN)
364
365typedef struct X509_crl_info_st X509_CRL_INFO;
366
367typedef struct private_key_st {
368 int version;
369 /* The PKCS#8 data types */
370 X509_ALGOR *enc_algor;
371 ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */
372 /* When decrypted, the following will not be NULL */
373 EVP_PKEY *dec_pkey;
374 /* used to encrypt and decrypt */
375 int key_length;
376 char *key_data;
377 int key_free; /* true if we should auto free key_data */
378 /* expanded version of 'enc_algor' */
379 EVP_CIPHER_INFO cipher;
380} X509_PKEY;
381
382typedef struct X509_info_st {
383 X509 *x509;
384 X509_CRL *crl;
385 X509_PKEY *x_pkey;
386 EVP_CIPHER_INFO enc_cipher;
387 int enc_len;
388 char *enc_data;
389} X509_INFO;
390SKM_DEFINE_STACK_OF_INTERNAL(X509_INFO, X509_INFO, X509_INFO)
391#define sk_X509_INFO_num(sk) OPENSSL_sk_num(ossl_check_const_X509_INFO_sk_type(sk))
392#define sk_X509_INFO_value(sk, idx) ((X509_INFO *)OPENSSL_sk_value(ossl_check_const_X509_INFO_sk_type(sk), (idx)))
393#define sk_X509_INFO_new(cmp) ((STACK_OF(X509_INFO) *)OPENSSL_sk_new(ossl_check_X509_INFO_compfunc_type(cmp)))
394#define sk_X509_INFO_new_null() ((STACK_OF(X509_INFO) *)OPENSSL_sk_new_null())
395#define sk_X509_INFO_new_reserve(cmp, n) ((STACK_OF(X509_INFO) *)OPENSSL_sk_new_reserve(ossl_check_X509_INFO_compfunc_type(cmp), (n)))
396#define sk_X509_INFO_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_INFO_sk_type(sk), (n))
397#define sk_X509_INFO_free(sk) OPENSSL_sk_free(ossl_check_X509_INFO_sk_type(sk))
398#define sk_X509_INFO_zero(sk) OPENSSL_sk_zero(ossl_check_X509_INFO_sk_type(sk))
399#define sk_X509_INFO_delete(sk, i) ((X509_INFO *)OPENSSL_sk_delete(ossl_check_X509_INFO_sk_type(sk), (i)))
400#define sk_X509_INFO_delete_ptr(sk, ptr) ((X509_INFO *)OPENSSL_sk_delete_ptr(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr)))
401#define sk_X509_INFO_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr))
402#define sk_X509_INFO_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr))
403#define sk_X509_INFO_pop(sk) ((X509_INFO *)OPENSSL_sk_pop(ossl_check_X509_INFO_sk_type(sk)))
404#define sk_X509_INFO_shift(sk) ((X509_INFO *)OPENSSL_sk_shift(ossl_check_X509_INFO_sk_type(sk)))
405#define sk_X509_INFO_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_INFO_sk_type(sk),ossl_check_X509_INFO_freefunc_type(freefunc))
406#define sk_X509_INFO_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr), (idx))
407#define sk_X509_INFO_set(sk, idx, ptr) ((X509_INFO *)OPENSSL_sk_set(ossl_check_X509_INFO_sk_type(sk), (idx), ossl_check_X509_INFO_type(ptr)))
408#define sk_X509_INFO_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr))
409#define sk_X509_INFO_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr))
410#define sk_X509_INFO_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr), pnum)
411#define sk_X509_INFO_sort(sk) OPENSSL_sk_sort(ossl_check_X509_INFO_sk_type(sk))
412#define sk_X509_INFO_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_INFO_sk_type(sk))
413#define sk_X509_INFO_dup(sk) ((STACK_OF(X509_INFO) *)OPENSSL_sk_dup(ossl_check_const_X509_INFO_sk_type(sk)))
414#define sk_X509_INFO_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_INFO) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_INFO_sk_type(sk), ossl_check_X509_INFO_copyfunc_type(copyfunc), ossl_check_X509_INFO_freefunc_type(freefunc)))
415#define sk_X509_INFO_set_cmp_func(sk, cmp) ((sk_X509_INFO_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_compfunc_type(cmp)))
416
417
418/*
419 * The next 2 structures and their 8 routines are used to manipulate Netscape's
420 * spki structures - useful if you are writing a CA web page
421 */
422typedef struct Netscape_spkac_st {
423 X509_PUBKEY *pubkey;
424 ASN1_IA5STRING *challenge; /* challenge sent in atlas >= PR2 */
425} NETSCAPE_SPKAC;
426
427typedef struct Netscape_spki_st {
428 NETSCAPE_SPKAC *spkac; /* signed public key and challenge */
429 X509_ALGOR sig_algor;
430 ASN1_BIT_STRING *signature;
431} NETSCAPE_SPKI;
432
433/* Netscape certificate sequence structure */
434typedef struct Netscape_certificate_sequence {
435 ASN1_OBJECT *type;
436 STACK_OF(X509) *certs;
437} NETSCAPE_CERT_SEQUENCE;
438
439/*- Unused (and iv length is wrong)
440typedef struct CBCParameter_st
441 {
442 unsigned char iv[8];
443 } CBC_PARAM;
444*/
445
446/* Password based encryption structure */
447
448typedef struct PBEPARAM_st {
449 ASN1_OCTET_STRING *salt;
450 ASN1_INTEGER *iter;
451} PBEPARAM;
452
453/* Password based encryption V2 structures */
454
455typedef struct PBE2PARAM_st {
456 X509_ALGOR *keyfunc;
457 X509_ALGOR *encryption;
458} PBE2PARAM;
459
460typedef struct PBKDF2PARAM_st {
461/* Usually OCTET STRING but could be anything */
462 ASN1_TYPE *salt;
463 ASN1_INTEGER *iter;
464 ASN1_INTEGER *keylength;
465 X509_ALGOR *prf;
466} PBKDF2PARAM;
467
468#ifndef OPENSSL_NO_SCRYPT
469typedef struct SCRYPT_PARAMS_st {
470 ASN1_OCTET_STRING *salt;
471 ASN1_INTEGER *costParameter;
472 ASN1_INTEGER *blockSize;
473 ASN1_INTEGER *parallelizationParameter;
474 ASN1_INTEGER *keyLength;
475} SCRYPT_PARAMS;
476#endif
477
478#ifdef __cplusplus
479}
480#endif
481
482# include <openssl/x509_vfy.h>
483# include <openssl/pkcs7.h>
484
485#ifdef __cplusplus
486extern "C" {
487#endif
488
489# define X509_EXT_PACK_UNKNOWN 1
490# define X509_EXT_PACK_STRING 2
491
492# define X509_extract_key(x) X509_get_pubkey(x)/*****/
493# define X509_REQ_extract_key(a) X509_REQ_get_pubkey(a)
494# define X509_name_cmp(a,b) X509_NAME_cmp((a),(b))
495
496void X509_CRL_set_default_method(const X509_CRL_METHOD *meth);
497X509_CRL_METHOD *X509_CRL_METHOD_new(int (*crl_init) (X509_CRL *crl),
498 int (*crl_free) (X509_CRL *crl),
499 int (*crl_lookup) (X509_CRL *crl,
500 X509_REVOKED **ret,
501 const
502 ASN1_INTEGER *serial,
503 const
504 X509_NAME *issuer),
505 int (*crl_verify) (X509_CRL *crl,
506 EVP_PKEY *pk));
507void X509_CRL_METHOD_free(X509_CRL_METHOD *m);
508
509void X509_CRL_set_meth_data(X509_CRL *crl, void *dat);
510void *X509_CRL_get_meth_data(X509_CRL *crl);
511
512const char *X509_verify_cert_error_string(long n);
513
514int X509_verify(X509 *a, EVP_PKEY *r);
515int X509_self_signed(X509 *cert, int verify_signature);
516
517int X509_REQ_verify_ex(X509_REQ *a, EVP_PKEY *r, OSSL_LIB_CTX *libctx,
518 const char *propq);
519int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r);
520int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r);
521int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r);
522
523NETSCAPE_SPKI *NETSCAPE_SPKI_b64_decode(const char *str, int len);
524char *NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x);
525EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x);
526int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey);
527
528int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki);
529
530int X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent);
531int X509_signature_print(BIO *bp, const X509_ALGOR *alg,
532 const ASN1_STRING *sig);
533
534int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
535int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx);
536int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md);
537int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx);
538int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md);
539int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx);
540int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md);
541
542int X509_pubkey_digest(const X509 *data, const EVP_MD *type,
543 unsigned char *md, unsigned int *len);
544int X509_digest(const X509 *data, const EVP_MD *type,
545 unsigned char *md, unsigned int *len);
546ASN1_OCTET_STRING *X509_digest_sig(const X509 *cert,
547 EVP_MD **md_used, int *md_is_fallback);
548int X509_CRL_digest(const X509_CRL *data, const EVP_MD *type,
549 unsigned char *md, unsigned int *len);
550int X509_REQ_digest(const X509_REQ *data, const EVP_MD *type,
551 unsigned char *md, unsigned int *len);
552int X509_NAME_digest(const X509_NAME *data, const EVP_MD *type,
553 unsigned char *md, unsigned int *len);
554
555X509 *X509_load_http(const char *url, BIO *bio, BIO *rbio, int timeout);
556X509_CRL *X509_CRL_load_http(const char *url, BIO *bio, BIO *rbio, int timeout);
557# ifndef OPENSSL_NO_DEPRECATED_3_0
558# include <openssl/http.h> /* OSSL_HTTP_REQ_CTX_nbio_d2i */
559# define X509_http_nbio(rctx, pcert) \
560 OSSL_HTTP_REQ_CTX_nbio_d2i(rctx, pcert, ASN1_ITEM_rptr(X509))
561# define X509_CRL_http_nbio(rctx, pcrl) \
562 OSSL_HTTP_REQ_CTX_nbio_d2i(rctx, pcrl, ASN1_ITEM_rptr(X509_CRL))
563# endif
564
565# ifndef OPENSSL_NO_STDIO
566X509 *d2i_X509_fp(FILE *fp, X509 **x509);
567int i2d_X509_fp(FILE *fp, const X509 *x509);
568X509_CRL *d2i_X509_CRL_fp(FILE *fp, X509_CRL **crl);
569int i2d_X509_CRL_fp(FILE *fp, const X509_CRL *crl);
570X509_REQ *d2i_X509_REQ_fp(FILE *fp, X509_REQ **req);
571int i2d_X509_REQ_fp(FILE *fp, const X509_REQ *req);
572# ifndef OPENSSL_NO_DEPRECATED_3_0
573OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSAPrivateKey_fp(FILE *fp, RSA **rsa);
574OSSL_DEPRECATEDIN_3_0 int i2d_RSAPrivateKey_fp(FILE *fp, const RSA *rsa);
575OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSAPublicKey_fp(FILE *fp, RSA **rsa);
576OSSL_DEPRECATEDIN_3_0 int i2d_RSAPublicKey_fp(FILE *fp, const RSA *rsa);
577OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSA_PUBKEY_fp(FILE *fp, RSA **rsa);
578OSSL_DEPRECATEDIN_3_0 int i2d_RSA_PUBKEY_fp(FILE *fp, const RSA *rsa);
579# endif
580# ifndef OPENSSL_NO_DEPRECATED_3_0
581# ifndef OPENSSL_NO_DSA
582OSSL_DEPRECATEDIN_3_0 DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa);
583OSSL_DEPRECATEDIN_3_0 int i2d_DSA_PUBKEY_fp(FILE *fp, const DSA *dsa);
584OSSL_DEPRECATEDIN_3_0 DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa);
585OSSL_DEPRECATEDIN_3_0 int i2d_DSAPrivateKey_fp(FILE *fp, const DSA *dsa);
586# endif
587# endif
588# ifndef OPENSSL_NO_DEPRECATED_3_0
589# ifndef OPENSSL_NO_EC
590OSSL_DEPRECATEDIN_3_0 EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey);
591OSSL_DEPRECATEDIN_3_0 int i2d_EC_PUBKEY_fp(FILE *fp, const EC_KEY *eckey);
592OSSL_DEPRECATEDIN_3_0 EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey);
593OSSL_DEPRECATEDIN_3_0 int i2d_ECPrivateKey_fp(FILE *fp, const EC_KEY *eckey);
594# endif /* OPENSSL_NO_EC */
595# endif /* OPENSSL_NO_DEPRECATED_3_0 */
596X509_SIG *d2i_PKCS8_fp(FILE *fp, X509_SIG **p8);
597int i2d_PKCS8_fp(FILE *fp, const X509_SIG *p8);
598X509_PUBKEY *d2i_X509_PUBKEY_fp(FILE *fp, X509_PUBKEY **xpk);
599int i2d_X509_PUBKEY_fp(FILE *fp, const X509_PUBKEY *xpk);
600PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,
601 PKCS8_PRIV_KEY_INFO **p8inf);
602int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, const PKCS8_PRIV_KEY_INFO *p8inf);
603int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, const EVP_PKEY *key);
604int i2d_PrivateKey_fp(FILE *fp, const EVP_PKEY *pkey);
605EVP_PKEY *d2i_PrivateKey_ex_fp(FILE *fp, EVP_PKEY **a, OSSL_LIB_CTX *libctx,
606 const char *propq);
607EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a);
608int i2d_PUBKEY_fp(FILE *fp, const EVP_PKEY *pkey);
609EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a);
610# endif
611
612X509 *d2i_X509_bio(BIO *bp, X509 **x509);
613int i2d_X509_bio(BIO *bp, const X509 *x509);
614X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **crl);
615int i2d_X509_CRL_bio(BIO *bp, const X509_CRL *crl);
616X509_REQ *d2i_X509_REQ_bio(BIO *bp, X509_REQ **req);
617int i2d_X509_REQ_bio(BIO *bp, const X509_REQ *req);
618# ifndef OPENSSL_NO_DEPRECATED_3_0
619OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSAPrivateKey_bio(BIO *bp, RSA **rsa);
620OSSL_DEPRECATEDIN_3_0 int i2d_RSAPrivateKey_bio(BIO *bp, const RSA *rsa);
621OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSAPublicKey_bio(BIO *bp, RSA **rsa);
622OSSL_DEPRECATEDIN_3_0 int i2d_RSAPublicKey_bio(BIO *bp, const RSA *rsa);
623OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSA_PUBKEY_bio(BIO *bp, RSA **rsa);
624OSSL_DEPRECATEDIN_3_0 int i2d_RSA_PUBKEY_bio(BIO *bp, const RSA *rsa);
625# endif
626# ifndef OPENSSL_NO_DEPRECATED_3_0
627# ifndef OPENSSL_NO_DSA
628OSSL_DEPRECATEDIN_3_0 DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa);
629OSSL_DEPRECATEDIN_3_0 int i2d_DSA_PUBKEY_bio(BIO *bp, const DSA *dsa);
630OSSL_DEPRECATEDIN_3_0 DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa);
631OSSL_DEPRECATEDIN_3_0 int i2d_DSAPrivateKey_bio(BIO *bp, const DSA *dsa);
632# endif
633# endif
634
635# ifndef OPENSSL_NO_DEPRECATED_3_0
636# ifndef OPENSSL_NO_EC
637OSSL_DEPRECATEDIN_3_0 EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey);
638OSSL_DEPRECATEDIN_3_0 int i2d_EC_PUBKEY_bio(BIO *bp, const EC_KEY *eckey);
639OSSL_DEPRECATEDIN_3_0 EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey);
640OSSL_DEPRECATEDIN_3_0 int i2d_ECPrivateKey_bio(BIO *bp, const EC_KEY *eckey);
641# endif /* OPENSSL_NO_EC */
642# endif /* OPENSSL_NO_DEPRECATED_3_0 */
643
644X509_SIG *d2i_PKCS8_bio(BIO *bp, X509_SIG **p8);
645int i2d_PKCS8_bio(BIO *bp, const X509_SIG *p8);
646X509_PUBKEY *d2i_X509_PUBKEY_bio(BIO *bp, X509_PUBKEY **xpk);
647int i2d_X509_PUBKEY_bio(BIO *bp, const X509_PUBKEY *xpk);
648PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,
649 PKCS8_PRIV_KEY_INFO **p8inf);
650int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, const PKCS8_PRIV_KEY_INFO *p8inf);
651int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, const EVP_PKEY *key);
652int i2d_PrivateKey_bio(BIO *bp, const EVP_PKEY *pkey);
653EVP_PKEY *d2i_PrivateKey_ex_bio(BIO *bp, EVP_PKEY **a, OSSL_LIB_CTX *libctx,
654 const char *propq);
655EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a);
656int i2d_PUBKEY_bio(BIO *bp, const EVP_PKEY *pkey);
657EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a);
658
659DECLARE_ASN1_DUP_FUNCTION(X509)
660DECLARE_ASN1_DUP_FUNCTION(X509_ALGOR)
661DECLARE_ASN1_DUP_FUNCTION(X509_ATTRIBUTE)
662DECLARE_ASN1_DUP_FUNCTION(X509_CRL)
663DECLARE_ASN1_DUP_FUNCTION(X509_EXTENSION)
664DECLARE_ASN1_DUP_FUNCTION(X509_PUBKEY)
665DECLARE_ASN1_DUP_FUNCTION(X509_REQ)
666DECLARE_ASN1_DUP_FUNCTION(X509_REVOKED)
667int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype,
668 void *pval);
669void X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype,
670 const void **ppval, const X509_ALGOR *algor);
671void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md);
672int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b);
673int X509_ALGOR_copy(X509_ALGOR *dest, const X509_ALGOR *src);
674
675DECLARE_ASN1_DUP_FUNCTION(X509_NAME)
676DECLARE_ASN1_DUP_FUNCTION(X509_NAME_ENTRY)
677
678int X509_cmp_time(const ASN1_TIME *s, time_t *t);
679int X509_cmp_current_time(const ASN1_TIME *s);
680int X509_cmp_timeframe(const X509_VERIFY_PARAM *vpm,
681 const ASN1_TIME *start, const ASN1_TIME *end);
682ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *t);
683ASN1_TIME *X509_time_adj_ex(ASN1_TIME *s,
684 int offset_day, long offset_sec, time_t *t);
685ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj);
686
687const char *X509_get_default_cert_area(void);
688const char *X509_get_default_cert_dir(void);
689const char *X509_get_default_cert_file(void);
690const char *X509_get_default_cert_dir_env(void);
691const char *X509_get_default_cert_file_env(void);
692const char *X509_get_default_private_dir(void);
693
694X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
695X509 *X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey);
696
697DECLARE_ASN1_FUNCTIONS(X509_ALGOR)
698DECLARE_ASN1_ENCODE_FUNCTIONS(X509_ALGORS, X509_ALGORS, X509_ALGORS)
699DECLARE_ASN1_FUNCTIONS(X509_VAL)
700
701DECLARE_ASN1_FUNCTIONS(X509_PUBKEY)
702
703X509_PUBKEY *X509_PUBKEY_new_ex(OSSL_LIB_CTX *libctx, const char *propq);
704int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey);
705EVP_PKEY *X509_PUBKEY_get0(const X509_PUBKEY *key);
706EVP_PKEY *X509_PUBKEY_get(const X509_PUBKEY *key);
707int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain);
708long X509_get_pathlen(X509 *x);
709DECLARE_ASN1_ENCODE_FUNCTIONS_only(EVP_PKEY, PUBKEY)
710EVP_PKEY *d2i_PUBKEY_ex(EVP_PKEY **a, const unsigned char **pp, long length,
711 OSSL_LIB_CTX *libctx, const char *propq);
712# ifndef OPENSSL_NO_DEPRECATED_3_0
713DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0,RSA, RSA_PUBKEY)
714# endif
715# ifndef OPENSSL_NO_DEPRECATED_3_0
716# ifndef OPENSSL_NO_DSA
717DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0,DSA, DSA_PUBKEY)
718# endif
719# endif
720# ifndef OPENSSL_NO_DEPRECATED_3_0
721# ifndef OPENSSL_NO_EC
722DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0, EC_KEY, EC_PUBKEY)
723# endif
724# endif
725
726DECLARE_ASN1_FUNCTIONS(X509_SIG)
727void X509_SIG_get0(const X509_SIG *sig, const X509_ALGOR **palg,
728 const ASN1_OCTET_STRING **pdigest);
729void X509_SIG_getm(X509_SIG *sig, X509_ALGOR **palg,
730 ASN1_OCTET_STRING **pdigest);
731
732DECLARE_ASN1_FUNCTIONS(X509_REQ_INFO)
733DECLARE_ASN1_FUNCTIONS(X509_REQ)
734X509_REQ *X509_REQ_new_ex(OSSL_LIB_CTX *libctx, const char *propq);
735
736DECLARE_ASN1_FUNCTIONS(X509_ATTRIBUTE)
737X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value);
738
739DECLARE_ASN1_FUNCTIONS(X509_EXTENSION)
740DECLARE_ASN1_ENCODE_FUNCTIONS(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS)
741
742DECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY)
743
744DECLARE_ASN1_FUNCTIONS(X509_NAME)
745
746int X509_NAME_set(X509_NAME **xn, const X509_NAME *name);
747
748DECLARE_ASN1_FUNCTIONS(X509_CINF)
749DECLARE_ASN1_FUNCTIONS(X509)
750X509 *X509_new_ex(OSSL_LIB_CTX *libctx, const char *propq);
751DECLARE_ASN1_FUNCTIONS(X509_CERT_AUX)
752
753#define X509_get_ex_new_index(l, p, newf, dupf, freef) \
754 CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509, l, p, newf, dupf, freef)
755int X509_set_ex_data(X509 *r, int idx, void *arg);
756void *X509_get_ex_data(const X509 *r, int idx);
757DECLARE_ASN1_ENCODE_FUNCTIONS_only(X509,X509_AUX)
758
759int i2d_re_X509_tbs(X509 *x, unsigned char **pp);
760
761int X509_SIG_INFO_get(const X509_SIG_INFO *siginf, int *mdnid, int *pknid,
762 int *secbits, uint32_t *flags);
763void X509_SIG_INFO_set(X509_SIG_INFO *siginf, int mdnid, int pknid,
764 int secbits, uint32_t flags);
765
766int X509_get_signature_info(X509 *x, int *mdnid, int *pknid, int *secbits,
767 uint32_t *flags);
768
769void X509_get0_signature(const ASN1_BIT_STRING **psig,
770 const X509_ALGOR **palg, const X509 *x);
771int X509_get_signature_nid(const X509 *x);
772
773void X509_set0_distinguishing_id(X509 *x, ASN1_OCTET_STRING *d_id);
774ASN1_OCTET_STRING *X509_get0_distinguishing_id(X509 *x);
775void X509_REQ_set0_distinguishing_id(X509_REQ *x, ASN1_OCTET_STRING *d_id);
776ASN1_OCTET_STRING *X509_REQ_get0_distinguishing_id(X509_REQ *x);
777
778int X509_alias_set1(X509 *x, const unsigned char *name, int len);
779int X509_keyid_set1(X509 *x, const unsigned char *id, int len);
780unsigned char *X509_alias_get0(X509 *x, int *len);
781unsigned char *X509_keyid_get0(X509 *x, int *len);
782
783DECLARE_ASN1_FUNCTIONS(X509_REVOKED)
784DECLARE_ASN1_FUNCTIONS(X509_CRL_INFO)
785DECLARE_ASN1_FUNCTIONS(X509_CRL)
786X509_CRL *X509_CRL_new_ex(OSSL_LIB_CTX *libctx, const char *propq);
787
788int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);
789int X509_CRL_get0_by_serial(X509_CRL *crl,
790 X509_REVOKED **ret, const ASN1_INTEGER *serial);
791int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x);
792
793X509_PKEY *X509_PKEY_new(void);
794void X509_PKEY_free(X509_PKEY *a);
795
796DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI)
797DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC)
798DECLARE_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE)
799
800X509_INFO *X509_INFO_new(void);
801void X509_INFO_free(X509_INFO *a);
802char *X509_NAME_oneline(const X509_NAME *a, char *buf, int size);
803
804#ifndef OPENSSL_NO_DEPRECATED_3_0
805OSSL_DEPRECATEDIN_3_0
806int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *algor1,
807 ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey);
808OSSL_DEPRECATEDIN_3_0
809int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data,
810 unsigned char *md, unsigned int *len);
811OSSL_DEPRECATEDIN_3_0
812int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1, X509_ALGOR *algor2,
813 ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey,
814 const EVP_MD *type);
815#endif
816int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *data,
817 unsigned char *md, unsigned int *len);
818int ASN1_item_verify(const ASN1_ITEM *it, const X509_ALGOR *alg,
819 const ASN1_BIT_STRING *signature, const void *data,
820 EVP_PKEY *pkey);
821int ASN1_item_verify_ctx(const ASN1_ITEM *it, const X509_ALGOR *alg,
822 const ASN1_BIT_STRING *signature, const void *data,
823 EVP_MD_CTX *ctx);
824int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
825 ASN1_BIT_STRING *signature, const void *data,
826 EVP_PKEY *pkey, const EVP_MD *md);
827int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1,
828 X509_ALGOR *algor2, ASN1_BIT_STRING *signature,
829 const void *data, EVP_MD_CTX *ctx);
830
831#define X509_VERSION_1 0
832#define X509_VERSION_2 1
833#define X509_VERSION_3 2
834
835long X509_get_version(const X509 *x);
836int X509_set_version(X509 *x, long version);
837int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial);
838ASN1_INTEGER *X509_get_serialNumber(X509 *x);
839const ASN1_INTEGER *X509_get0_serialNumber(const X509 *x);
840int X509_set_issuer_name(X509 *x, const X509_NAME *name);
841X509_NAME *X509_get_issuer_name(const X509 *a);
842int X509_set_subject_name(X509 *x, const X509_NAME *name);
843X509_NAME *X509_get_subject_name(const X509 *a);
844const ASN1_TIME * X509_get0_notBefore(const X509 *x);
845ASN1_TIME *X509_getm_notBefore(const X509 *x);
846int X509_set1_notBefore(X509 *x, const ASN1_TIME *tm);
847const ASN1_TIME *X509_get0_notAfter(const X509 *x);
848ASN1_TIME *X509_getm_notAfter(const X509 *x);
849int X509_set1_notAfter(X509 *x, const ASN1_TIME *tm);
850int X509_set_pubkey(X509 *x, EVP_PKEY *pkey);
851int X509_up_ref(X509 *x);
852int X509_get_signature_type(const X509 *x);
853
854# ifndef OPENSSL_NO_DEPRECATED_1_1_0
855# define X509_get_notBefore X509_getm_notBefore
856# define X509_get_notAfter X509_getm_notAfter
857# define X509_set_notBefore X509_set1_notBefore
858# define X509_set_notAfter X509_set1_notAfter
859#endif
860
861
862/*
863 * This one is only used so that a binary form can output, as in
864 * i2d_X509_PUBKEY(X509_get_X509_PUBKEY(x), &buf)
865 */
866X509_PUBKEY *X509_get_X509_PUBKEY(const X509 *x);
867const STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x);
868void X509_get0_uids(const X509 *x, const ASN1_BIT_STRING **piuid,
869 const ASN1_BIT_STRING **psuid);
870const X509_ALGOR *X509_get0_tbs_sigalg(const X509 *x);
871
872EVP_PKEY *X509_get0_pubkey(const X509 *x);
873EVP_PKEY *X509_get_pubkey(X509 *x);
874ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x);
875
876#define X509_REQ_VERSION_1 0
877
878long X509_REQ_get_version(const X509_REQ *req);
879int X509_REQ_set_version(X509_REQ *x, long version);
880X509_NAME *X509_REQ_get_subject_name(const X509_REQ *req);
881int X509_REQ_set_subject_name(X509_REQ *req, const X509_NAME *name);
882void X509_REQ_get0_signature(const X509_REQ *req, const ASN1_BIT_STRING **psig,
883 const X509_ALGOR **palg);
884void X509_REQ_set0_signature(X509_REQ *req, ASN1_BIT_STRING *psig);
885int X509_REQ_set1_signature_algo(X509_REQ *req, X509_ALGOR *palg);
886int X509_REQ_get_signature_nid(const X509_REQ *req);
887int i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp);
888int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey);
889EVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req);
890EVP_PKEY *X509_REQ_get0_pubkey(X509_REQ *req);
891X509_PUBKEY *X509_REQ_get_X509_PUBKEY(X509_REQ *req);
892int X509_REQ_extension_nid(int nid);
893int *X509_REQ_get_extension_nids(void);
894void X509_REQ_set_extension_nids(int *nids);
895STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req);
896int X509_REQ_add_extensions_nid(X509_REQ *req,
897 const STACK_OF(X509_EXTENSION) *exts, int nid);
898int X509_REQ_add_extensions(X509_REQ *req, const STACK_OF(X509_EXTENSION) *ext);
899int X509_REQ_get_attr_count(const X509_REQ *req);
900int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, int lastpos);
901int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, const ASN1_OBJECT *obj,
902 int lastpos);
903X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc);
904X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc);
905int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr);
906int X509_REQ_add1_attr_by_OBJ(X509_REQ *req,
907 const ASN1_OBJECT *obj, int type,
908 const unsigned char *bytes, int len);
909int X509_REQ_add1_attr_by_NID(X509_REQ *req,
910 int nid, int type,
911 const unsigned char *bytes, int len);
912int X509_REQ_add1_attr_by_txt(X509_REQ *req,
913 const char *attrname, int type,
914 const unsigned char *bytes, int len);
915
916#define X509_CRL_VERSION_1 0
917#define X509_CRL_VERSION_2 1
918
919int X509_CRL_set_version(X509_CRL *x, long version);
920int X509_CRL_set_issuer_name(X509_CRL *x, const X509_NAME *name);
921int X509_CRL_set1_lastUpdate(X509_CRL *x, const ASN1_TIME *tm);
922int X509_CRL_set1_nextUpdate(X509_CRL *x, const ASN1_TIME *tm);
923int X509_CRL_sort(X509_CRL *crl);
924int X509_CRL_up_ref(X509_CRL *crl);
925
926# ifndef OPENSSL_NO_DEPRECATED_1_1_0
927# define X509_CRL_set_lastUpdate X509_CRL_set1_lastUpdate
928# define X509_CRL_set_nextUpdate X509_CRL_set1_nextUpdate
929#endif
930
931long X509_CRL_get_version(const X509_CRL *crl);
932const ASN1_TIME *X509_CRL_get0_lastUpdate(const X509_CRL *crl);
933const ASN1_TIME *X509_CRL_get0_nextUpdate(const X509_CRL *crl);
934#ifndef OPENSSL_NO_DEPRECATED_1_1_0
935OSSL_DEPRECATEDIN_1_1_0 ASN1_TIME *X509_CRL_get_lastUpdate(X509_CRL *crl);
936OSSL_DEPRECATEDIN_1_1_0 ASN1_TIME *X509_CRL_get_nextUpdate(X509_CRL *crl);
937#endif
938X509_NAME *X509_CRL_get_issuer(const X509_CRL *crl);
939const STACK_OF(X509_EXTENSION) *X509_CRL_get0_extensions(const X509_CRL *crl);
940STACK_OF(X509_REVOKED) *X509_CRL_get_REVOKED(X509_CRL *crl);
941void X509_CRL_get0_signature(const X509_CRL *crl, const ASN1_BIT_STRING **psig,
942 const X509_ALGOR **palg);
943int X509_CRL_get_signature_nid(const X509_CRL *crl);
944int i2d_re_X509_CRL_tbs(X509_CRL *req, unsigned char **pp);
945
946const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *x);
947int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial);
948const ASN1_TIME *X509_REVOKED_get0_revocationDate(const X509_REVOKED *x);
949int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm);
950const STACK_OF(X509_EXTENSION) *
951X509_REVOKED_get0_extensions(const X509_REVOKED *r);
952
953X509_CRL *X509_CRL_diff(X509_CRL *base, X509_CRL *newer,
954 EVP_PKEY *skey, const EVP_MD *md, unsigned int flags);
955
956int X509_REQ_check_private_key(X509_REQ *x509, EVP_PKEY *pkey);
957
958int X509_check_private_key(const X509 *x509, const EVP_PKEY *pkey);
959int X509_chain_check_suiteb(int *perror_depth,
960 X509 *x, STACK_OF(X509) *chain,
961 unsigned long flags);
962int X509_CRL_check_suiteb(X509_CRL *crl, EVP_PKEY *pk, unsigned long flags);
963STACK_OF(X509) *X509_chain_up_ref(STACK_OF(X509) *chain);
964
965int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b);
966unsigned long X509_issuer_and_serial_hash(X509 *a);
967
968int X509_issuer_name_cmp(const X509 *a, const X509 *b);
969unsigned long X509_issuer_name_hash(X509 *a);
970
971int X509_subject_name_cmp(const X509 *a, const X509 *b);
972unsigned long X509_subject_name_hash(X509 *x);
973
974# ifndef OPENSSL_NO_MD5
975unsigned long X509_issuer_name_hash_old(X509 *a);
976unsigned long X509_subject_name_hash_old(X509 *x);
977# endif
978
979# define X509_ADD_FLAG_DEFAULT 0
980# define X509_ADD_FLAG_UP_REF 0x1
981# define X509_ADD_FLAG_PREPEND 0x2
982# define X509_ADD_FLAG_NO_DUP 0x4
983# define X509_ADD_FLAG_NO_SS 0x8
984int X509_add_cert(STACK_OF(X509) *sk, X509 *cert, int flags);
985int X509_add_certs(STACK_OF(X509) *sk, STACK_OF(X509) *certs, int flags);
986
987int X509_cmp(const X509 *a, const X509 *b);
988int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b);
989#ifndef OPENSSL_NO_DEPRECATED_3_0
990# define X509_NAME_hash(x) X509_NAME_hash_ex(x, NULL, NULL, NULL)
991OSSL_DEPRECATEDIN_3_0 int X509_certificate_type(const X509 *x,
992 const EVP_PKEY *pubkey);
993#endif
994unsigned long X509_NAME_hash_ex(const X509_NAME *x, OSSL_LIB_CTX *libctx,
995 const char *propq, int *ok);
996unsigned long X509_NAME_hash_old(const X509_NAME *x);
997
998int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b);
999int X509_CRL_match(const X509_CRL *a, const X509_CRL *b);
1000int X509_aux_print(BIO *out, X509 *x, int indent);
1001# ifndef OPENSSL_NO_STDIO
1002int X509_print_ex_fp(FILE *bp, X509 *x, unsigned long nmflag,
1003 unsigned long cflag);
1004int X509_print_fp(FILE *bp, X509 *x);
1005int X509_CRL_print_fp(FILE *bp, X509_CRL *x);
1006int X509_REQ_print_fp(FILE *bp, X509_REQ *req);
1007int X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm, int indent,
1008 unsigned long flags);
1009# endif
1010
1011int X509_NAME_print(BIO *bp, const X509_NAME *name, int obase);
1012int X509_NAME_print_ex(BIO *out, const X509_NAME *nm, int indent,
1013 unsigned long flags);
1014int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflag,
1015 unsigned long cflag);
1016int X509_print(BIO *bp, X509 *x);
1017int X509_ocspid_print(BIO *bp, X509 *x);
1018int X509_CRL_print_ex(BIO *out, X509_CRL *x, unsigned long nmflag);
1019int X509_CRL_print(BIO *bp, X509_CRL *x);
1020int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag,
1021 unsigned long cflag);
1022int X509_REQ_print(BIO *bp, X509_REQ *req);
1023
1024int X509_NAME_entry_count(const X509_NAME *name);
1025int X509_NAME_get_text_by_NID(const X509_NAME *name, int nid,
1026 char *buf, int len);
1027int X509_NAME_get_text_by_OBJ(const X509_NAME *name, const ASN1_OBJECT *obj,
1028 char *buf, int len);
1029
1030/*
1031 * NOTE: you should be passing -1, not 0 as lastpos. The functions that use
1032 * lastpos, search after that position on.
1033 */
1034int X509_NAME_get_index_by_NID(const X509_NAME *name, int nid, int lastpos);
1035int X509_NAME_get_index_by_OBJ(const X509_NAME *name, const ASN1_OBJECT *obj,
1036 int lastpos);
1037X509_NAME_ENTRY *X509_NAME_get_entry(const X509_NAME *name, int loc);
1038X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc);
1039int X509_NAME_add_entry(X509_NAME *name, const X509_NAME_ENTRY *ne,
1040 int loc, int set);
1041int X509_NAME_add_entry_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, int type,
1042 const unsigned char *bytes, int len, int loc,
1043 int set);
1044int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type,
1045 const unsigned char *bytes, int len, int loc,
1046 int set);
1047X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne,
1048 const char *field, int type,
1049 const unsigned char *bytes,
1050 int len);
1051X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid,
1052 int type,
1053 const unsigned char *bytes,
1054 int len);
1055int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type,
1056 const unsigned char *bytes, int len, int loc,
1057 int set);
1058X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne,
1059 const ASN1_OBJECT *obj, int type,
1060 const unsigned char *bytes,
1061 int len);
1062int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, const ASN1_OBJECT *obj);
1063int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type,
1064 const unsigned char *bytes, int len);
1065ASN1_OBJECT *X509_NAME_ENTRY_get_object(const X509_NAME_ENTRY *ne);
1066ASN1_STRING * X509_NAME_ENTRY_get_data(const X509_NAME_ENTRY *ne);
1067int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne);
1068
1069int X509_NAME_get0_der(const X509_NAME *nm, const unsigned char **pder,
1070 size_t *pderlen);
1071
1072int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x);
1073int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x,
1074 int nid, int lastpos);
1075int X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x,
1076 const ASN1_OBJECT *obj, int lastpos);
1077int X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x,
1078 int crit, int lastpos);
1079X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc);
1080X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc);
1081STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x,
1082 X509_EXTENSION *ex, int loc);
1083
1084int X509_get_ext_count(const X509 *x);
1085int X509_get_ext_by_NID(const X509 *x, int nid, int lastpos);
1086int X509_get_ext_by_OBJ(const X509 *x, const ASN1_OBJECT *obj, int lastpos);
1087int X509_get_ext_by_critical(const X509 *x, int crit, int lastpos);
1088X509_EXTENSION *X509_get_ext(const X509 *x, int loc);
1089X509_EXTENSION *X509_delete_ext(X509 *x, int loc);
1090int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc);
1091void *X509_get_ext_d2i(const X509 *x, int nid, int *crit, int *idx);
1092int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit,
1093 unsigned long flags);
1094
1095int X509_CRL_get_ext_count(const X509_CRL *x);
1096int X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid, int lastpos);
1097int X509_CRL_get_ext_by_OBJ(const X509_CRL *x, const ASN1_OBJECT *obj,
1098 int lastpos);
1099int X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit, int lastpos);
1100X509_EXTENSION *X509_CRL_get_ext(const X509_CRL *x, int loc);
1101X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc);
1102int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc);
1103void *X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit, int *idx);
1104int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit,
1105 unsigned long flags);
1106
1107int X509_REVOKED_get_ext_count(const X509_REVOKED *x);
1108int X509_REVOKED_get_ext_by_NID(const X509_REVOKED *x, int nid, int lastpos);
1109int X509_REVOKED_get_ext_by_OBJ(const X509_REVOKED *x, const ASN1_OBJECT *obj,
1110 int lastpos);
1111int X509_REVOKED_get_ext_by_critical(const X509_REVOKED *x, int crit,
1112 int lastpos);
1113X509_EXTENSION *X509_REVOKED_get_ext(const X509_REVOKED *x, int loc);
1114X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc);
1115int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc);
1116void *X509_REVOKED_get_ext_d2i(const X509_REVOKED *x, int nid, int *crit,
1117 int *idx);
1118int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit,
1119 unsigned long flags);
1120
1121X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex,
1122 int nid, int crit,
1123 ASN1_OCTET_STRING *data);
1124X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex,
1125 const ASN1_OBJECT *obj, int crit,
1126 ASN1_OCTET_STRING *data);
1127int X509_EXTENSION_set_object(X509_EXTENSION *ex, const ASN1_OBJECT *obj);
1128int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit);
1129int X509_EXTENSION_set_data(X509_EXTENSION *ex, ASN1_OCTET_STRING *data);
1130ASN1_OBJECT *X509_EXTENSION_get_object(X509_EXTENSION *ex);
1131ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne);
1132int X509_EXTENSION_get_critical(const X509_EXTENSION *ex);
1133
1134int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x);
1135int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid,
1136 int lastpos);
1137int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk,
1138 const ASN1_OBJECT *obj, int lastpos);
1139X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc);
1140X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc);
1141STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x,
1142 X509_ATTRIBUTE *attr);
1143STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE)
1144 **x, const ASN1_OBJECT *obj,
1145 int type,
1146 const unsigned char *bytes,
1147 int len);
1148STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE)
1149 **x, int nid, int type,
1150 const unsigned char *bytes,
1151 int len);
1152STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE)
1153 **x, const char *attrname,
1154 int type,
1155 const unsigned char *bytes,
1156 int len);
1157void *X509at_get0_data_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *x,
1158 const ASN1_OBJECT *obj, int lastpos, int type);
1159X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid,
1160 int atrtype, const void *data,
1161 int len);
1162X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr,
1163 const ASN1_OBJECT *obj,
1164 int atrtype, const void *data,
1165 int len);
1166X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr,
1167 const char *atrname, int type,
1168 const unsigned char *bytes,
1169 int len);
1170int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj);
1171int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype,
1172 const void *data, int len);
1173void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, int atrtype,
1174 void *data);
1175int X509_ATTRIBUTE_count(const X509_ATTRIBUTE *attr);
1176ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr);
1177ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx);
1178
1179int EVP_PKEY_get_attr_count(const EVP_PKEY *key);
1180int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, int lastpos);
1181int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, const ASN1_OBJECT *obj,
1182 int lastpos);
1183X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc);
1184X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc);
1185int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr);
1186int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key,
1187 const ASN1_OBJECT *obj, int type,
1188 const unsigned char *bytes, int len);
1189int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key,
1190 int nid, int type,
1191 const unsigned char *bytes, int len);
1192int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key,
1193 const char *attrname, int type,
1194 const unsigned char *bytes, int len);
1195
1196/* lookup a cert from a X509 STACK */
1197X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk, const X509_NAME *name,
1198 const ASN1_INTEGER *serial);
1199X509 *X509_find_by_subject(STACK_OF(X509) *sk, const X509_NAME *name);
1200
1201DECLARE_ASN1_FUNCTIONS(PBEPARAM)
1202DECLARE_ASN1_FUNCTIONS(PBE2PARAM)
1203DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM)
1204#ifndef OPENSSL_NO_SCRYPT
1205DECLARE_ASN1_FUNCTIONS(SCRYPT_PARAMS)
1206#endif
1207
1208int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter,
1209 const unsigned char *salt, int saltlen);
1210int PKCS5_pbe_set0_algor_ex(X509_ALGOR *algor, int alg, int iter,
1211 const unsigned char *salt, int saltlen,
1212 OSSL_LIB_CTX *libctx);
1213
1214X509_ALGOR *PKCS5_pbe_set(int alg, int iter,
1215 const unsigned char *salt, int saltlen);
1216X509_ALGOR *PKCS5_pbe_set_ex(int alg, int iter,
1217 const unsigned char *salt, int saltlen,
1218 OSSL_LIB_CTX *libctx);
1219
1220X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
1221 unsigned char *salt, int saltlen);
1222X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,
1223 unsigned char *salt, int saltlen,
1224 unsigned char *aiv, int prf_nid);
1225X509_ALGOR *PKCS5_pbe2_set_iv_ex(const EVP_CIPHER *cipher, int iter,
1226 unsigned char *salt, int saltlen,
1227 unsigned char *aiv, int prf_nid,
1228 OSSL_LIB_CTX *libctx);
1229
1230#ifndef OPENSSL_NO_SCRYPT
1231X509_ALGOR *PKCS5_pbe2_set_scrypt(const EVP_CIPHER *cipher,
1232 const unsigned char *salt, int saltlen,
1233 unsigned char *aiv, uint64_t N, uint64_t r,
1234 uint64_t p);
1235#endif
1236
1237X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen,
1238 int prf_nid, int keylen);
1239X509_ALGOR *PKCS5_pbkdf2_set_ex(int iter, unsigned char *salt, int saltlen,
1240 int prf_nid, int keylen,
1241 OSSL_LIB_CTX *libctx);
1242
1243/* PKCS#8 utilities */
1244
1245DECLARE_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO)
1246
1247EVP_PKEY *EVP_PKCS82PKEY(const PKCS8_PRIV_KEY_INFO *p8);
1248EVP_PKEY *EVP_PKCS82PKEY_ex(const PKCS8_PRIV_KEY_INFO *p8, OSSL_LIB_CTX *libctx,
1249 const char *propq);
1250PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(const EVP_PKEY *pkey);
1251
1252int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj,
1253 int version, int ptype, void *pval,
1254 unsigned char *penc, int penclen);
1255int PKCS8_pkey_get0(const ASN1_OBJECT **ppkalg,
1256 const unsigned char **pk, int *ppklen,
1257 const X509_ALGOR **pa, const PKCS8_PRIV_KEY_INFO *p8);
1258
1259const STACK_OF(X509_ATTRIBUTE) *
1260PKCS8_pkey_get0_attrs(const PKCS8_PRIV_KEY_INFO *p8);
1261int PKCS8_pkey_add1_attr(PKCS8_PRIV_KEY_INFO *p8, X509_ATTRIBUTE *attr);
1262int PKCS8_pkey_add1_attr_by_NID(PKCS8_PRIV_KEY_INFO *p8, int nid, int type,
1263 const unsigned char *bytes, int len);
1264int PKCS8_pkey_add1_attr_by_OBJ(PKCS8_PRIV_KEY_INFO *p8, const ASN1_OBJECT *obj,
1265 int type, const unsigned char *bytes, int len);
1266
1267
1268int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj,
1269 int ptype, void *pval,
1270 unsigned char *penc, int penclen);
1271int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg,
1272 const unsigned char **pk, int *ppklen,
1273 X509_ALGOR **pa, const X509_PUBKEY *pub);
1274int X509_PUBKEY_eq(const X509_PUBKEY *a, const X509_PUBKEY *b);
1275
1276# ifdef __cplusplus
1277}
1278# endif
1279#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette