diff options
author | schwarze <> | 2016-11-04 15:29:03 +0000 |
---|---|---|
committer | schwarze <> | 2016-11-04 15:29:03 +0000 |
commit | e23d00ab37299e14c06d5d2b599a3793e3d0575c (patch) | |
tree | f91172cf4f459119421ea45c97eb6fa4aec563bc /src/lib | |
parent | f34ab28d6356aae4d0458dd2076438a042314790 (diff) | |
download | openbsd-e23d00ab37299e14c06d5d2b599a3793e3d0575c.tar.gz openbsd-e23d00ab37299e14c06d5d2b599a3793e3d0575c.tar.bz2 openbsd-e23d00ab37299e14c06d5d2b599a3793e3d0575c.zip |
convert X509 manuals from pod to mdoc
Diffstat (limited to 'src/lib')
39 files changed, 2566 insertions, 1825 deletions
diff --git a/src/lib/libcrypto/doc/X509_NAME_ENTRY_get_object.pod b/src/lib/libcrypto/doc/X509_NAME_ENTRY_get_object.pod deleted file mode 100644 index 4603202db8..0000000000 --- a/src/lib/libcrypto/doc/X509_NAME_ENTRY_get_object.pod +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | X509_NAME_ENTRY_get_object, X509_NAME_ENTRY_get_data, | ||
6 | X509_NAME_ENTRY_set_object, X509_NAME_ENTRY_set_data, | ||
7 | X509_NAME_ENTRY_create_by_txt, X509_NAME_ENTRY_create_by_NID, | ||
8 | X509_NAME_ENTRY_create_by_OBJ - X509_NAME_ENTRY utility functions | ||
9 | |||
10 | =head1 SYNOPSIS | ||
11 | |||
12 | #include <openssl/x509.h> | ||
13 | |||
14 | ASN1_OBJECT * X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne); | ||
15 | ASN1_STRING * X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne); | ||
16 | |||
17 | int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, ASN1_OBJECT *obj); | ||
18 | int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, const unsigned char *bytes, int len); | ||
19 | |||
20 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, const char *field, int type, const unsigned char *bytes, int len); | ||
21 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, int type,unsigned char *bytes, int len); | ||
22 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, ASN1_OBJECT *obj, int type, const unsigned char *bytes, int len); | ||
23 | |||
24 | =head1 DESCRIPTION | ||
25 | |||
26 | X509_NAME_ENTRY_get_object() retrieves the field name of B<ne> in | ||
27 | and B<ASN1_OBJECT> structure. | ||
28 | |||
29 | X509_NAME_ENTRY_get_data() retrieves the field value of B<ne> in | ||
30 | and B<ASN1_STRING> structure. | ||
31 | |||
32 | X509_NAME_ENTRY_set_object() sets the field name of B<ne> to B<obj>. | ||
33 | |||
34 | X509_NAME_ENTRY_set_data() sets the field value of B<ne> to string type | ||
35 | B<type> and value determined by B<bytes> and B<len>. | ||
36 | |||
37 | X509_NAME_ENTRY_create_by_txt(), X509_NAME_ENTRY_create_by_NID() | ||
38 | and X509_NAME_ENTRY_create_by_OBJ() create and return an | ||
39 | B<X509_NAME_ENTRY> structure. | ||
40 | |||
41 | =head1 NOTES | ||
42 | |||
43 | X509_NAME_ENTRY_get_object() and X509_NAME_ENTRY_get_data() can be | ||
44 | used to examine an B<X509_NAME_ENTRY> function as returned by | ||
45 | X509_NAME_get_entry() for example. | ||
46 | |||
47 | X509_NAME_ENTRY_create_by_txt(), X509_NAME_ENTRY_create_by_NID(), | ||
48 | and X509_NAME_ENTRY_create_by_OBJ() create and return an | ||
49 | |||
50 | X509_NAME_ENTRY_create_by_txt(), X509_NAME_ENTRY_create_by_OBJ(), | ||
51 | X509_NAME_ENTRY_create_by_NID() and X509_NAME_ENTRY_set_data() | ||
52 | are seldom used in practice because B<X509_NAME_ENTRY> structures | ||
53 | are almost always part of B<X509_NAME> structures and the | ||
54 | corresponding B<X509_NAME> functions are typically used to | ||
55 | create and add new entries in a single operation. | ||
56 | |||
57 | The arguments of these functions support similar options to the similarly | ||
58 | named ones of the corresponding B<X509_NAME> functions such as | ||
59 | X509_NAME_add_entry_by_txt(). So for example B<type> can be set to | ||
60 | B<MBSTRING_ASC> but in the case of X509_set_data() the field name must be | ||
61 | set first so the relevant field information can be looked up internally. | ||
62 | |||
63 | =head1 RETURN VALUES | ||
64 | |||
65 | =head1 SEE ALSO | ||
66 | |||
67 | L<ERR_get_error(3)|ERR_get_error(3)>, L<d2i_X509_NAME(3)|d2i_X509_NAME(3)>, | ||
68 | L<OBJ_nid2obj(3)|OBJ_nid2obj(3)> | ||
69 | |||
70 | =cut | ||
diff --git a/src/lib/libcrypto/doc/X509_NAME_add_entry_by_txt.pod b/src/lib/libcrypto/doc/X509_NAME_add_entry_by_txt.pod deleted file mode 100644 index f97e05e683..0000000000 --- a/src/lib/libcrypto/doc/X509_NAME_add_entry_by_txt.pod +++ /dev/null | |||
@@ -1,117 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | X509_NAME_add_entry_by_txt, X509_NAME_add_entry_by_OBJ, | ||
6 | X509_NAME_add_entry_by_NID, X509_NAME_add_entry, X509_NAME_delete_entry - | ||
7 | X509_NAME modification functions | ||
8 | |||
9 | =head1 SYNOPSIS | ||
10 | |||
11 | #include <openssl/x509.h> | ||
12 | |||
13 | int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, const unsigned char *bytes, int len, int loc, int set); | ||
14 | |||
15 | int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type, unsigned char *bytes, int len, int loc, int set); | ||
16 | |||
17 | int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, unsigned char *bytes, int len, int loc, int set); | ||
18 | |||
19 | int X509_NAME_add_entry(X509_NAME *name,X509_NAME_ENTRY *ne, int loc, int set); | ||
20 | |||
21 | X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc); | ||
22 | |||
23 | =head1 DESCRIPTION | ||
24 | |||
25 | X509_NAME_add_entry_by_txt(), X509_NAME_add_entry_by_OBJ() and | ||
26 | X509_NAME_add_entry_by_NID() add a field whose name is defined | ||
27 | by a string B<field>, an object B<obj> or a NID B<nid> respectively. | ||
28 | The field value to be added is in B<bytes> of length B<len>. If | ||
29 | B<len> is -1 then the field length is calculated internally using | ||
30 | strlen(bytes). | ||
31 | |||
32 | The type of field is determined by B<type> which can either be a | ||
33 | definition of the type of B<bytes> (such as B<MBSTRING_ASC>) or a | ||
34 | standard ASN1 type (such as B<V_ASN1_IA5STRING>). The new entry is | ||
35 | added to a position determined by B<loc> and B<set>. | ||
36 | |||
37 | X509_NAME_add_entry() adds a copy of B<X509_NAME_ENTRY> structure B<ne> | ||
38 | to B<name>. The new entry is added to a position determined by B<loc> | ||
39 | and B<set>. Since a copy of B<ne> is added B<ne> must be freed up after | ||
40 | the call. | ||
41 | |||
42 | X509_NAME_delete_entry() deletes an entry from B<name> at position | ||
43 | B<loc>. The deleted entry is returned and must be freed up. | ||
44 | |||
45 | =head1 NOTES | ||
46 | |||
47 | The use of string types such as B<MBSTRING_ASC> or B<MBSTRING_UTF8> | ||
48 | is strongly recommended for the B<type> parameter. This allows the | ||
49 | internal code to correctly determine the type of the field and to | ||
50 | apply length checks according to the relevant standards. This is | ||
51 | done using ASN1_STRING_set_by_NID(). | ||
52 | |||
53 | If instead an ASN1 type is used no checks are performed and the | ||
54 | supplied data in B<bytes> is used directly. | ||
55 | |||
56 | In X509_NAME_add_entry_by_txt() the B<field> string represents | ||
57 | the field name using OBJ_txt2obj(field, 0). | ||
58 | |||
59 | The B<loc> and B<set> parameters determine where a new entry should | ||
60 | be added. For almost all applications B<loc> can be set to -1 and B<set> | ||
61 | to 0. This adds a new entry to the end of B<name> as a single valued | ||
62 | RelativeDistinguishedName (RDN). | ||
63 | |||
64 | B<loc> actually determines the index where the new entry is inserted: | ||
65 | if it is -1 it is appended. | ||
66 | |||
67 | B<set> determines how the new type is added. If it is zero a | ||
68 | new RDN is created. | ||
69 | |||
70 | If B<set> is -1 or 1 it is added to the previous or next RDN | ||
71 | structure respectively. This will then be a multivalued RDN: | ||
72 | since multivalues RDNs are very seldom used B<set> is almost | ||
73 | always set to zero. | ||
74 | |||
75 | =head1 EXAMPLES | ||
76 | |||
77 | Create an B<X509_NAME> structure: | ||
78 | |||
79 | "C=UK, O=Disorganized Organization, CN=Joe Bloggs" | ||
80 | |||
81 | X509_NAME *nm; | ||
82 | nm = X509_NAME_new(); | ||
83 | if (nm == NULL) | ||
84 | /* Some error */ | ||
85 | if (!X509_NAME_add_entry_by_txt(nm, MBSTRING_ASC, | ||
86 | "C", "UK", -1, -1, 0)) | ||
87 | /* Error */ | ||
88 | if (!X509_NAME_add_entry_by_txt(nm, MBSTRING_ASC, | ||
89 | "O", "Disorganized Organization", -1, -1, 0)) | ||
90 | /* Error */ | ||
91 | if (!X509_NAME_add_entry_by_txt(nm, MBSTRING_ASC, | ||
92 | "CN", "Joe Bloggs", -1, -1, 0)) | ||
93 | /* Error */ | ||
94 | |||
95 | =head1 RETURN VALUES | ||
96 | |||
97 | X509_NAME_add_entry_by_txt(), X509_NAME_add_entry_by_OBJ(), | ||
98 | X509_NAME_add_entry_by_NID() and X509_NAME_add_entry() return 1 for | ||
99 | success of 0 if an error occurred. | ||
100 | |||
101 | X509_NAME_delete_entry() returns either the deleted B<X509_NAME_ENTRY> | ||
102 | structure of B<NULL> if an error occurred. | ||
103 | |||
104 | =head1 BUGS | ||
105 | |||
106 | B<type> can still be set to B<V_ASN1_APP_CHOOSE> to use a | ||
107 | different algorithm to determine field types. Since this form does | ||
108 | not understand multicharacter types, performs no length checks and | ||
109 | can result in invalid field types its use is strongly discouraged. | ||
110 | |||
111 | =head1 SEE ALSO | ||
112 | |||
113 | L<ERR_get_error(3)|ERR_get_error(3)>, L<d2i_X509_NAME(3)|d2i_X509_NAME(3)> | ||
114 | |||
115 | =head1 HISTORY | ||
116 | |||
117 | =cut | ||
diff --git a/src/lib/libcrypto/doc/X509_NAME_get_index_by_NID.pod b/src/lib/libcrypto/doc/X509_NAME_get_index_by_NID.pod deleted file mode 100644 index 48510890e8..0000000000 --- a/src/lib/libcrypto/doc/X509_NAME_get_index_by_NID.pod +++ /dev/null | |||
@@ -1,102 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | X509_NAME_get_index_by_NID, X509_NAME_get_index_by_OBJ, X509_NAME_get_entry, | ||
6 | X509_NAME_entry_count, X509_NAME_get_text_by_NID, X509_NAME_get_text_by_OBJ - | ||
7 | X509_NAME lookup and enumeration functions | ||
8 | |||
9 | =head1 SYNOPSIS | ||
10 | |||
11 | #include <openssl/x509.h> | ||
12 | |||
13 | int X509_NAME_get_index_by_NID(X509_NAME *name,int nid,int lastpos); | ||
14 | int X509_NAME_get_index_by_OBJ(X509_NAME *name,ASN1_OBJECT *obj, int lastpos); | ||
15 | |||
16 | int X509_NAME_entry_count(X509_NAME *name); | ||
17 | X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc); | ||
18 | |||
19 | int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, char *buf,int len); | ||
20 | int X509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, char *buf,int len); | ||
21 | |||
22 | =head1 DESCRIPTION | ||
23 | |||
24 | These functions allow an B<X509_NAME> structure to be examined. The | ||
25 | B<X509_NAME> structure is the same as the B<Name> type defined in | ||
26 | RFC2459 (and elsewhere) and used for example in certificate subject | ||
27 | and issuer names. | ||
28 | |||
29 | X509_NAME_get_index_by_NID() and X509_NAME_get_index_by_OBJ() retrieve | ||
30 | the next index matching B<nid> or B<obj> after B<lastpos>. B<lastpos> | ||
31 | should initially be set to -1. If there are no more entries -1 is returned. | ||
32 | |||
33 | X509_NAME_entry_count() returns the total number of entries in B<name>. | ||
34 | |||
35 | X509_NAME_get_entry() retrieves the B<X509_NAME_ENTRY> from B<name> | ||
36 | corresponding to index B<loc>. Acceptable values for B<loc> run from | ||
37 | 0 to (X509_NAME_entry_count(name) - 1). The value returned is an | ||
38 | internal pointer which must not be freed. | ||
39 | |||
40 | X509_NAME_get_text_by_NID(), X509_NAME_get_text_by_OBJ() retrieve | ||
41 | the "text" from the first entry in B<name> which matches B<nid> or | ||
42 | B<obj>, if no such entry exists -1 is returned. At most B<len> bytes | ||
43 | will be written and the text written to B<buf> will be null | ||
44 | terminated. The length of the output string written is returned | ||
45 | excluding the terminating null. If B<buf> is <NULL> then the amount | ||
46 | of space needed in B<buf> (excluding the final null) is returned. | ||
47 | |||
48 | =head1 NOTES | ||
49 | |||
50 | X509_NAME_get_text_by_NID() and X509_NAME_get_text_by_OBJ() are | ||
51 | legacy functions which have various limitations which make them | ||
52 | of minimal use in practice. They can only find the first matching | ||
53 | entry and will copy the contents of the field verbatim: this can | ||
54 | be highly confusing if the target is a multicharacter string type | ||
55 | like a BMPString or a UTF8String. | ||
56 | |||
57 | For a more general solution X509_NAME_get_index_by_NID() or | ||
58 | X509_NAME_get_index_by_OBJ() should be used followed by | ||
59 | X509_NAME_get_entry() on any matching indices and then the | ||
60 | various B<X509_NAME_ENTRY> utility functions on the result. | ||
61 | |||
62 | =head1 EXAMPLES | ||
63 | |||
64 | Process all entries: | ||
65 | |||
66 | int i; | ||
67 | X509_NAME_ENTRY *e; | ||
68 | |||
69 | for (i = 0; i < X509_NAME_entry_count(nm); i++) { | ||
70 | e = X509_NAME_get_entry(nm, i); | ||
71 | /* Do something with e */ | ||
72 | } | ||
73 | |||
74 | Process all commonName entries: | ||
75 | |||
76 | int loc; | ||
77 | X509_NAME_ENTRY *e; | ||
78 | |||
79 | loc = -1; | ||
80 | for (;;) { | ||
81 | lastpos = X509_NAME_get_index_by_NID(nm, NID_commonName, lastpos); | ||
82 | if (lastpos == -1) | ||
83 | break; | ||
84 | e = X509_NAME_get_entry(nm, lastpos); | ||
85 | /* Do something with e */ | ||
86 | } | ||
87 | |||
88 | =head1 RETURN VALUES | ||
89 | |||
90 | X509_NAME_get_index_by_NID() and X509_NAME_get_index_by_OBJ() | ||
91 | return the index of the next matching entry or -1 if not found. | ||
92 | |||
93 | X509_NAME_entry_count() returns the total number of entries. | ||
94 | |||
95 | X509_NAME_get_entry() returns an B<X509_NAME> pointer to the | ||
96 | requested entry or B<NULL> if the index is invalid. | ||
97 | |||
98 | =head1 SEE ALSO | ||
99 | |||
100 | L<ERR_get_error(3)|ERR_get_error(3)>, L<d2i_X509_NAME(3)|d2i_X509_NAME(3)> | ||
101 | |||
102 | =cut | ||
diff --git a/src/lib/libcrypto/doc/X509_NAME_print_ex.pod b/src/lib/libcrypto/doc/X509_NAME_print_ex.pod deleted file mode 100644 index 5cdf636c16..0000000000 --- a/src/lib/libcrypto/doc/X509_NAME_print_ex.pod +++ /dev/null | |||
@@ -1,103 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | X509_NAME_print_ex, X509_NAME_print_ex_fp, X509_NAME_print, | ||
6 | X509_NAME_oneline - X509_NAME printing routines. | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/x509.h> | ||
11 | |||
12 | int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent, unsigned long flags); | ||
13 | int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long flags); | ||
14 | char * X509_NAME_oneline(X509_NAME *a,char *buf,int size); | ||
15 | int X509_NAME_print(BIO *bp, X509_NAME *name, int obase); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | X509_NAME_print_ex() prints a human readable version of B<nm> to BIO B<out>. | ||
20 | Each line (for multiline formats) is indented by B<indent> spaces. The output | ||
21 | format can be extensively customised by use of the B<flags> parameter. | ||
22 | |||
23 | X509_NAME_print_ex_fp() is identical to X509_NAME_print_ex() except the output | ||
24 | is written to FILE pointer B<fp>. | ||
25 | |||
26 | X509_NAME_oneline() prints an ASCII version of B<a> to B<buf>. At most B<size> | ||
27 | bytes will be written. If B<buf> is B<NULL> then a buffer is dynamically | ||
28 | allocated and returned, otherwise B<buf> is returned. | ||
29 | |||
30 | X509_NAME_print() prints out B<name> to B<bp> indenting each line by B<obase> | ||
31 | characters. Multiple lines are used if the output (including indent) exceeds | ||
32 | 80 characters. | ||
33 | |||
34 | =head1 NOTES | ||
35 | |||
36 | The functions X509_NAME_oneline() and X509_NAME_print() are legacy functions | ||
37 | which produce a non standard output form, they don't handle multi character | ||
38 | fields and have various quirks and inconsistencies. Their use is strongly | ||
39 | discouraged in new applications. | ||
40 | |||
41 | Although there are a large number of possible flags for most purposes | ||
42 | B<XN_FLAG_ONELINE>, B<XN_FLAG_MULTILINE> or B<XN_FLAG_RFC2253> will suffice. | ||
43 | As noted on the L<ASN1_STRING_print_ex(3)|ASN1_STRING_print_ex(3)> manual page | ||
44 | for UTF8 terminals the B<ASN1_STRFLGS_ESC_MSB> should be unset: so for example | ||
45 | B<XN_FLAG_ONELINE & ~ASN1_STRFLGS_ESC_MSB> would be used. | ||
46 | |||
47 | The complete set of the flags supported by X509_NAME_print_ex() is listed below. | ||
48 | |||
49 | Several options can be ored together. | ||
50 | |||
51 | The options B<XN_FLAG_SEP_COMMA_PLUS>, B<XN_FLAG_SEP_CPLUS_SPC>, | ||
52 | B<XN_FLAG_SEP_SPLUS_SPC> and B<XN_FLAG_SEP_MULTILINE> determine the field | ||
53 | separators to use. Two distinct separators are used between distinct | ||
54 | RelativeDistinguishedName components and separate values in the same RDN for a | ||
55 | multi-valued RDN. Multi-valued RDNs are currently very rare so the second | ||
56 | separator will hardly ever be used. | ||
57 | |||
58 | B<XN_FLAG_SEP_COMMA_PLUS> uses comma and plus as separators. | ||
59 | B<XN_FLAG_SEP_CPLUS_SPC> uses comma and plus with spaces: this is more readable | ||
60 | that plain comma and plus. B<XN_FLAG_SEP_SPLUS_SPC> uses spaced semicolon and | ||
61 | plus. B<XN_FLAG_SEP_MULTILINE> uses spaced newline and plus respectively. | ||
62 | |||
63 | If B<XN_FLAG_DN_REV> is set the whole DN is printed in reversed order. | ||
64 | |||
65 | The fields B<XN_FLAG_FN_SN>, B<XN_FLAG_FN_LN>, B<XN_FLAG_FN_OID>, | ||
66 | B<XN_FLAG_FN_NONE> determine how a field name is displayed. It will | ||
67 | use the short name (e.g. CN) the long name (e.g. commonName) always | ||
68 | use OID numerical form (normally OIDs are only used if the field name is not | ||
69 | recognised) and no field name respectively. | ||
70 | |||
71 | If B<XN_FLAG_SPC_EQ> is set then spaces will be placed around the '=' character | ||
72 | separating field names and values. | ||
73 | |||
74 | If B<XN_FLAG_DUMP_UNKNOWN_FIELDS> is set then the encoding of unknown fields is | ||
75 | printed instead of the values. | ||
76 | |||
77 | If B<XN_FLAG_FN_ALIGN> is set then field names are padded to 20 characters: this | ||
78 | is only of use for multiline format. | ||
79 | |||
80 | Additionally all the options supported by ASN1_STRING_print_ex() can be used to | ||
81 | control how each field value is displayed. | ||
82 | |||
83 | In addition a number options can be set for commonly used formats. | ||
84 | |||
85 | B<XN_FLAG_RFC2253> sets options which produce an output compatible with RFC2253 it | ||
86 | is equivalent to: | ||
87 | B<ASN1_STRFLGS_RFC2253 | XN_FLAG_SEP_COMMA_PLUS | XN_FLAG_DN_REV | XN_FLAG_FN_SN | XN_FLAG_DUMP_UNKNOWN_FIELDS> | ||
88 | |||
89 | |||
90 | B<XN_FLAG_ONELINE> is a more readable one line format which is the same as: | ||
91 | B<ASN1_STRFLGS_RFC2253 | ASN1_STRFLGS_ESC_QUOTE | XN_FLAG_SEP_CPLUS_SPC | XN_FLAG_SPC_EQ | XN_FLAG_FN_SN> | ||
92 | |||
93 | B<XN_FLAG_MULTILINE> is a multiline format which is the same as: | ||
94 | B<ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | XN_FLAG_SEP_MULTILINE | XN_FLAG_SPC_EQ | XN_FLAG_FN_LN | XN_FLAG_FN_ALIGN> | ||
95 | |||
96 | B<XN_FLAG_COMPAT> uses a format identical to X509_NAME_print(): in fact it | ||
97 | calls X509_NAME_print() internally. | ||
98 | |||
99 | =head1 SEE ALSO | ||
100 | |||
101 | L<ASN1_STRING_print_ex(3)|ASN1_STRING_print_ex(3)> | ||
102 | |||
103 | =cut | ||
diff --git a/src/lib/libcrypto/doc/X509_STORE_CTX_get_error.pod b/src/lib/libcrypto/doc/X509_STORE_CTX_get_error.pod deleted file mode 100644 index 270b265ce5..0000000000 --- a/src/lib/libcrypto/doc/X509_STORE_CTX_get_error.pod +++ /dev/null | |||
@@ -1,323 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | X509_STORE_CTX_get_error, X509_STORE_CTX_set_error, | ||
6 | X509_STORE_CTX_get_error_depth, X509_STORE_CTX_get_current_cert, | ||
7 | X509_STORE_CTX_get1_chain, X509_verify_cert_error_string - get or set | ||
8 | certificate verification status information | ||
9 | |||
10 | =head1 SYNOPSIS | ||
11 | |||
12 | #include <openssl/x509.h> | ||
13 | #include <openssl/x509_vfy.h> | ||
14 | |||
15 | int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx); | ||
16 | void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s); | ||
17 | int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx); | ||
18 | X509 * X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx); | ||
19 | |||
20 | STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx); | ||
21 | |||
22 | const char *X509_verify_cert_error_string(long n); | ||
23 | |||
24 | =head1 DESCRIPTION | ||
25 | |||
26 | These functions are typically called after X509_verify_cert() has indicated | ||
27 | an error or in a verification callback to determine the nature of an error. | ||
28 | |||
29 | X509_STORE_CTX_get_error() returns the error code of B<ctx>, see | ||
30 | the B<ERROR CODES> section for a full description of all error codes. | ||
31 | |||
32 | X509_STORE_CTX_set_error() sets the error code of B<ctx> to B<s>. For example | ||
33 | it might be used in a verification callback to set an error based on additional | ||
34 | checks. | ||
35 | |||
36 | X509_STORE_CTX_get_error_depth() returns the B<depth> of the error. This is a | ||
37 | non-negative integer representing where in the certificate chain the error | ||
38 | occurred. If it is zero it occurred in the end entity certificate, one if | ||
39 | it is the certificate which signed the end entity certificate and so on. | ||
40 | |||
41 | X509_STORE_CTX_get_current_cert() returns the certificate in B<ctx> which | ||
42 | caused the error or B<NULL> if no certificate is relevant. | ||
43 | |||
44 | X509_STORE_CTX_get1_chain() returns a complete validate chain if a previous | ||
45 | call to X509_verify_cert() is successful. If the call to X509_verify_cert() | ||
46 | is B<not> successful the returned chain may be incomplete or invalid. The | ||
47 | returned chain persists after the B<ctx> structure is freed, when it is | ||
48 | no longer needed it should be free up using: | ||
49 | |||
50 | sk_X509_pop_free(chain, X509_free); | ||
51 | |||
52 | X509_verify_cert_error_string() returns a human readable error string for | ||
53 | verification error B<n>. | ||
54 | |||
55 | =head1 RETURN VALUES | ||
56 | |||
57 | X509_STORE_CTX_get_error() returns B<X509_V_OK> or an error code. | ||
58 | |||
59 | X509_STORE_CTX_get_error_depth() returns a non-negative error depth. | ||
60 | |||
61 | X509_STORE_CTX_get_current_cert() returns the certificate which caused the | ||
62 | error or B<NULL> if no certificate is relevant to the error. | ||
63 | |||
64 | X509_verify_cert_error_string() returns a human readable error string for | ||
65 | verification error B<n>. | ||
66 | |||
67 | =head1 ERROR CODES | ||
68 | |||
69 | A list of error codes and messages is shown below. Some of the | ||
70 | error codes are defined but currently never returned: these are described as | ||
71 | "unused". | ||
72 | |||
73 | =over 4 | ||
74 | |||
75 | =item B<X509_V_OK: ok> | ||
76 | |||
77 | the operation was successful. | ||
78 | |||
79 | =item B<X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certificate> | ||
80 | |||
81 | the issuer certificate could not be found: this occurs if the issuer certificate | ||
82 | of an untrusted certificate cannot be found. | ||
83 | |||
84 | =item B<X509_V_ERR_UNABLE_TO_GET_CRL: unable to get certificate CRL> | ||
85 | |||
86 | the CRL of a certificate could not be found. | ||
87 | |||
88 | =item B<X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: unable to decrypt | ||
89 | certificate's signature> | ||
90 | |||
91 | the certificate signature could not be decrypted. This means that the actual | ||
92 | signature value could not be determined rather than it not matching the | ||
93 | expected value, this is only meaningful for RSA keys. | ||
94 | |||
95 | =item B<X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE: unable to decrypt CRL's | ||
96 | signature> | ||
97 | |||
98 | the CRL signature could not be decrypted: this means that the actual signature | ||
99 | value could not be determined rather than it not matching the expected value. | ||
100 | Unused. | ||
101 | |||
102 | =item B<X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY: unable to decode issuer | ||
103 | public key> | ||
104 | |||
105 | the public key in the certificate SubjectPublicKeyInfo could not be read. | ||
106 | |||
107 | =item B<X509_V_ERR_CERT_SIGNATURE_FAILURE: certificate signature failure> | ||
108 | |||
109 | the signature of the certificate is invalid. | ||
110 | |||
111 | =item B<X509_V_ERR_CRL_SIGNATURE_FAILURE: CRL signature failure> | ||
112 | |||
113 | the signature of the certificate is invalid. | ||
114 | |||
115 | =item B<X509_V_ERR_CERT_NOT_YET_VALID: certificate is not yet valid> | ||
116 | |||
117 | the certificate is not yet valid: the notBefore date is after the current time. | ||
118 | |||
119 | =item B<X509_V_ERR_CERT_HAS_EXPIRED: certificate has expired> | ||
120 | |||
121 | the certificate has expired: that is the notAfter date is before the current | ||
122 | time. | ||
123 | |||
124 | =item B<X509_V_ERR_CRL_NOT_YET_VALID: CRL is not yet valid> | ||
125 | |||
126 | the CRL is not yet valid. | ||
127 | |||
128 | =item B<X509_V_ERR_CRL_HAS_EXPIRED: CRL has expired> | ||
129 | |||
130 | the CRL has expired. | ||
131 | |||
132 | =item B<X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: format error in | ||
133 | certificate's notBefore field> | ||
134 | |||
135 | the certificate notBefore field contains an invalid time. | ||
136 | |||
137 | =item B<X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: format error in certificate's | ||
138 | notAfter field> | ||
139 | |||
140 | the certificate notAfter field contains an invalid time. | ||
141 | |||
142 | =item B<X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD: format error in CRL's | ||
143 | lastUpdate field> | ||
144 | |||
145 | the CRL lastUpdate field contains an invalid time. | ||
146 | |||
147 | =item B<X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD: format error in CRL's | ||
148 | nextUpdate field> | ||
149 | |||
150 | the CRL nextUpdate field contains an invalid time. | ||
151 | |||
152 | =item B<X509_V_ERR_OUT_OF_MEM: out of memory> | ||
153 | |||
154 | an error occurred trying to allocate memory. This should never happen. | ||
155 | |||
156 | =item B<X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: self signed certificate> | ||
157 | |||
158 | the passed certificate is self signed and the same certificate cannot be found | ||
159 | in the list of trusted certificates. | ||
160 | |||
161 | =item B<X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: self signed certificate in | ||
162 | certificate chain> | ||
163 | |||
164 | the certificate chain could be built up using the untrusted certificates but | ||
165 | the root could not be found locally. | ||
166 | |||
167 | =item B<X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: unable to get local | ||
168 | issuer certificate> | ||
169 | |||
170 | the issuer certificate of a locally looked up certificate could not be found. | ||
171 | This normally means the list of trusted certificates is not complete. | ||
172 | |||
173 | =item B<X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: unable to verify the first | ||
174 | certificate> | ||
175 | |||
176 | no signatures could be verified because the chain contains only one certificate | ||
177 | and it is not self signed. | ||
178 | |||
179 | =item B<X509_V_ERR_CERT_CHAIN_TOO_LONG: certificate chain too long> | ||
180 | |||
181 | the certificate chain length is greater than the supplied maximum depth. Unused. | ||
182 | |||
183 | =item B<X509_V_ERR_CERT_REVOKED: certificate revoked> | ||
184 | |||
185 | the certificate has been revoked. | ||
186 | |||
187 | =item B<X509_V_ERR_INVALID_CA: invalid CA certificate> | ||
188 | |||
189 | a CA certificate is invalid. Either it is not a CA or its extensions are not | ||
190 | consistent with the supplied purpose. | ||
191 | |||
192 | =item B<X509_V_ERR_PATH_LENGTH_EXCEEDED: path length constraint exceeded> | ||
193 | |||
194 | the basicConstraints pathlength parameter has been exceeded. | ||
195 | |||
196 | =item B<X509_V_ERR_INVALID_PURPOSE: unsupported certificate purpose> | ||
197 | |||
198 | the supplied certificate cannot be used for the specified purpose. | ||
199 | |||
200 | =item B<X509_V_ERR_CERT_UNTRUSTED: certificate not trusted> | ||
201 | |||
202 | the root CA is not marked as trusted for the specified purpose. | ||
203 | |||
204 | =item B<X509_V_ERR_CERT_REJECTED: certificate rejected> | ||
205 | |||
206 | the root CA is marked to reject the specified purpose. | ||
207 | |||
208 | =item B<X509_V_ERR_SUBJECT_ISSUER_MISMATCH: subject issuer mismatch> | ||
209 | |||
210 | the current candidate issuer certificate was rejected because its subject name | ||
211 | did not match the issuer name of the current certificate. This is only set | ||
212 | if issuer check debugging is enabled it is used for status notification and | ||
213 | is B<not> in itself an error. | ||
214 | |||
215 | =item B<X509_V_ERR_AKID_SKID_MISMATCH: authority and subject key identifier | ||
216 | mismatch> | ||
217 | |||
218 | the current candidate issuer certificate was rejected because its subject key | ||
219 | identifier was present and did not match the authority key identifier current | ||
220 | certificate. This is only set if issuer check debugging is enabled it is used | ||
221 | for status notification and is B<not> in itself an error. | ||
222 | |||
223 | =item B<X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH: authority and issuer serial | ||
224 | number mismatch> | ||
225 | |||
226 | the current candidate issuer certificate was rejected because its issuer name | ||
227 | and serial number was present and did not match the authority key identifier of | ||
228 | the current certificate. This is only set if issuer check debugging is enabled | ||
229 | it is used for status notification and is B<not> in itself an error. | ||
230 | |||
231 | =item B<X509_V_ERR_KEYUSAGE_NO_CERTSIGN:key usage does not include certificate | ||
232 | signing> | ||
233 | |||
234 | the current candidate issuer certificate was rejected because its keyUsage | ||
235 | extension does not permit certificate signing. This is only set if issuer check | ||
236 | debugging is enabled it is used for status notification and is B<not> in itself | ||
237 | an error. | ||
238 | |||
239 | =item B<X509_V_ERR_INVALID_EXTENSION: invalid or inconsistent certificate | ||
240 | extension> | ||
241 | |||
242 | A certificate extension had an invalid value (for example an incorrect | ||
243 | encoding) or some value inconsistent with other extensions. | ||
244 | |||
245 | |||
246 | =item B<X509_V_ERR_INVALID_POLICY_EXTENSION: invalid or inconsistent | ||
247 | certificate policy extension> | ||
248 | |||
249 | A certificate policies extension had an invalid value (for example an incorrect | ||
250 | encoding) or some value inconsistent with other extensions. This error only | ||
251 | occurs if policy processing is enabled. | ||
252 | |||
253 | =item B<X509_V_ERR_NO_EXPLICIT_POLICY: no explicit policy> | ||
254 | |||
255 | The verification flags were set to require and explicit policy but none was | ||
256 | present. | ||
257 | |||
258 | =item B<X509_V_ERR_DIFFERENT_CRL_SCOPE: Different CRL scope> | ||
259 | |||
260 | The only CRLs that could be found did not match the scope of the certificate. | ||
261 | |||
262 | =item B<X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE: Unsupported extension feature> | ||
263 | |||
264 | Some feature of a certificate extension is not supported. Unused. | ||
265 | |||
266 | =item B<X509_V_ERR_PERMITTED_VIOLATION: permitted subtree violation> | ||
267 | |||
268 | A name constraint violation occurred in the permitted subtrees. | ||
269 | |||
270 | =item B<X509_V_ERR_EXCLUDED_VIOLATION: excluded subtree violation> | ||
271 | |||
272 | A name constraint violation occurred in the excluded subtrees. | ||
273 | |||
274 | =item B<X509_V_ERR_SUBTREE_MINMAX: name constraints minimum and maximum not | ||
275 | supported> | ||
276 | |||
277 | A certificate name constraints extension included a minimum or maximum field: | ||
278 | this is not supported. | ||
279 | |||
280 | =item B<X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE: unsupported name constraint | ||
281 | type> | ||
282 | |||
283 | An unsupported name constraint type was encountered. OpenSSL currently only | ||
284 | supports directory name, DNS name, email and URI types. | ||
285 | |||
286 | =item B<X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX: unsupported or invalid name | ||
287 | constraint syntax> | ||
288 | |||
289 | The format of the name constraint is not recognised: for example an email | ||
290 | address format of a form not mentioned in RFC3280. This could be caused by | ||
291 | a garbage extension or some new feature not currently supported. | ||
292 | |||
293 | =item B<X509_V_ERR_CRL_PATH_VALIDATION_ERROR: CRL path validation error> | ||
294 | |||
295 | An error occurred when attempting to verify the CRL path. This error can only | ||
296 | happen if extended CRL checking is enabled. | ||
297 | |||
298 | =item B<X509_V_ERR_APPLICATION_VERIFICATION: application verification failure> | ||
299 | |||
300 | an application specific error. This will never be returned unless explicitly | ||
301 | set by an application. | ||
302 | |||
303 | =back | ||
304 | |||
305 | =head1 NOTES | ||
306 | |||
307 | The above functions should be used instead of directly referencing the fields | ||
308 | in the B<X509_VERIFY_CTX> structure. | ||
309 | |||
310 | In versions of OpenSSL before 1.0 the current certificate returned by | ||
311 | X509_STORE_CTX_get_current_cert() was never B<NULL>. Applications should | ||
312 | check the return value before printing out any debugging information relating | ||
313 | to the current certificate. | ||
314 | |||
315 | If an unrecognised error code is passed to X509_verify_cert_error_string() the | ||
316 | numerical value of the unknown code is returned in a static buffer. This is not | ||
317 | thread safe but will never happen unless an invalid code is passed. | ||
318 | |||
319 | =head1 SEE ALSO | ||
320 | |||
321 | L<X509_verify_cert(3)|X509_verify_cert(3)> | ||
322 | |||
323 | =cut | ||
diff --git a/src/lib/libcrypto/doc/X509_STORE_CTX_get_ex_new_index.pod b/src/lib/libcrypto/doc/X509_STORE_CTX_get_ex_new_index.pod deleted file mode 100644 index 25224cef1b..0000000000 --- a/src/lib/libcrypto/doc/X509_STORE_CTX_get_ex_new_index.pod +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | X509_STORE_CTX_get_ex_new_index, X509_STORE_CTX_set_ex_data, | ||
6 | X509_STORE_CTX_get_ex_data - add application specific data to X509_STORE_CTX | ||
7 | structures | ||
8 | |||
9 | =head1 SYNOPSIS | ||
10 | |||
11 | #include <openssl/x509_vfy.h> | ||
12 | |||
13 | int X509_STORE_CTX_get_ex_new_index(long argl, void *argp, | ||
14 | CRYPTO_EX_new *new_func, | ||
15 | CRYPTO_EX_dup *dup_func, | ||
16 | CRYPTO_EX_free *free_func); | ||
17 | |||
18 | int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *d, int idx, void *arg); | ||
19 | |||
20 | void *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *d, int idx); | ||
21 | |||
22 | =head1 DESCRIPTION | ||
23 | |||
24 | These functions handle application specific data in X509_STORE_CTX structures. | ||
25 | Their usage is identical to that of RSA_get_ex_new_index(), RSA_set_ex_data() | ||
26 | and RSA_get_ex_data() as described in L<RSA_get_ex_new_index(3)>. | ||
27 | |||
28 | =head1 NOTES | ||
29 | |||
30 | This mechanism is used internally by the B<ssl> library to store the B<SSL> | ||
31 | structure associated with a verification operation in an B<X509_STORE_CTX> | ||
32 | structure. | ||
33 | |||
34 | =head1 SEE ALSO | ||
35 | |||
36 | L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)> | ||
37 | |||
38 | =head1 HISTORY | ||
39 | |||
40 | X509_STORE_CTX_get_ex_new_index(), X509_STORE_CTX_set_ex_data() and | ||
41 | X509_STORE_CTX_get_ex_data() are available since OpenSSL 0.9.5. | ||
42 | |||
43 | =cut | ||
diff --git a/src/lib/libcrypto/doc/X509_STORE_CTX_new.pod b/src/lib/libcrypto/doc/X509_STORE_CTX_new.pod deleted file mode 100644 index 66c0da04d2..0000000000 --- a/src/lib/libcrypto/doc/X509_STORE_CTX_new.pod +++ /dev/null | |||
@@ -1,126 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | X509_STORE_CTX_new, X509_STORE_CTX_cleanup, X509_STORE_CTX_free, | ||
6 | X509_STORE_CTX_init, X509_STORE_CTX_trusted_stack, X509_STORE_CTX_set_cert, | ||
7 | X509_STORE_CTX_set_chain, X509_STORE_CTX_set0_crls, X509_STORE_CTX_get0_param, | ||
8 | X509_STORE_CTX_set0_param, X509_STORE_CTX_set_default - X509_STORE_CTX | ||
9 | initialisation | ||
10 | |||
11 | =head1 SYNOPSIS | ||
12 | |||
13 | #include <openssl/x509_vfy.h> | ||
14 | |||
15 | X509_STORE_CTX *X509_STORE_CTX_new(void); | ||
16 | void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); | ||
17 | void X509_STORE_CTX_free(X509_STORE_CTX *ctx); | ||
18 | |||
19 | int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, | ||
20 | X509 *x509, STACK_OF(X509) *chain); | ||
21 | |||
22 | void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); | ||
23 | |||
24 | void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx,X509 *x); | ||
25 | void X509_STORE_CTX_set_chain(X509_STORE_CTX *ctx,STACK_OF(X509) *sk); | ||
26 | void X509_STORE_CTX_set0_crls(X509_STORE_CTX *ctx, STACK_OF(X509_CRL) *sk); | ||
27 | |||
28 | X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx); | ||
29 | void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param); | ||
30 | int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name); | ||
31 | |||
32 | =head1 DESCRIPTION | ||
33 | |||
34 | These functions initialise an B<X509_STORE_CTX> structure for subsequent use | ||
35 | by X509_verify_cert(). | ||
36 | |||
37 | X509_STORE_CTX_new() returns a newly initialised B<X509_STORE_CTX> structure. | ||
38 | |||
39 | X509_STORE_CTX_cleanup() internally cleans up an B<X509_STORE_CTX> structure. | ||
40 | The context can then be reused with an new call to X509_STORE_CTX_init(). | ||
41 | |||
42 | X509_STORE_CTX_free() completely frees up B<ctx>. After this call B<ctx> | ||
43 | is no longer valid. | ||
44 | |||
45 | X509_STORE_CTX_init() sets up B<ctx> for a subsequent verification operation. | ||
46 | The trusted certificate store is set to B<store>, the end entity certificate | ||
47 | to be verified is set to B<x509> and a set of additional certificates (which | ||
48 | will be untrusted but may be used to build the chain) in B<chain>. Any or | ||
49 | all of the B<store>, B<x509> and B<chain> parameters can be B<NULL>. | ||
50 | |||
51 | X509_STORE_CTX_trusted_stack() sets the set of trusted certificates of B<ctx> | ||
52 | to B<sk>. This is an alternative way of specifying trusted certificates | ||
53 | instead of using an B<X509_STORE>. | ||
54 | |||
55 | X509_STORE_CTX_set_cert() sets the certificate to be verified in B<ctx> to | ||
56 | B<x>. | ||
57 | |||
58 | X509_STORE_CTX_set_chain() sets the additional certificate chain used by B<ctx> | ||
59 | to B<sk>. | ||
60 | |||
61 | X509_STORE_CTX_set0_crls() sets a set of CRLs to use to aid certificate | ||
62 | verification to B<sk>. These CRLs will only be used if CRL verification is | ||
63 | enabled in the associated B<X509_VERIFY_PARAM> structure. This might be | ||
64 | used where additional "useful" CRLs are supplied as part of a protocol, | ||
65 | for example in a PKCS#7 structure. | ||
66 | |||
67 | X509_VERIFY_PARAM *X509_STORE_CTX_get0_param() retrieves an internal pointer | ||
68 | to the verification parameters associated with B<ctx>. | ||
69 | |||
70 | X509_STORE_CTX_set0_param() sets the internal verification parameter pointer | ||
71 | to B<param>. After this call B<param> should not be used. | ||
72 | |||
73 | X509_STORE_CTX_set_default() looks up and sets the default verification | ||
74 | method to B<name>. This uses the function X509_VERIFY_PARAM_lookup() to | ||
75 | find an appropriate set of parameters from B<name>. | ||
76 | |||
77 | =head1 NOTES | ||
78 | |||
79 | The certificates and CRLs in a store are used internally and should B<not> | ||
80 | be freed up until after the associated B<X509_STORE_CTX> is freed. Legacy | ||
81 | applications might implicitly use an B<X509_STORE_CTX> like this: | ||
82 | |||
83 | X509_STORE_CTX ctx; | ||
84 | X509_STORE_CTX_init(&ctx, store, cert, chain); | ||
85 | |||
86 | this is B<not> recommended in new applications they should instead do: | ||
87 | |||
88 | X509_STORE_CTX *ctx; | ||
89 | ctx = X509_STORE_CTX_new(); | ||
90 | if (ctx == NULL) | ||
91 | /* Bad error */ | ||
92 | X509_STORE_CTX_init(ctx, store, cert, chain); | ||
93 | |||
94 | =head1 BUGS | ||
95 | |||
96 | The certificates and CRLs in a context are used internally and should B<not> | ||
97 | be freed up until after the associated B<X509_STORE_CTX> is freed. Copies | ||
98 | should be made or reference counts increased instead. | ||
99 | |||
100 | =head1 RETURN VALUES | ||
101 | |||
102 | X509_STORE_CTX_new() returns an newly allocates context or B<NULL> is an | ||
103 | error occurred. | ||
104 | |||
105 | X509_STORE_CTX_init() returns 1 for success or 0 if an error occurred. | ||
106 | |||
107 | X509_STORE_CTX_get0_param() returns a pointer to an B<X509_VERIFY_PARAM> | ||
108 | structure or B<NULL> if an error occurred. | ||
109 | |||
110 | X509_STORE_CTX_cleanup(), X509_STORE_CTX_free(), X509_STORE_CTX_trusted_stack(), | ||
111 | X509_STORE_CTX_set_cert(), X509_STORE_CTX_set_chain(), | ||
112 | X509_STORE_CTX_set0_crls() and X509_STORE_CTX_set0_param() do not return | ||
113 | values. | ||
114 | |||
115 | X509_STORE_CTX_set_default() returns 1 for success or 0 if an error occurred. | ||
116 | |||
117 | =head1 SEE ALSO | ||
118 | |||
119 | L<X509_verify_cert(3)|X509_verify_cert(3)> | ||
120 | L<X509_VERIFY_PARAM_set_flags(3)|X509_VERIFY_PARAM_set_flags(3)> | ||
121 | |||
122 | =head1 HISTORY | ||
123 | |||
124 | X509_STORE_CTX_set0_crls() was first added to OpenSSL 1.0.0 | ||
125 | |||
126 | =cut | ||
diff --git a/src/lib/libcrypto/doc/X509_STORE_CTX_set_verify_cb.pod b/src/lib/libcrypto/doc/X509_STORE_CTX_set_verify_cb.pod deleted file mode 100644 index 7dfe430c4c..0000000000 --- a/src/lib/libcrypto/doc/X509_STORE_CTX_set_verify_cb.pod +++ /dev/null | |||
@@ -1,165 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | X509_STORE_CTX_set_verify_cb - set verification callback | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/x509_vfy.h> | ||
10 | |||
11 | void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, | ||
12 | int (*verify_cb)(int ok, X509_STORE_CTX *ctx)); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | X509_STORE_CTX_set_verify_cb() sets the verification callback of B<ctx> to | ||
17 | B<verify_cb> overwriting any existing callback. | ||
18 | |||
19 | The verification callback can be used to customise the operation of certificate | ||
20 | verification, either by overriding error conditions or logging errors for | ||
21 | debugging purposes. | ||
22 | |||
23 | However a verification callback is B<not> essential and the default operation | ||
24 | is often sufficient. | ||
25 | |||
26 | The B<ok> parameter to the callback indicates the value the callback should | ||
27 | return to retain the default behaviour. If it is zero then and error condition | ||
28 | is indicated. If it is 1 then no error occurred. If the flag | ||
29 | B<X509_V_FLAG_NOTIFY_POLICY> is set then B<ok> is set to 2 to indicate the | ||
30 | policy checking is complete. | ||
31 | |||
32 | The B<ctx> parameter to the callback is the B<X509_STORE_CTX> structure that | ||
33 | is performing the verification operation. A callback can examine this | ||
34 | structure and receive additional information about the error, for example | ||
35 | by calling X509_STORE_CTX_get_current_cert(). Additional application data can | ||
36 | be passed to the callback via the B<ex_data> mechanism. | ||
37 | |||
38 | =head1 WARNING | ||
39 | |||
40 | In general a verification callback should B<NOT> unconditionally return 1 in | ||
41 | all circumstances because this will allow verification to succeed no matter | ||
42 | what the error. This effectively removes all security from the application | ||
43 | because B<any> certificate (including untrusted generated ones) will be | ||
44 | accepted. | ||
45 | |||
46 | =head1 NOTES | ||
47 | |||
48 | The verification callback can be set and inherited from the parent structure | ||
49 | performing the operation. In some cases (such as S/MIME verification) the | ||
50 | B<X509_STORE_CTX> structure is created and destroyed internally and the | ||
51 | only way to set a custom verification callback is by inheriting it from the | ||
52 | associated B<X509_STORE>. | ||
53 | |||
54 | =head1 RETURN VALUES | ||
55 | |||
56 | X509_STORE_CTX_set_verify_cb() does not return a value. | ||
57 | |||
58 | =head1 EXAMPLES | ||
59 | |||
60 | Default callback operation: | ||
61 | |||
62 | int | ||
63 | verify_callback(int ok, X509_STORE_CTX *ctx) | ||
64 | { | ||
65 | return ok; | ||
66 | } | ||
67 | |||
68 | Simple example, suppose a certificate in the chain is expired and we wish | ||
69 | to continue after this error: | ||
70 | |||
71 | int | ||
72 | verify_callback(int ok, X509_STORE_CTX *ctx) | ||
73 | { | ||
74 | /* Tolerate certificate expiration */ | ||
75 | if (X509_STORE_CTX_get_error(ctx) == X509_V_ERR_CERT_HAS_EXPIRED) | ||
76 | return 1; | ||
77 | /* Otherwise don't override */ | ||
78 | return ok; | ||
79 | } | ||
80 | |||
81 | More complex example, we don't wish to continue after B<any> certificate has | ||
82 | expired just one specific case: | ||
83 | |||
84 | int | ||
85 | verify_callback(int ok, X509_STORE_CTX *ctx) | ||
86 | { | ||
87 | int err = X509_STORE_CTX_get_error(ctx); | ||
88 | X509 *err_cert = X509_STORE_CTX_get_current_cert(ctx); | ||
89 | |||
90 | if (err == X509_V_ERR_CERT_HAS_EXPIRED) { | ||
91 | if (check_is_acceptable_expired_cert(err_cert) | ||
92 | return 1; | ||
93 | } | ||
94 | return ok; | ||
95 | } | ||
96 | |||
97 | Full featured logging callback. In this case the B<bio_err> is assumed to be | ||
98 | a global logging B<BIO>, an alternative would to store a BIO in B<ctx> using | ||
99 | B<ex_data>. | ||
100 | |||
101 | int | ||
102 | verify_callback(int ok, X509_STORE_CTX *ctx) | ||
103 | { | ||
104 | X509 *err_cert; | ||
105 | int err,depth; | ||
106 | |||
107 | err_cert = X509_STORE_CTX_get_current_cert(ctx); | ||
108 | err = X509_STORE_CTX_get_error(ctx); | ||
109 | depth = X509_STORE_CTX_get_error_depth(ctx); | ||
110 | |||
111 | BIO_printf(bio_err,"depth=%d ",depth); | ||
112 | if (err_cert) { | ||
113 | X509_NAME_print_ex(bio_err, | ||
114 | X509_get_subject_name(err_cert), 0, | ||
115 | XN_FLAG_ONELINE); | ||
116 | BIO_puts(bio_err, "\n"); | ||
117 | } else | ||
118 | BIO_puts(bio_err, "<no cert>\n"); | ||
119 | if (!ok) | ||
120 | BIO_printf(bio_err, "verify error:num=%d:%s\n", | ||
121 | err, X509_verify_cert_error_string(err)); | ||
122 | switch (err) { | ||
123 | case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: | ||
124 | BIO_puts(bio_err, "issuer= "); | ||
125 | X509_NAME_print_ex(bio_err, | ||
126 | X509_get_issuer_name(err_cert), 0, | ||
127 | XN_FLAG_ONELINE); | ||
128 | BIO_puts(bio_err, "\n"); | ||
129 | break; | ||
130 | case X509_V_ERR_CERT_NOT_YET_VALID: | ||
131 | case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: | ||
132 | BIO_printf(bio_err, "notBefore="); | ||
133 | ASN1_TIME_print(bio_err, | ||
134 | X509_get_notBefore(err_cert)); | ||
135 | BIO_printf(bio_err, "\n"); | ||
136 | break; | ||
137 | case X509_V_ERR_CERT_HAS_EXPIRED: | ||
138 | case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: | ||
139 | BIO_printf(bio_err, "notAfter="); | ||
140 | ASN1_TIME_print(bio_err, X509_get_notAfter(err_cert)); | ||
141 | BIO_printf(bio_err, "\n"); | ||
142 | break; | ||
143 | case X509_V_ERR_NO_EXPLICIT_POLICY: | ||
144 | policies_print(bio_err, ctx); | ||
145 | break; | ||
146 | } | ||
147 | if (err == X509_V_OK && ok == 2) | ||
148 | /* print out policies */ | ||
149 | |||
150 | BIO_printf(bio_err,"verify return:%d\n",ok); | ||
151 | return(ok); | ||
152 | } | ||
153 | |||
154 | =head1 SEE ALSO | ||
155 | |||
156 | L<X509_STORE_CTX_get_error(3)|X509_STORE_CTX_get_error(3)> | ||
157 | L<X509_STORE_set_verify_cb_func(3)|X509_STORE_set_verify_cb_func(3)> | ||
158 | L<X509_STORE_CTX_get_ex_new_index(3)|X509_STORE_CTX_get_ex_new_index(3)> | ||
159 | |||
160 | =head1 HISTORY | ||
161 | |||
162 | X509_STORE_CTX_set_verify_cb() is available in all versions of SSLeay and | ||
163 | OpenSSL. | ||
164 | |||
165 | =cut | ||
diff --git a/src/lib/libcrypto/doc/X509_STORE_set_verify_cb_func.pod b/src/lib/libcrypto/doc/X509_STORE_set_verify_cb_func.pod deleted file mode 100644 index 754512341c..0000000000 --- a/src/lib/libcrypto/doc/X509_STORE_set_verify_cb_func.pod +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | X509_STORE_set_verify_cb_func, X509_STORE_set_verify_cb - set verification | ||
6 | callback | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/x509_vfy.h> | ||
11 | |||
12 | void X509_STORE_set_verify_cb(X509_STORE *st, | ||
13 | int (*verify_cb)(int ok, X509_STORE_CTX *ctx)); | ||
14 | |||
15 | void X509_STORE_set_verify_cb_func(X509_STORE *st, | ||
16 | int (*verify_cb)(int ok, X509_STORE_CTX *ctx)); | ||
17 | |||
18 | =head1 DESCRIPTION | ||
19 | |||
20 | X509_STORE_set_verify_cb() sets the verification callback of B<ctx> to | ||
21 | B<verify_cb> overwriting any existing callback. | ||
22 | |||
23 | X509_STORE_set_verify_cb_func() also sets the verification callback but it | ||
24 | is implemented as a macro. | ||
25 | |||
26 | =head1 NOTES | ||
27 | |||
28 | The verification callback from an B<X509_STORE> is inherited by | ||
29 | the corresponding B<X509_STORE_CTX> structure when it is initialized. This can | ||
30 | be used to set the verification callback when the B<X509_STORE_CTX> is | ||
31 | otherwise inaccessible (for example during S/MIME verification). | ||
32 | |||
33 | =head1 BUGS | ||
34 | |||
35 | The macro version of this function was the only one available before | ||
36 | OpenSSL 1.0.0. | ||
37 | |||
38 | =head1 RETURN VALUES | ||
39 | |||
40 | X509_STORE_set_verify_cb() and X509_STORE_set_verify_cb_func() do not return | ||
41 | a value. | ||
42 | |||
43 | =head1 SEE ALSO | ||
44 | |||
45 | L<X509_STORE_CTX_set_verify_cb(3)|X509_STORE_CTX_set_verify_cb(3)> | ||
46 | |||
47 | =head1 HISTORY | ||
48 | |||
49 | X509_STORE_set_verify_cb_func() is available in all versions of SSLeay and | ||
50 | OpenSSL. | ||
51 | |||
52 | X509_STORE_set_verify_cb() was added to OpenSSL 1.0.0. | ||
53 | |||
54 | =cut | ||
diff --git a/src/lib/libcrypto/doc/X509_VERIFY_PARAM_set_flags.pod b/src/lib/libcrypto/doc/X509_VERIFY_PARAM_set_flags.pod deleted file mode 100644 index 6c88aec49e..0000000000 --- a/src/lib/libcrypto/doc/X509_VERIFY_PARAM_set_flags.pod +++ /dev/null | |||
@@ -1,172 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | X509_VERIFY_PARAM_set_flags, X509_VERIFY_PARAM_clear_flags, | ||
6 | X509_VERIFY_PARAM_get_flags, X509_VERIFY_PARAM_set_purpose, | ||
7 | X509_VERIFY_PARAM_set_trust, X509_VERIFY_PARAM_set_depth, | ||
8 | X509_VERIFY_PARAM_get_depth, X509_VERIFY_PARAM_set_time, | ||
9 | X509_VERIFY_PARAM_add0_policy, X509_VERIFY_PARAM_set1_policies - X509 | ||
10 | verification parameters | ||
11 | |||
12 | =head1 SYNOPSIS | ||
13 | |||
14 | #include <openssl/x509_vfy.h> | ||
15 | |||
16 | int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags); | ||
17 | int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param, | ||
18 | unsigned long flags); | ||
19 | unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param); | ||
20 | |||
21 | int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose); | ||
22 | int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust); | ||
23 | |||
24 | void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t); | ||
25 | |||
26 | int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param, | ||
27 | ASN1_OBJECT *policy); | ||
28 | int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, | ||
29 | STACK_OF(ASN1_OBJECT) *policies); | ||
30 | |||
31 | void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth); | ||
32 | int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param); | ||
33 | |||
34 | =head1 DESCRIPTION | ||
35 | |||
36 | These functions manipulate the B<X509_VERIFY_PARAM> structure associated with | ||
37 | a certificate verification operation. | ||
38 | |||
39 | The X509_VERIFY_PARAM_set_flags() function sets the flags in B<param> by oring | ||
40 | it with B<flags>. See the B<VERIFICATION FLAGS> section for a complete | ||
41 | description of values the B<flags> parameter can take. | ||
42 | |||
43 | X509_VERIFY_PARAM_get_flags() returns the flags in B<param>. | ||
44 | |||
45 | X509_VERIFY_PARAM_clear_flags() clears the flags B<flags> in B<param>. | ||
46 | |||
47 | X509_VERIFY_PARAM_set_purpose() sets the verification purpose in B<param> | ||
48 | to B<purpose>. This determines the acceptable purpose of the certificate | ||
49 | chain, for example SSL client or SSL server. | ||
50 | |||
51 | X509_VERIFY_PARAM_set_trust() sets the trust setting in B<param> to | ||
52 | B<trust>. | ||
53 | |||
54 | X509_VERIFY_PARAM_set_time() sets the verification time in B<param> to | ||
55 | B<t>. Normally the current time is used. | ||
56 | |||
57 | X509_VERIFY_PARAM_add0_policy() enables policy checking (it is disabled | ||
58 | by default) and adds B<policy> to the acceptable policy set. | ||
59 | |||
60 | X509_VERIFY_PARAM_set1_policies() enables policy checking (it is disabled | ||
61 | by default) and sets the acceptable policy set to B<policies>. Any existing | ||
62 | policy set is cleared. The B<policies> parameter can be B<NULL> to clear | ||
63 | an existing policy set. | ||
64 | |||
65 | X509_VERIFY_PARAM_set_depth() sets the maximum verification depth to B<depth>. | ||
66 | That is the maximum number of untrusted CA certificates that can appear in a | ||
67 | chain. | ||
68 | |||
69 | =head1 RETURN VALUES | ||
70 | |||
71 | X509_VERIFY_PARAM_set_flags(), X509_VERIFY_PARAM_clear_flags(), | ||
72 | X509_VERIFY_PARAM_set_purpose(), X509_VERIFY_PARAM_set_trust(), | ||
73 | X509_VERIFY_PARAM_add0_policy() and X509_VERIFY_PARAM_set1_policies() return 1 | ||
74 | for success and 0 for failure. | ||
75 | |||
76 | X509_VERIFY_PARAM_get_flags() returns the current verification flags. | ||
77 | |||
78 | X509_VERIFY_PARAM_set_time() and X509_VERIFY_PARAM_set_depth() do not return | ||
79 | values. | ||
80 | |||
81 | X509_VERIFY_PARAM_get_depth() returns the current verification depth. | ||
82 | |||
83 | =head1 VERIFICATION FLAGS | ||
84 | |||
85 | The verification flags consists of zero or more of the following flags | ||
86 | ored together. | ||
87 | |||
88 | B<X509_V_FLAG_CRL_CHECK> enables CRL checking for the certificate chain leaf | ||
89 | certificate. An error occurs if a suitable CRL cannot be found. | ||
90 | |||
91 | B<X509_V_FLAG_CRL_CHECK_ALL> enables CRL checking for the entire certificate | ||
92 | chain. | ||
93 | |||
94 | B<X509_V_FLAG_IGNORE_CRITICAL> disabled critical extension checking. By default | ||
95 | any unhandled critical extensions in certificates or (if checked) CRLs results | ||
96 | in a fatal error. If this flag is set unhandled critical extensions are | ||
97 | ignored. B<WARNING> setting this option for anything other than debugging | ||
98 | purposes can be a security risk. Finer control over which extensions are | ||
99 | supported can be performed in the verification callback. | ||
100 | |||
101 | THe B<X509_V_FLAG_X509_STRICT> flag disables workarounds for some broken | ||
102 | certificates and makes the verification strictly apply B<X509> rules. | ||
103 | |||
104 | B<X509_V_FLAG_ALLOW_PROXY_CERTS> enables proxy certificate verification. | ||
105 | |||
106 | B<X509_V_FLAG_POLICY_CHECK> enables certificate policy checking, by default | ||
107 | no policy checking is performed. Additional information is sent to the | ||
108 | verification callback relating to policy checking. | ||
109 | |||
110 | B<X509_V_FLAG_EXPLICIT_POLICY>, B<X509_V_FLAG_INHIBIT_ANY> and | ||
111 | B<X509_V_FLAG_INHIBIT_MAP> set the B<require explicit policy>, B<inhibit any | ||
112 | policy> and B<inhibit policy mapping> flags respectively as defined in | ||
113 | B<RFC3280>. Policy checking is automatically enabled if any of these flags | ||
114 | are set. | ||
115 | |||
116 | If B<X509_V_FLAG_NOTIFY_POLICY> is set and the policy checking is successful | ||
117 | a special status code is set to the verification callback. This permits it | ||
118 | to examine the valid policy tree and perform additional checks or simply | ||
119 | log it for debugging purposes. | ||
120 | |||
121 | By default some additional features such as indirect CRLs and CRLs signed by | ||
122 | different keys are disabled. If B<X509_V_FLAG_EXTENDED_CRL_SUPPORT> is set | ||
123 | they are enabled. | ||
124 | |||
125 | If B<X509_V_FLAG_USE_DELTAS> ise set delta CRLs (if present) are used to | ||
126 | determine certificate status. If not set deltas are ignored. | ||
127 | |||
128 | B<X509_V_FLAG_CHECK_SS_SIGNATURE> enables checking of the root CA self signed | ||
129 | certificate signature. By default this check is disabled because it doesn't | ||
130 | add any additional security but in some cases applications might want to | ||
131 | check the signature anyway. A side effect of not checking the root CA | ||
132 | signature is that disabled or unsupported message digests on the root CA | ||
133 | are not treated as fatal errors. | ||
134 | |||
135 | The B<X509_V_FLAG_CB_ISSUER_CHECK> flag enables debugging of certificate | ||
136 | issuer checks. It is B<not> needed unless you are logging certificate | ||
137 | verification. If this flag is set then additional status codes will be sent | ||
138 | to the verification callback and it B<must> be prepared to handle such cases | ||
139 | without assuming they are hard errors. | ||
140 | |||
141 | =head1 NOTES | ||
142 | |||
143 | The above functions should be used to manipulate verification parameters | ||
144 | instead of legacy functions which work in specific structures such as | ||
145 | X509_STORE_CTX_set_flags(). | ||
146 | |||
147 | =head1 BUGS | ||
148 | |||
149 | Delta CRL checking is currently primitive. Only a single delta can be used and | ||
150 | (partly due to limitations of B<X509_STORE>) constructed CRLs are not | ||
151 | maintained. | ||
152 | |||
153 | If CRLs checking is enable CRLs are expected to be available in the | ||
154 | corresponding B<X509_STORE> structure. No attempt is made to download | ||
155 | CRLs from the CRL distribution points extension. | ||
156 | |||
157 | =head1 EXAMPLE | ||
158 | |||
159 | Enable CRL checking when performing certificate verification during SSL | ||
160 | connections associated with an B<SSL_CTX> structure B<ctx>: | ||
161 | |||
162 | X509_VERIFY_PARAM *param; | ||
163 | param = X509_VERIFY_PARAM_new(); | ||
164 | X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK); | ||
165 | SSL_CTX_set1_param(ctx, param); | ||
166 | X509_VERIFY_PARAM_free(param); | ||
167 | |||
168 | =head1 SEE ALSO | ||
169 | |||
170 | L<X509_verify_cert(3)|X509_verify_cert(3)> | ||
171 | |||
172 | =cut | ||
diff --git a/src/lib/libcrypto/doc/X509_new.pod b/src/lib/libcrypto/doc/X509_new.pod deleted file mode 100644 index a36808b825..0000000000 --- a/src/lib/libcrypto/doc/X509_new.pod +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | X509_new, X509_free - X509 certificate ASN1 allocation functions | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/x509.h> | ||
10 | |||
11 | X509 *X509_new(void); | ||
12 | void X509_free(X509 *a); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | The X509 ASN1 allocation routines, allocate and free an | ||
17 | X509 structure, which represents an X509 certificate. | ||
18 | |||
19 | X509_new() allocates and initializes a X509 structure. | ||
20 | |||
21 | X509_free() frees up the B<X509> structure B<a>. | ||
22 | If B<a> is a B<NULL> pointer, no action occurs. | ||
23 | |||
24 | =head1 RETURN VALUES | ||
25 | |||
26 | If the allocation fails, X509_new() returns B<NULL> and sets an error | ||
27 | code that can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
28 | Otherwise it returns a pointer to the newly allocated structure. | ||
29 | |||
30 | =head1 SEE ALSO | ||
31 | |||
32 | L<ERR_get_error(3)|ERR_get_error(3)>, L<d2i_X509(3)|d2i_X509(3)> | ||
33 | |||
34 | =head1 HISTORY | ||
35 | |||
36 | X509_new() and X509_free() are available in all versions of SSLeay and OpenSSL. | ||
37 | |||
38 | =cut | ||
diff --git a/src/lib/libcrypto/doc/X509_verify_cert.pod b/src/lib/libcrypto/doc/X509_verify_cert.pod deleted file mode 100644 index f05edd8333..0000000000 --- a/src/lib/libcrypto/doc/X509_verify_cert.pod +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | X509_verify_cert - discover and verify X509 certificate chain | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/x509.h> | ||
10 | |||
11 | int X509_verify_cert(X509_STORE_CTX *ctx); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | The X509_verify_cert() function attempts to discover and validate a | ||
16 | certificate chain based on parameters in B<ctx>. A complete description of | ||
17 | the process is contained in the L<verify(1)|verify(1)> manual page. | ||
18 | |||
19 | =head1 RETURN VALUES | ||
20 | |||
21 | If a complete chain can be built and validated this function returns 1, | ||
22 | otherwise it return zero, in exceptional circumstances it can also | ||
23 | return a negative code. | ||
24 | |||
25 | If the function fails additional error information can be obtained by | ||
26 | examining B<ctx> using, for example X509_STORE_CTX_get_error(). | ||
27 | |||
28 | =head1 NOTES | ||
29 | |||
30 | Applications rarely call this function directly but it is used by | ||
31 | OpenSSL internally for certificate validation, in both the S/MIME and | ||
32 | SSL/TLS code. | ||
33 | |||
34 | The negative return value from X509_verify_cert() can only occur if no | ||
35 | certificate is set in B<ctx> (due to a programming error) or if a retry | ||
36 | operation is requested during internal lookups (which never happens with | ||
37 | standard lookup methods). It is however recommended that application check | ||
38 | for <= 0 return value on error. | ||
39 | |||
40 | =head1 BUGS | ||
41 | |||
42 | This function uses the header B<x509.h> as opposed to most chain verification | ||
43 | functions which use B<x509_vfy.h>. | ||
44 | |||
45 | =head1 SEE ALSO | ||
46 | |||
47 | L<X509_STORE_CTX_get_error(3)|X509_STORE_CTX_get_error(3)> | ||
48 | |||
49 | =head1 HISTORY | ||
50 | |||
51 | X509_verify_cert() is available in all versions of SSLeay and OpenSSL. | ||
52 | |||
53 | =cut | ||
diff --git a/src/lib/libcrypto/doc/d2i_X509.pod b/src/lib/libcrypto/doc/d2i_X509.pod deleted file mode 100644 index fad4e8c35b..0000000000 --- a/src/lib/libcrypto/doc/d2i_X509.pod +++ /dev/null | |||
@@ -1,231 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | d2i_X509, i2d_X509, d2i_X509_bio, d2i_X509_fp, i2d_X509_bio, | ||
6 | i2d_X509_fp - X509 encode and decode functions | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/x509.h> | ||
11 | |||
12 | X509 *d2i_X509(X509 **px, const unsigned char **in, int len); | ||
13 | int i2d_X509(X509 *x, unsigned char **out); | ||
14 | |||
15 | X509 *d2i_X509_bio(BIO *bp, X509 **x); | ||
16 | X509 *d2i_X509_fp(FILE *fp, X509 **x); | ||
17 | |||
18 | int i2d_X509_bio(BIO *bp, X509 *x); | ||
19 | int i2d_X509_fp(FILE *fp, X509 *x); | ||
20 | |||
21 | =head1 DESCRIPTION | ||
22 | |||
23 | The X509 encode and decode routines encode and parse an | ||
24 | B<X509> structure, which represents an X509 certificate. | ||
25 | |||
26 | d2i_X509() attempts to decode B<len> bytes at B<*in>. If | ||
27 | successful a pointer to the B<X509> structure is returned. If an error | ||
28 | occurred then B<NULL> is returned. If B<px> is not B<NULL> then the | ||
29 | returned structure is written to B<*px>. If B<*px> is not B<NULL> | ||
30 | then it is assumed that B<*px> contains a valid B<X509> | ||
31 | structure and an attempt is made to reuse it. If the call is | ||
32 | successful B<*in> is incremented to the byte following the | ||
33 | parsed data. | ||
34 | |||
35 | i2d_X509() encodes the structure pointed to by B<x> into DER format. | ||
36 | If B<out> is not B<NULL> is writes the DER encoded data to the buffer | ||
37 | at B<*out>, and increments it to point after the data just written. | ||
38 | If the return value is negative an error occurred, otherwise it | ||
39 | returns the length of the encoded data. | ||
40 | |||
41 | For OpenSSL 0.9.7 and later if B<*out> is B<NULL> memory will be | ||
42 | allocated for a buffer and the encoded data written to it. In this | ||
43 | case B<*out> is not incremented and it points to the start of the | ||
44 | data just written. | ||
45 | |||
46 | d2i_X509_bio() is similar to d2i_X509() except it attempts | ||
47 | to parse data from BIO B<bp>. | ||
48 | |||
49 | d2i_X509_fp() is similar to d2i_X509() except it attempts | ||
50 | to parse data from FILE pointer B<fp>. | ||
51 | |||
52 | i2d_X509_bio() is similar to i2d_X509() except it writes | ||
53 | the encoding of the structure B<x> to BIO B<bp> and it | ||
54 | returns 1 for success and 0 for failure. | ||
55 | |||
56 | i2d_X509_fp() is similar to i2d_X509() except it writes | ||
57 | the encoding of the structure B<x> to BIO B<bp> and it | ||
58 | returns 1 for success and 0 for failure. | ||
59 | |||
60 | =head1 NOTES | ||
61 | |||
62 | The letters B<i> and B<d> in for example B<i2d_X509> stand for | ||
63 | "internal" (that is an internal C structure) and "DER". So that | ||
64 | B<i2d_X509> converts from internal to DER. | ||
65 | |||
66 | The functions can also understand B<BER> forms. | ||
67 | |||
68 | The actual X509 structure passed to i2d_X509() must be a valid | ||
69 | populated B<X509> structure it can B<not> simply be fed with an | ||
70 | empty structure such as that returned by X509_new(). | ||
71 | |||
72 | The encoded data is in binary form and may contain embedded zeroes. | ||
73 | Therefore any FILE pointers or BIOs should be opened in binary mode. | ||
74 | Functions such as B<strlen()> will B<not> return the correct length | ||
75 | of the encoded structure. | ||
76 | |||
77 | The ways that B<*in> and B<*out> are incremented after the operation | ||
78 | can trap the unwary. See the B<WARNINGS> section for some common | ||
79 | errors. | ||
80 | |||
81 | The reason for the auto increment behaviour is to reflect a typical | ||
82 | usage of ASN1 functions: after one structure is encoded or decoded | ||
83 | another will processed after it. | ||
84 | |||
85 | =head1 EXAMPLES | ||
86 | |||
87 | Allocate and encode the DER encoding of an X509 structure: | ||
88 | |||
89 | int len; | ||
90 | unsigned char *buf, *p; | ||
91 | |||
92 | len = i2d_X509(x, NULL); | ||
93 | |||
94 | buf = malloc(len); | ||
95 | |||
96 | if (buf == NULL) | ||
97 | /* error */ | ||
98 | |||
99 | p = buf; | ||
100 | |||
101 | i2d_X509(x, &p); | ||
102 | |||
103 | If you are using OpenSSL 0.9.7 or later then this can be | ||
104 | simplified to: | ||
105 | |||
106 | |||
107 | int len; | ||
108 | unsigned char *buf; | ||
109 | |||
110 | buf = NULL; | ||
111 | |||
112 | len = i2d_X509(x, &buf); | ||
113 | |||
114 | if (len < 0) | ||
115 | /* error */ | ||
116 | |||
117 | Attempt to decode a buffer: | ||
118 | |||
119 | X509 *x; | ||
120 | |||
121 | unsigned char *buf, *p; | ||
122 | |||
123 | int len; | ||
124 | |||
125 | /* Something to setup buf and len */ | ||
126 | |||
127 | p = buf; | ||
128 | |||
129 | x = d2i_X509(NULL, &p, len); | ||
130 | |||
131 | if (x == NULL) | ||
132 | /* Some error */ | ||
133 | |||
134 | Alternative technique: | ||
135 | |||
136 | X509 *x; | ||
137 | |||
138 | unsigned char *buf, *p; | ||
139 | |||
140 | int len; | ||
141 | |||
142 | /* Something to setup buf and len */ | ||
143 | |||
144 | p = buf; | ||
145 | |||
146 | x = NULL; | ||
147 | |||
148 | if(!d2i_X509(&x, &p, len)) | ||
149 | /* Some error */ | ||
150 | |||
151 | |||
152 | =head1 WARNINGS | ||
153 | |||
154 | The use of temporary variable is mandatory. A common | ||
155 | mistake is to attempt to use a buffer directly as follows: | ||
156 | |||
157 | int len; | ||
158 | unsigned char *buf; | ||
159 | |||
160 | len = i2d_X509(x, NULL); | ||
161 | |||
162 | buf = malloc(len); | ||
163 | |||
164 | if (buf == NULL) | ||
165 | /* error */ | ||
166 | |||
167 | i2d_X509(x, &buf); | ||
168 | |||
169 | /* Other stuff ... */ | ||
170 | |||
171 | free(buf); | ||
172 | |||
173 | This code will result in B<buf> apparently containing garbage because | ||
174 | it was incremented after the call to point after the data just written. | ||
175 | Also B<buf> will no longer contain the pointer allocated by B<malloc()> | ||
176 | and the subsequent call to B<free()> may well crash. | ||
177 | |||
178 | The auto allocation feature (setting buf to NULL) only works on OpenSSL | ||
179 | 0.9.7 and later. Attempts to use it on earlier versions will typically | ||
180 | cause a segmentation violation. | ||
181 | |||
182 | Another trap to avoid is misuse of the B<xp> argument to B<d2i_X509()>: | ||
183 | |||
184 | X509 *x; | ||
185 | |||
186 | if (!d2i_X509(&x, &p, len)) | ||
187 | /* Some error */ | ||
188 | |||
189 | This will probably crash somewhere in B<d2i_X509()>. The reason for this | ||
190 | is that the variable B<x> is uninitialized and an attempt will be made to | ||
191 | interpret its (invalid) value as an B<X509> structure, typically causing | ||
192 | a segmentation violation. If B<x> is set to NULL first then this will not | ||
193 | happen. | ||
194 | |||
195 | =head1 BUGS | ||
196 | |||
197 | In some versions of OpenSSL the "reuse" behaviour of d2i_X509() when | ||
198 | B<*px> is valid is broken and some parts of the reused structure may | ||
199 | persist if they are not present in the new one. As a result the use | ||
200 | of this "reuse" behaviour is strongly discouraged. | ||
201 | |||
202 | i2d_X509() will not return an error in many versions of OpenSSL, | ||
203 | if mandatory fields are not initialized due to a programming error | ||
204 | then the encoded structure may contain invalid data or omit the | ||
205 | fields entirely and will not be parsed by d2i_X509(). This may be | ||
206 | fixed in future so code should not assume that i2d_X509() will | ||
207 | always succeed. | ||
208 | |||
209 | =head1 RETURN VALUES | ||
210 | |||
211 | d2i_X509(), d2i_X509_bio() and d2i_X509_fp() return a valid B<X509> structure | ||
212 | or B<NULL> if an error occurs. The error code that can be obtained by | ||
213 | L<ERR_get_error(3)|ERR_get_error(3)>. | ||
214 | |||
215 | i2d_X509() returns the number of bytes successfully encoded or a negative | ||
216 | value if an error occurs. The error code can be obtained by | ||
217 | L<ERR_get_error(3)|ERR_get_error(3)>. | ||
218 | |||
219 | i2d_X509_bio() and i2d_X509_fp() return 1 for success and 0 if an error | ||
220 | occurs The error code can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
221 | |||
222 | =head1 SEE ALSO | ||
223 | |||
224 | L<ERR_get_error(3)|ERR_get_error(3)> | ||
225 | |||
226 | =head1 HISTORY | ||
227 | |||
228 | d2i_X509, i2d_X509, d2i_X509_bio, d2i_X509_fp, i2d_X509_bio and i2d_X509_fp | ||
229 | are available in all versions of SSLeay and OpenSSL. | ||
230 | |||
231 | =cut | ||
diff --git a/src/lib/libcrypto/doc/d2i_X509_ALGOR.pod b/src/lib/libcrypto/doc/d2i_X509_ALGOR.pod deleted file mode 100644 index 68011679fd..0000000000 --- a/src/lib/libcrypto/doc/d2i_X509_ALGOR.pod +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | d2i_X509_ALGOR, i2d_X509_ALGOR - AlgorithmIdentifier functions. | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/x509.h> | ||
10 | |||
11 | X509_ALGOR *d2i_X509_ALGOR(X509_ALGOR **a, unsigned char **pp, long length); | ||
12 | int i2d_X509_ALGOR(X509_ALGOR *a, unsigned char **pp); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | These functions decode and encode an B<X509_ALGOR> structure which is | ||
17 | equivalent to the B<AlgorithmIdentifier> structure. | ||
18 | |||
19 | Othewise these behave in a similar way to d2i_X509() and i2d_X509() | ||
20 | described in the L<d2i_X509(3)|d2i_X509(3)> manual page. | ||
21 | |||
22 | =head1 SEE ALSO | ||
23 | |||
24 | L<d2i_X509(3)|d2i_X509(3)> | ||
25 | |||
26 | =cut | ||
diff --git a/src/lib/libcrypto/doc/d2i_X509_CRL.pod b/src/lib/libcrypto/doc/d2i_X509_CRL.pod deleted file mode 100644 index 563e4de8e0..0000000000 --- a/src/lib/libcrypto/doc/d2i_X509_CRL.pod +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | d2i_X509_CRL, i2d_X509_CRL, d2i_X509_CRL_bio, d2i_X509_CRL_fp, | ||
6 | i2d_X509_CRL_bio, i2d_X509_CRL_fp - PKCS#10 certificate request functions. | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/x509.h> | ||
11 | |||
12 | X509_CRL *d2i_X509_CRL(X509_CRL **a, const unsigned char **pp, long length); | ||
13 | int i2d_X509_CRL(X509_CRL *a, unsigned char **pp); | ||
14 | |||
15 | X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **x); | ||
16 | X509_CRL *d2i_X509_CRL_fp(FILE *fp, X509_CRL **x); | ||
17 | |||
18 | int i2d_X509_CRL_bio(BIO *bp, X509_CRL *x); | ||
19 | int i2d_X509_CRL_fp(FILE *fp, X509_CRL *x); | ||
20 | |||
21 | =head1 DESCRIPTION | ||
22 | |||
23 | These functions decode and encode an X509 CRL (certificate revocation | ||
24 | list). | ||
25 | |||
26 | Othewise the functions behave in a similar way to d2i_X509() and i2d_X509() | ||
27 | described in the L<d2i_X509(3)|d2i_X509(3)> manual page. | ||
28 | |||
29 | =head1 SEE ALSO | ||
30 | |||
31 | L<d2i_X509(3)|d2i_X509(3)> | ||
32 | |||
33 | =cut | ||
diff --git a/src/lib/libcrypto/doc/d2i_X509_NAME.pod b/src/lib/libcrypto/doc/d2i_X509_NAME.pod deleted file mode 100644 index 2219885338..0000000000 --- a/src/lib/libcrypto/doc/d2i_X509_NAME.pod +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | d2i_X509_NAME, i2d_X509_NAME - X509_NAME encoding functions | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/x509.h> | ||
10 | |||
11 | X509_NAME *d2i_X509_NAME(X509_NAME **a, unsigned char **pp, long length); | ||
12 | int i2d_X509_NAME(X509_NAME *a, unsigned char **pp); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | These functions decode and encode an B<X509_NAME> structure which is the | ||
17 | same as the B<Name> type defined in RFC2459 (and elsewhere) and used | ||
18 | for example in certificate subject and issuer names. | ||
19 | |||
20 | Othewise the functions behave in a similar way to d2i_X509() and i2d_X509() | ||
21 | described in the L<d2i_X509(3)|d2i_X509(3)> manual page. | ||
22 | |||
23 | =head1 SEE ALSO | ||
24 | |||
25 | L<d2i_X509(3)|d2i_X509(3)> | ||
26 | |||
27 | =cut | ||
diff --git a/src/lib/libcrypto/doc/d2i_X509_REQ.pod b/src/lib/libcrypto/doc/d2i_X509_REQ.pod deleted file mode 100644 index baa8ae391e..0000000000 --- a/src/lib/libcrypto/doc/d2i_X509_REQ.pod +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | d2i_X509_REQ, i2d_X509_REQ, d2i_X509_REQ_bio, d2i_X509_REQ_fp, | ||
6 | i2d_X509_REQ_bio, i2d_X509_REQ_fp - PKCS#10 certificate request functions. | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/x509.h> | ||
11 | |||
12 | X509_REQ *d2i_X509_REQ(X509_REQ **a, const unsigned char **pp, long length); | ||
13 | int i2d_X509_REQ(X509_REQ *a, unsigned char **pp); | ||
14 | |||
15 | X509_REQ *d2i_X509_REQ_bio(BIO *bp, X509_REQ **x); | ||
16 | X509_REQ *d2i_X509_REQ_fp(FILE *fp, X509_REQ **x); | ||
17 | |||
18 | int i2d_X509_REQ_bio(BIO *bp, X509_REQ *x); | ||
19 | int i2d_X509_REQ_fp(FILE *fp, X509_REQ *x); | ||
20 | |||
21 | =head1 DESCRIPTION | ||
22 | |||
23 | These functions decode and encode a PKCS#10 certificate request. | ||
24 | |||
25 | Othewise these behave in a similar way to d2i_X509() and i2d_X509() | ||
26 | described in the L<d2i_X509(3)|d2i_X509(3)> manual page. | ||
27 | |||
28 | =head1 SEE ALSO | ||
29 | |||
30 | L<d2i_X509(3)|d2i_X509(3)> | ||
31 | |||
32 | =cut | ||
diff --git a/src/lib/libcrypto/doc/d2i_X509_SIG.pod b/src/lib/libcrypto/doc/d2i_X509_SIG.pod deleted file mode 100644 index 00d03f5ba1..0000000000 --- a/src/lib/libcrypto/doc/d2i_X509_SIG.pod +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | d2i_X509_SIG, i2d_X509_SIG - DigestInfo functions. | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/x509.h> | ||
10 | |||
11 | X509_SIG *d2i_X509_SIG(X509_SIG **a, unsigned char **pp, long length); | ||
12 | int i2d_X509_SIG(X509_SIG *a, unsigned char **pp); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | These functions decode and encode an X509_SIG structure which is | ||
17 | equivalent to the B<DigestInfo> structure defined in PKCS#1 and PKCS#7. | ||
18 | |||
19 | Othewise these behave in a similar way to d2i_X509() and i2d_X509() | ||
20 | described in the L<d2i_X509(3)|d2i_X509(3)> manual page. | ||
21 | |||
22 | =head1 SEE ALSO | ||
23 | |||
24 | L<d2i_X509(3)|d2i_X509(3)> | ||
25 | |||
26 | =cut | ||
diff --git a/src/lib/libcrypto/doc/x509.pod b/src/lib/libcrypto/doc/x509.pod deleted file mode 100644 index f9e58e0e41..0000000000 --- a/src/lib/libcrypto/doc/x509.pod +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | x509 - X.509 certificate handling | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/x509.h> | ||
10 | |||
11 | =head1 DESCRIPTION | ||
12 | |||
13 | A X.509 certificate is a structured grouping of information about | ||
14 | an individual, a device, or anything one can imagine. A X.509 CRL | ||
15 | (certificate revocation list) is a tool to help determine if a | ||
16 | certificate is still valid. The exact definition of those can be | ||
17 | found in the X.509 document from ITU-T, or in RFC3280 from PKIX. | ||
18 | In OpenSSL, the type X509 is used to express such a certificate, and | ||
19 | the type X509_CRL is used to express a CRL. | ||
20 | |||
21 | A related structure is a certificate request, defined in PKCS#10 from | ||
22 | RSA Security, Inc, also reflected in RFC2896. In OpenSSL, the type | ||
23 | X509_REQ is used to express such a certificate request. | ||
24 | |||
25 | To handle some complex parts of a certificate, there are the types | ||
26 | X509_NAME (to express a certificate name), X509_ATTRIBUTE (to express | ||
27 | a certificate attributes), X509_EXTENSION (to express a certificate | ||
28 | extension) and a few more. | ||
29 | |||
30 | Finally, there's the supertype X509_INFO, which can contain a CRL, a | ||
31 | certificate and a corresponding private key. | ||
32 | |||
33 | B<X509_>I<...>, B<d2i_X509_>I<...> and B<i2d_X509_>I<...> handle X.509 | ||
34 | certificates, with some exceptions, shown below. | ||
35 | |||
36 | B<X509_CRL_>I<...>, B<d2i_X509_CRL_>I<...> and B<i2d_X509_CRL_>I<...> | ||
37 | handle X.509 CRLs. | ||
38 | |||
39 | B<X509_REQ_>I<...>, B<d2i_X509_REQ_>I<...> and B<i2d_X509_REQ_>I<...> | ||
40 | handle PKCS#10 certificate requests. | ||
41 | |||
42 | B<X509_NAME_>I<...> handle certificate names. | ||
43 | |||
44 | B<X509_ATTRIBUTE_>I<...> handle certificate attributes. | ||
45 | |||
46 | B<X509_EXTENSION_>I<...> handle certificate extensions. | ||
47 | |||
48 | =head1 SEE ALSO | ||
49 | |||
50 | L<X509_NAME_ENTRY_get_object(3)|X509_NAME_ENTRY_get_object(3)>, | ||
51 | L<X509_NAME_add_entry_by_txt(3)|X509_NAME_add_entry_by_txt(3)>, | ||
52 | L<X509_NAME_add_entry_by_NID(3)|X509_NAME_add_entry_by_NID(3)>, | ||
53 | L<X509_NAME_print_ex(3)|X509_NAME_print_ex(3)>, | ||
54 | L<X509_NAME_new(3)|X509_NAME_new(3)>, | ||
55 | L<d2i_X509(3)|d2i_X509(3)>, | ||
56 | L<d2i_X509_ALGOR(3)|d2i_X509_ALGOR(3)>, | ||
57 | L<d2i_X509_CRL(3)|d2i_X509_CRL(3)>, | ||
58 | L<d2i_X509_NAME(3)|d2i_X509_NAME(3)>, | ||
59 | L<d2i_X509_REQ(3)|d2i_X509_REQ(3)>, | ||
60 | L<d2i_X509_SIG(3)|d2i_X509_SIG(3)>, | ||
61 | L<crypto(3)|crypto(3)>, | ||
62 | L<x509v3(3)|x509v3(3)> | ||
63 | |||
64 | =cut | ||
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index 8bc8ffb6aa..a76a03c78a 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.45 2016/11/04 10:17:17 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.46 2016/11/04 15:29:03 schwarze Exp $ |
2 | 2 | ||
3 | .include <bsd.own.mk> # for NOMAN | 3 | .include <bsd.own.mk> # for NOMAN |
4 | 4 | ||
@@ -153,49 +153,49 @@ MAN= \ | |||
153 | SMIME_read_PKCS7.3 \ | 153 | SMIME_read_PKCS7.3 \ |
154 | SMIME_write_PKCS7.3 \ | 154 | SMIME_write_PKCS7.3 \ |
155 | UI_new.3 \ | 155 | UI_new.3 \ |
156 | X509_NAME_ENTRY_get_object.3 \ | ||
157 | X509_NAME_add_entry_by_txt.3 \ | ||
158 | X509_NAME_get_index_by_NID.3 \ | ||
159 | X509_NAME_print_ex.3 \ | ||
160 | X509_STORE_CTX_get_error.3 \ | ||
161 | X509_STORE_CTX_get_ex_new_index.3 \ | ||
162 | X509_STORE_CTX_new.3 \ | ||
163 | X509_STORE_CTX_set_verify_cb.3 \ | ||
164 | X509_STORE_set_verify_cb_func.3 \ | ||
165 | X509_VERIFY_PARAM_set_flags.3 \ | ||
166 | X509_new.3 \ | ||
167 | X509_verify_cert.3 \ | ||
156 | bn_dump.3 \ | 168 | bn_dump.3 \ |
157 | crypto.3 \ | 169 | crypto.3 \ |
158 | d2i_ASN1_OBJECT.3 \ | 170 | d2i_ASN1_OBJECT.3 \ |
159 | d2i_PKCS8PrivateKey_bio.3 \ | 171 | d2i_PKCS8PrivateKey_bio.3 \ |
160 | d2i_RSAPublicKey.3 \ | 172 | d2i_RSAPublicKey.3 \ |
173 | d2i_X509.3 \ | ||
174 | d2i_X509_ALGOR.3 \ | ||
175 | d2i_X509_CRL.3 \ | ||
176 | d2i_X509_NAME.3 \ | ||
177 | d2i_X509_REQ.3 \ | ||
178 | d2i_X509_SIG.3 \ | ||
161 | des_read_pw.3 \ | 179 | des_read_pw.3 \ |
162 | evp.3 \ | 180 | evp.3 \ |
163 | i2d_PKCS7_bio_stream.3 \ | 181 | i2d_PKCS7_bio_stream.3 \ |
164 | lh_new.3 \ | 182 | lh_new.3 \ |
165 | rsa.3 \ | 183 | rsa.3 \ |
184 | x509.3 | ||
166 | 185 | ||
167 | GENMAN= \ | 186 | GENMAN= \ |
168 | RC4.3 \ | 187 | RC4.3 \ |
169 | RIPEMD160.3 \ | 188 | RIPEMD160.3 \ |
170 | SHA1.3 \ | 189 | SHA1.3 \ |
171 | X509_NAME_ENTRY_get_object.3 \ | ||
172 | X509_NAME_add_entry_by_txt.3 \ | ||
173 | X509_NAME_get_index_by_NID.3 \ | ||
174 | X509_NAME_print_ex.3 \ | ||
175 | X509_STORE_CTX_get_error.3 \ | ||
176 | X509_STORE_CTX_get_ex_new_index.3 \ | ||
177 | X509_STORE_CTX_new.3 \ | ||
178 | X509_STORE_CTX_set_verify_cb.3 \ | ||
179 | X509_STORE_set_verify_cb_func.3 \ | ||
180 | X509_VERIFY_PARAM_set_flags.3 \ | ||
181 | X509_new.3 \ | ||
182 | X509_verify_cert.3 \ | ||
183 | bn.3 \ | 190 | bn.3 \ |
184 | d2i_DHparams.3 \ | 191 | d2i_DHparams.3 \ |
185 | d2i_DSAPublicKey.3 \ | 192 | d2i_DSAPublicKey.3 \ |
186 | d2i_ECPKParameters.3 \ | 193 | d2i_ECPKParameters.3 \ |
187 | d2i_X509.3 \ | ||
188 | d2i_X509_ALGOR.3 \ | ||
189 | d2i_X509_CRL.3 \ | ||
190 | d2i_X509_NAME.3 \ | ||
191 | d2i_X509_REQ.3 \ | ||
192 | d2i_X509_SIG.3 \ | ||
193 | dh.3 \ | 194 | dh.3 \ |
194 | dsa.3 \ | 195 | dsa.3 \ |
195 | ec.3 \ | 196 | ec.3 \ |
196 | engine.3 \ | 197 | engine.3 \ |
197 | lh_stats.3 \ | 198 | lh_stats.3 \ |
198 | x509.3 \ | ||
199 | 199 | ||
200 | MAN+= ${GENMAN} | 200 | MAN+= ${GENMAN} |
201 | 201 | ||
diff --git a/src/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 b/src/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 new file mode 100644 index 0000000000..97978ea542 --- /dev/null +++ b/src/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 | |||
@@ -0,0 +1,133 @@ | |||
1 | .Dd $Mdocdate: November 4 2016 $ | ||
2 | .Dt X509_NAME_ENTRY_GET_OBJECT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm X509_NAME_ENTRY_get_object , | ||
6 | .Nm X509_NAME_ENTRY_get_data , | ||
7 | .Nm X509_NAME_ENTRY_set_object , | ||
8 | .Nm X509_NAME_ENTRY_set_data , | ||
9 | .Nm X509_NAME_ENTRY_create_by_txt , | ||
10 | .Nm X509_NAME_ENTRY_create_by_NID , | ||
11 | .Nm X509_NAME_ENTRY_create_by_OBJ | ||
12 | .Nd X509_NAME_ENTRY utility functions | ||
13 | .Sh SYNOPSIS | ||
14 | .In openssl/x509.h | ||
15 | .Ft ASN1_OBJECT * | ||
16 | .Fo X509_NAME_ENTRY_get_object | ||
17 | .Fa "X509_NAME_ENTRY *ne" | ||
18 | .Fc | ||
19 | .Ft ASN1_STRING * | ||
20 | .Fo X509_NAME_ENTRY_get_data | ||
21 | .Fa "X509_NAME_ENTRY *ne" | ||
22 | .Fc | ||
23 | .Ft int | ||
24 | .Fo X509_NAME_ENTRY_set_object | ||
25 | .Fa "X509_NAME_ENTRY *ne" | ||
26 | .Fa "ASN1_OBJECT *obj" | ||
27 | .Fc | ||
28 | .Ft int | ||
29 | .Fo X509_NAME_ENTRY_set_data | ||
30 | .Fa "X509_NAME_ENTRY *ne" | ||
31 | .Fa "int type" | ||
32 | .Fa "const unsigned char *bytes" | ||
33 | .Fa "int len" | ||
34 | .Fc | ||
35 | .Ft X509_NAME_ENTRY * | ||
36 | .Fo X509_NAME_ENTRY_create_by_txt | ||
37 | .Fa "X509_NAME_ENTRY **ne" | ||
38 | .Fa "const char *field" | ||
39 | .Fa "int type" | ||
40 | .Fa "const unsigned char *bytes" | ||
41 | .Fa "int len" | ||
42 | .Fc | ||
43 | .Ft X509_NAME_ENTRY * | ||
44 | .Fo X509_NAME_ENTRY_create_by_NID | ||
45 | .Fa "X509_NAME_ENTRY **ne" | ||
46 | .Fa "int nid" | ||
47 | .Fa "int type" | ||
48 | .Fa "unsigned char *bytes" | ||
49 | .Fa "int len" | ||
50 | .Fc | ||
51 | .Ft X509_NAME_ENTRY * | ||
52 | .Fo X509_NAME_ENTRY_create_by_OBJ | ||
53 | .Fa "X509_NAME_ENTRY **ne" | ||
54 | .Fa "ASN1_OBJECT *obj" | ||
55 | .Fa "int type" | ||
56 | .Fa "const unsigned char *bytes" | ||
57 | .Fa "int len" | ||
58 | .Fc | ||
59 | .Sh DESCRIPTION | ||
60 | .Fn X509_NAME_ENTRY_get_object | ||
61 | retrieves the field name of | ||
62 | .Fa ne | ||
63 | in an | ||
64 | .Vt ASN1_OBJECT | ||
65 | structure. | ||
66 | .Pp | ||
67 | .Fn X509_NAME_ENTRY_get_data | ||
68 | retrieves the field value of | ||
69 | .Fa ne | ||
70 | in an | ||
71 | .Vt ASN1_STRING | ||
72 | structure. | ||
73 | .Pp | ||
74 | .Fn X509_NAME_ENTRY_set_object | ||
75 | sets the field name of | ||
76 | .Fa ne | ||
77 | to | ||
78 | .Fa obj . | ||
79 | .Pp | ||
80 | .Fn X509_NAME_ENTRY_set_data | ||
81 | sets the field value of | ||
82 | .Fa ne | ||
83 | to string type | ||
84 | .Fa type | ||
85 | and the value determined by | ||
86 | .Fa bytes | ||
87 | and | ||
88 | .Fa len . | ||
89 | .Pp | ||
90 | .Fn X509_NAME_ENTRY_create_by_txt , | ||
91 | .Fn X509_NAME_ENTRY_create_by_NID , | ||
92 | and | ||
93 | .Fn X509_NAME_ENTRY_create_by_OBJ | ||
94 | create and return an | ||
95 | .Vt X509_NAME_ENTRY | ||
96 | structure. | ||
97 | .Pp | ||
98 | .Fn X509_NAME_ENTRY_get_object | ||
99 | and | ||
100 | .Fn X509_NAME_ENTRY_get_data | ||
101 | can be used to examine an | ||
102 | .Vt X509_NAME_ENTRY | ||
103 | function as returned by | ||
104 | .Xr X509_NAME_get_entry 3 | ||
105 | for example. | ||
106 | .Pp | ||
107 | .Fn X509_NAME_ENTRY_create_by_txt , | ||
108 | .Fn X509_NAME_ENTRY_create_by_OBJ , | ||
109 | .Fn X509_NAME_ENTRY_create_by_NID , | ||
110 | and | ||
111 | .Fn X509_NAME_ENTRY_set_data | ||
112 | are seldom used in practice because | ||
113 | .Vt X509_NAME_ENTRY | ||
114 | structures are almost always part of | ||
115 | .Vt X509_NAME | ||
116 | structures and the corresponding X509_NAME functions are typically | ||
117 | used to create and add new entries in a single operation. | ||
118 | .Pp | ||
119 | The arguments of these functions support similar options to the | ||
120 | similarly named ones of the corresponding X509_NAME functions such as | ||
121 | .Xr X509_NAME_add_entry_by_txt 3 . | ||
122 | So for example | ||
123 | .Fa type | ||
124 | can be set to | ||
125 | .Dv MBSTRING_ASC , | ||
126 | but in the case of | ||
127 | .Fn X509_NAME_ENTRY_set_data | ||
128 | the field name must be set first so the relevant field information | ||
129 | can be looked up internally. | ||
130 | .Sh SEE ALSO | ||
131 | .Xr d2i_X509_NAME 3 , | ||
132 | .Xr ERR_get_error 3 , | ||
133 | .Xr OBJ_nid2obj 3 | ||
diff --git a/src/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 b/src/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 new file mode 100644 index 0000000000..c77763cc68 --- /dev/null +++ b/src/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 | |||
@@ -0,0 +1,212 @@ | |||
1 | .Dd $Mdocdate: November 4 2016 $ | ||
2 | .Dt X509_NAME_ADD_ENTRY_BY_TXT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm X509_NAME_add_entry_by_txt , | ||
6 | .Nm X509_NAME_add_entry_by_OBJ , | ||
7 | .Nm X509_NAME_add_entry_by_NID , | ||
8 | .Nm X509_NAME_add_entry , | ||
9 | .Nm X509_NAME_delete_entry | ||
10 | .Nd X509_NAME modification functions | ||
11 | .Sh SYNOPSIS | ||
12 | .In openssl/x509.h | ||
13 | .Ft int | ||
14 | .Fo X509_NAME_add_entry_by_txt | ||
15 | .Fa "X509_NAME *name" | ||
16 | .Fa "const char *field" | ||
17 | .Fa "int type" | ||
18 | .Fa "const unsigned char *bytes" | ||
19 | .Fa "int len" | ||
20 | .Fa "int loc" | ||
21 | .Fa "int set" | ||
22 | .Fc | ||
23 | .Ft int | ||
24 | .Fo X509_NAME_add_entry_by_OBJ | ||
25 | .Fa "X509_NAME *name" | ||
26 | .Fa "ASN1_OBJECT *obj" | ||
27 | .Fa "int type" | ||
28 | .Fa "unsigned char *bytes" | ||
29 | .Fa "int len" | ||
30 | .Fa "int loc" | ||
31 | .Fa "int set" | ||
32 | .Fc | ||
33 | .Ft int | ||
34 | .Fo X509_NAME_add_entry_by_NID | ||
35 | .Fa "X509_NAME *name" | ||
36 | .Fa "int nid" | ||
37 | .Fa "int type" | ||
38 | .Fa "unsigned char *bytes" | ||
39 | .Fa "int len" | ||
40 | .Fa "int loc" | ||
41 | .Fa "int set" | ||
42 | .Fc | ||
43 | .Ft int | ||
44 | .Fo X509_NAME_add_entry | ||
45 | .Fa "X509_NAME *name" | ||
46 | .Fa "X509_NAME_ENTRY *ne" | ||
47 | .Fa "int loc" | ||
48 | .Fa "int set" | ||
49 | .Fc | ||
50 | .Ft X509_NAME_ENTRY * | ||
51 | .Fo X509_NAME_delete_entry | ||
52 | .Fa "X509_NAME *name" | ||
53 | .Fa "int loc" | ||
54 | .Fc | ||
55 | .Sh DESCRIPTION | ||
56 | .Fn X509_NAME_add_entry_by_txt , | ||
57 | .Fn X509_NAME_add_entry_by_OBJ , | ||
58 | and | ||
59 | .Fn X509_NAME_add_entry_by_NID | ||
60 | add a field whose name is defined by a string | ||
61 | .Fa field , | ||
62 | an object | ||
63 | .Fa obj | ||
64 | or a NID | ||
65 | .Fa nid , | ||
66 | respectively. | ||
67 | The field value to be added is in | ||
68 | .Fa bytes | ||
69 | of length | ||
70 | .Fa len . | ||
71 | If | ||
72 | .Fa len | ||
73 | is -1 then the field length is calculated internally using | ||
74 | .Fn strlen bytes . | ||
75 | .Pp | ||
76 | The type of field is determined by | ||
77 | .Fa type | ||
78 | which can either be a definition of the type of | ||
79 | .Fa bytes | ||
80 | (such as | ||
81 | .Dv MBSTRING_ASC ) | ||
82 | or a standard ASN1 type (such as | ||
83 | .Dv V_ASN1_IA5STRING ) . | ||
84 | The new entry is added to a position determined by | ||
85 | .Fa loc | ||
86 | and | ||
87 | .Fa set . | ||
88 | .Pp | ||
89 | .Fn X509_NAME_add_entry | ||
90 | adds a copy of a | ||
91 | .Vt X509_NAME_ENTRY | ||
92 | structure | ||
93 | .Fa ne | ||
94 | to | ||
95 | .Fa name . | ||
96 | The new entry is added to a position determined by | ||
97 | .Fa loc | ||
98 | and | ||
99 | .Fa set . | ||
100 | Since a copy of | ||
101 | .Fa ne | ||
102 | is added, | ||
103 | .Fa ne | ||
104 | must be freed up after the call. | ||
105 | .Pp | ||
106 | .Fn X509_NAME_delete_entry | ||
107 | deletes an entry from | ||
108 | .Fa name | ||
109 | at position | ||
110 | .Fa loc . | ||
111 | The deleted entry is returned and must be freed up. | ||
112 | .Pp | ||
113 | The use of string types such as | ||
114 | .Dv MBSTRING_ASC | ||
115 | or | ||
116 | .Dv MBSTRING_UTF8 | ||
117 | is strongly recommended for the | ||
118 | .Fa type | ||
119 | parameter. | ||
120 | This allows the internal code to correctly determine the type of the | ||
121 | field and to apply length checks according to the relevant standards. | ||
122 | This is done using | ||
123 | .Xr ASN1_STRING_set_by_NID 3 . | ||
124 | .Pp | ||
125 | If instead an ASN1 type is used, no checks are performed and the supplied | ||
126 | data in | ||
127 | .Fa bytes | ||
128 | is used directly. | ||
129 | .Pp | ||
130 | In | ||
131 | .Fn X509_NAME_add_entry_by_txt | ||
132 | the | ||
133 | .Fa field | ||
134 | string represents the field name using | ||
135 | .Fn OBJ_txt2obj field 0 . | ||
136 | .Pp | ||
137 | The | ||
138 | .Fa loc | ||
139 | and | ||
140 | .Fa set | ||
141 | parameters determine where a new entry should be added. | ||
142 | For almost all applications, | ||
143 | .Fa loc | ||
144 | can be set to -1 and | ||
145 | .Fa set | ||
146 | to 0. | ||
147 | This adds a new entry to the end of | ||
148 | .Fa name | ||
149 | as a single valued RelativeDistinguishedName (RDN). | ||
150 | .Pp | ||
151 | .Fa loc | ||
152 | actually determines the index where the new entry is inserted: | ||
153 | if it is -1 it is appended. | ||
154 | .Pp | ||
155 | .Fa set | ||
156 | determines how the new type is added. | ||
157 | If it is zero a new RDN is created. | ||
158 | .Pp | ||
159 | If | ||
160 | .Fa set | ||
161 | is -1 or 1 it is added to the previous or next RDN structure | ||
162 | respectively. | ||
163 | This will then be a multivalued RDN: since multivalues RDNs are very | ||
164 | seldom used, | ||
165 | .Fa set | ||
166 | is almost always set to zero. | ||
167 | .Sh RETURN VALUES | ||
168 | .Fn X509_NAME_add_entry_by_txt , | ||
169 | .Fn X509_NAME_add_entry_by_OBJ , | ||
170 | .Fn X509_NAME_add_entry_by_NID , | ||
171 | and | ||
172 | .Fn X509_NAME_add_entry | ||
173 | return 1 for success or 0 if an error occurred. | ||
174 | .Pp | ||
175 | .Fn X509_NAME_delete_entry | ||
176 | returns either the deleted | ||
177 | .Vt X509_NAME_ENTRY | ||
178 | structure or | ||
179 | .Dv NULL | ||
180 | if an error occurred. | ||
181 | .Sh EXAMPLES | ||
182 | Create an | ||
183 | .Vt X509_NAME | ||
184 | structure: | ||
185 | .Pp | ||
186 | .D1 C=UK, O=Disorganized Organization, CN=Joe Bloggs | ||
187 | .Bd -literal | ||
188 | X509_NAME *nm; | ||
189 | nm = X509_NAME_new(); | ||
190 | if (nm == NULL) | ||
191 | /* Some error */ | ||
192 | if (!X509_NAME_add_entry_by_txt(nm, MBSTRING_ASC, | ||
193 | "C", "UK", -1, -1, 0)) | ||
194 | /* Error */ | ||
195 | if (!X509_NAME_add_entry_by_txt(nm, MBSTRING_ASC, | ||
196 | "O", "Disorganized Organization", -1, -1, 0)) | ||
197 | /* Error */ | ||
198 | if (!X509_NAME_add_entry_by_txt(nm, MBSTRING_ASC, | ||
199 | "CN", "Joe Bloggs", -1, -1, 0)) | ||
200 | /* Error */ | ||
201 | .Ed | ||
202 | .Sh SEE ALSO | ||
203 | .Xr d2i_X509_NAME 3 , | ||
204 | .Xr ERR_get_error 3 | ||
205 | .Sh BUGS | ||
206 | .Fa type | ||
207 | can still be set to | ||
208 | .Dv V_ASN1_APP_CHOOSE | ||
209 | to use a different algorithm to determine field types. | ||
210 | Since this form does not understand multicharacter types, performs | ||
211 | no length checks, and can result in invalid field types, its use | ||
212 | is strongly discouraged. | ||
diff --git a/src/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 b/src/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 new file mode 100644 index 0000000000..4710fd1ec2 --- /dev/null +++ b/src/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 | |||
@@ -0,0 +1,177 @@ | |||
1 | .Dd $Mdocdate: November 4 2016 $ | ||
2 | .Dt X509_NAME_GET_INDEX_BY_NID 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm X509_NAME_get_index_by_NID , | ||
6 | .Nm X509_NAME_get_index_by_OBJ , | ||
7 | .Nm X509_NAME_get_entry , | ||
8 | .Nm X509_NAME_entry_count , | ||
9 | .Nm X509_NAME_get_text_by_NID , | ||
10 | .Nm X509_NAME_get_text_by_OBJ | ||
11 | .Nd X509_NAME lookup and enumeration functions | ||
12 | .Sh SYNOPSIS | ||
13 | .In openssl/x509.h | ||
14 | .Ft int | ||
15 | .Fo X509_NAME_get_index_by_NID | ||
16 | .Fa "X509_NAME *name" | ||
17 | .Fa "int nid" | ||
18 | .Fa "int lastpos" | ||
19 | .Fc | ||
20 | .Ft int | ||
21 | .Fo X509_NAME_get_index_by_OBJ | ||
22 | .Fa "X509_NAME *name" | ||
23 | .Fa "ASN1_OBJECT *obj" | ||
24 | .Fa "int lastpos" | ||
25 | .Fc | ||
26 | .Ft int | ||
27 | .Fo X509_NAME_entry_count | ||
28 | .Fa "X509_NAME *name" | ||
29 | .Fc | ||
30 | .Ft X509_NAME_ENTRY * | ||
31 | .Fo X509_NAME_get_entry | ||
32 | .Fa "X509_NAME *name" | ||
33 | .Fa "int loc" | ||
34 | .Fc | ||
35 | .Ft int | ||
36 | .Fo X509_NAME_get_text_by_NID | ||
37 | .Fa "X509_NAME *name" | ||
38 | .Fa "int nid" | ||
39 | .Fa "char *buf" | ||
40 | .Fa "int len" | ||
41 | .Fc | ||
42 | .Ft int | ||
43 | .Fo X509_NAME_get_text_by_OBJ | ||
44 | .Fa "X509_NAME *name" | ||
45 | .Fa "ASN1_OBJECT *obj" | ||
46 | .Fa "char *buf" | ||
47 | .Fa "int len" | ||
48 | .Fc | ||
49 | .Sh DESCRIPTION | ||
50 | These functions allow an | ||
51 | .Vt X509_NAME | ||
52 | structure to be examined. | ||
53 | The | ||
54 | .Vt X509_NAME | ||
55 | structure is the same as the | ||
56 | .Sy Name | ||
57 | type defined in RFC2459 (and elsewhere) and used for example in | ||
58 | certificate subject and issuer names. | ||
59 | .Pp | ||
60 | .Fn X509_NAME_get_index_by_NID | ||
61 | and | ||
62 | .Fn X509_NAME_get_index_by_OBJ | ||
63 | retrieve the next index matching | ||
64 | .Fa nid | ||
65 | or | ||
66 | .Fa obj | ||
67 | after | ||
68 | .Fa lastpos . | ||
69 | .Fa lastpos | ||
70 | should initially be set to -1. | ||
71 | If there are no more entries, -1 is returned. | ||
72 | .Pp | ||
73 | .Fn X509_NAME_entry_count | ||
74 | returns the total number of entries in | ||
75 | .Fa name . | ||
76 | .Pp | ||
77 | .Fn X509_NAME_get_entry | ||
78 | retrieves the | ||
79 | .Vt X509_NAME_ENTRY | ||
80 | from | ||
81 | .Fa name | ||
82 | corresponding to index | ||
83 | .Fa loc . | ||
84 | Acceptable values for | ||
85 | .Fa loc | ||
86 | run from 0 to | ||
87 | .Fn X509_NAME_entry_count name | ||
88 | - 1. | ||
89 | The value returned is an internal pointer which must not be freed. | ||
90 | .Pp | ||
91 | .Fn X509_NAME_get_text_by_NID | ||
92 | and | ||
93 | .Fn X509_NAME_get_text_by_OBJ | ||
94 | retrieve the "text" from the first entry in | ||
95 | .Fa name | ||
96 | which matches | ||
97 | .Fa nid | ||
98 | or | ||
99 | .Fa obj . | ||
100 | If no such entry exists, -1 is returned. | ||
101 | At most | ||
102 | .Fa len | ||
103 | bytes will be written and the text written to | ||
104 | .Fa buf | ||
105 | will be NUL terminated. | ||
106 | The length of the output string written is returned excluding the | ||
107 | terminating NUL. | ||
108 | If | ||
109 | .Fa buf | ||
110 | is | ||
111 | .Dv NULL | ||
112 | then the amount of space needed in | ||
113 | .Fa buf | ||
114 | (excluding the final NUL) is returned. | ||
115 | .Sh RETURN VALUES | ||
116 | .Fn X509_NAME_get_index_by_NID | ||
117 | and | ||
118 | .Fn X509_NAME_get_index_by_OBJ | ||
119 | return the index of the next matching entry or -1 if not found. | ||
120 | .Pp | ||
121 | .Fn X509_NAME_entry_count | ||
122 | returns the total number of entries. | ||
123 | .Pp | ||
124 | .Fn X509_NAME_get_entry | ||
125 | returns an | ||
126 | .Vt X509_NAME | ||
127 | pointer to the requested entry or | ||
128 | .Dv NULL | ||
129 | if the index is invalid. | ||
130 | .Sh EXAMPLES | ||
131 | Process all entries: | ||
132 | .Bd -literal | ||
133 | int i; | ||
134 | X509_NAME_ENTRY *e; | ||
135 | |||
136 | for (i = 0; i < X509_NAME_entry_count(nm); i++) { | ||
137 | e = X509_NAME_get_entry(nm, i); | ||
138 | /* Do something with e */ | ||
139 | } | ||
140 | .Ed | ||
141 | .Pp | ||
142 | Process all commonName entries: | ||
143 | .Bd -literal | ||
144 | int loc; | ||
145 | X509_NAME_ENTRY *e; | ||
146 | |||
147 | loc = -1; | ||
148 | for (;;) { | ||
149 | lastpos = X509_NAME_get_index_by_NID(nm, NID_commonName, lastpos); | ||
150 | if (lastpos == -1) | ||
151 | break; | ||
152 | e = X509_NAME_get_entry(nm, lastpos); | ||
153 | /* Do something with e */ | ||
154 | } | ||
155 | .Ed | ||
156 | .Sh SEE ALSO | ||
157 | .Xr d2i_X509_NAME 3 , | ||
158 | .Xr ERR_get_error 3 | ||
159 | .Sh CAVEATS | ||
160 | .Fn X509_NAME_get_text_by_NID | ||
161 | and | ||
162 | .Fn X509_NAME_get_text_by_OBJ | ||
163 | are legacy functions which have various limitations which make them of | ||
164 | minimal use in practice. | ||
165 | They can only find the first matching entry and will copy the contents | ||
166 | of the field verbatim: this can be highly confusing if the target is a | ||
167 | multicharacter string type like a BMPString or a UTF8String. | ||
168 | .Pp | ||
169 | For a more general solution, | ||
170 | .Fn X509_NAME_get_index_by_NID | ||
171 | or | ||
172 | .Fn X509_NAME_get_index_by_OBJ | ||
173 | should be used, followed by | ||
174 | .Fn X509_NAME_get_entry | ||
175 | on any matching indices and then the various | ||
176 | .Vt X509_NAME_ENTRY | ||
177 | utility functions on the result. | ||
diff --git a/src/lib/libcrypto/man/X509_NAME_print_ex.3 b/src/lib/libcrypto/man/X509_NAME_print_ex.3 new file mode 100644 index 0000000000..ca5fc61e18 --- /dev/null +++ b/src/lib/libcrypto/man/X509_NAME_print_ex.3 | |||
@@ -0,0 +1,199 @@ | |||
1 | .Dd $Mdocdate: November 4 2016 $ | ||
2 | .Dt X509_NAME_PRINT_EX 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm X509_NAME_print_ex , | ||
6 | .Nm X509_NAME_print_ex_fp , | ||
7 | .Nm X509_NAME_print , | ||
8 | .Nm X509_NAME_oneline | ||
9 | .Nd X509_NAME printing routines | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/x509.h | ||
12 | .Ft int | ||
13 | .Fo X509_NAME_print_ex | ||
14 | .Fa "BIO *out" | ||
15 | .Fa "X509_NAME *nm" | ||
16 | .Fa "int indent" | ||
17 | .Fa "unsigned long flags" | ||
18 | .Fc | ||
19 | .Ft int | ||
20 | .Fo X509_NAME_print_ex_fp | ||
21 | .Fa "FILE *fp" | ||
22 | .Fa "X509_NAME *nm" | ||
23 | .Fa "int indent" | ||
24 | .Fa "unsigned long flags" | ||
25 | .Fc | ||
26 | .Ft char * | ||
27 | .Fo X509_NAME_oneline | ||
28 | .Fa "X509_NAME *a" | ||
29 | .Fa "char *buf" | ||
30 | .Fa "int size" | ||
31 | .Fc | ||
32 | .Ft int | ||
33 | .Fo X509_NAME_print | ||
34 | .Fa "BIO *bp" | ||
35 | .Fa "X509_NAME *name" | ||
36 | .Fa "int obase" | ||
37 | .Fc | ||
38 | .Sh DESCRIPTION | ||
39 | .Fn X509_NAME_print_ex | ||
40 | prints a human readable version of | ||
41 | .Fa nm | ||
42 | to | ||
43 | .Vt BIO | ||
44 | .Fa out . | ||
45 | Each line (for multiline formats) is indented by | ||
46 | .Fa indent | ||
47 | spaces. | ||
48 | The output format can be extensively customised by use of the | ||
49 | .Fa flags | ||
50 | parameter. | ||
51 | .Pp | ||
52 | .Fn X509_NAME_print_ex_fp | ||
53 | is identical to | ||
54 | .Fn X509_NAME_print_ex | ||
55 | except the output is written to the | ||
56 | .Vt FILE | ||
57 | pointer | ||
58 | .Fa fp . | ||
59 | .Pp | ||
60 | .Fn X509_NAME_oneline | ||
61 | prints an ASCII version of | ||
62 | .Fa a | ||
63 | to | ||
64 | .Fa buf . | ||
65 | At most | ||
66 | .Fa size | ||
67 | bytes will be written. | ||
68 | If | ||
69 | .Fa buf | ||
70 | is | ||
71 | .Dv NULL , | ||
72 | then a buffer is dynamically allocated and returned, otherwise | ||
73 | .Fa buf | ||
74 | is returned. | ||
75 | .Pp | ||
76 | .Fn X509_NAME_print | ||
77 | prints out | ||
78 | .Fa name | ||
79 | to | ||
80 | .Fa bp | ||
81 | indenting each line by | ||
82 | .Fa obase | ||
83 | characters. | ||
84 | Multiple lines are used if the output (including indent) exceeds 80 | ||
85 | characters. | ||
86 | .Pp | ||
87 | The functions | ||
88 | .Fn X509_NAME_oneline | ||
89 | and | ||
90 | .Fn X509_NAME_print | ||
91 | are legacy functions which produce a non standard output form. | ||
92 | They don't handle multi character fields and have various quirks | ||
93 | and inconsistencies. | ||
94 | Their use is strongly discouraged in new applications. | ||
95 | .Pp | ||
96 | Although there are a large number of possible flags, for most purposes | ||
97 | .Dv XN_FLAG_ONELINE , | ||
98 | .Dv XN_FLAG_MULTILINE , | ||
99 | or | ||
100 | .Dv XN_FLAG_RFC2253 | ||
101 | will suffice. | ||
102 | As noted on the | ||
103 | .Xr ASN1_STRING_print_ex 3 | ||
104 | manual page, for UTF-8 terminals the | ||
105 | .Dv ASN1_STRFLGS_ESC_MSB | ||
106 | should be unset: so for example | ||
107 | .Dv XN_FLAG_ONELINE No & Pf ~ Dv ASN1_STRFLGS_ESC_MSB | ||
108 | would be used. | ||
109 | .Pp | ||
110 | The complete set of the flags supported by | ||
111 | .Dv X509_NAME_print_ex | ||
112 | is listed below. | ||
113 | .Pp | ||
114 | Several options can be OR'ed together. | ||
115 | .Pp | ||
116 | The options | ||
117 | .Dv XN_FLAG_SEP_COMMA_PLUS , | ||
118 | .Dv XN_FLAG_SEP_CPLUS_SPC , | ||
119 | .Dv XN_FLAG_SEP_SPLUS_SPC , | ||
120 | and | ||
121 | .Dv XN_FLAG_SEP_MULTILINE | ||
122 | determine the field separators to use. | ||
123 | Two distinct separators are used between distinct | ||
124 | RelativeDistinguishedName components and separate values in the same RDN | ||
125 | for a multi-valued RDN. | ||
126 | Multi-valued RDNs are currently very rare so the second separator | ||
127 | will hardly ever be used. | ||
128 | .Pp | ||
129 | .Dv XN_FLAG_SEP_COMMA_PLUS | ||
130 | uses comma and plus as separators. | ||
131 | .Dv XN_FLAG_SEP_CPLUS_SPC | ||
132 | uses comma and plus with spaces: | ||
133 | this is more readable that plain comma and plus. | ||
134 | .Dv XN_FLAG_SEP_SPLUS_SPC | ||
135 | uses spaced semicolon and plus. | ||
136 | .Dv XN_FLAG_SEP_MULTILINE | ||
137 | uses spaced newline and plus respectively. | ||
138 | .Pp | ||
139 | If | ||
140 | .Dv XN_FLAG_DN_REV | ||
141 | is set, the whole DN is printed in reversed order. | ||
142 | .Pp | ||
143 | The fields | ||
144 | .Dv XN_FLAG_FN_SN , | ||
145 | .Dv XN_FLAG_FN_LN , | ||
146 | .Dv XN_FLAG_FN_OID , | ||
147 | and | ||
148 | .Dv XN_FLAG_FN_NONE | ||
149 | determine how a field name is displayed. | ||
150 | It will use the short name (e.g. CN) the long name (e.g. commonName) | ||
151 | always use OID numerical form (normally OIDs are only used if the | ||
152 | field name is not recognised) and no field name respectively. | ||
153 | .Pp | ||
154 | If | ||
155 | .Dv XN_FLAG_SPC_EQ | ||
156 | is set, then spaces will be placed around the | ||
157 | .Ql = | ||
158 | character separating field names and values. | ||
159 | .Pp | ||
160 | If | ||
161 | .Dv XN_FLAG_DUMP_UNKNOWN_FIELDS | ||
162 | is set, then the encoding of unknown fields is printed instead of the | ||
163 | values. | ||
164 | .Pp | ||
165 | If | ||
166 | .Dv XN_FLAG_FN_ALIGN | ||
167 | is set, then field names are padded to 20 characters: | ||
168 | this is only of use for multiline format. | ||
169 | .Pp | ||
170 | Additionally, all the options supported by | ||
171 | .Xr ASN1_STRING_print_ex 3 | ||
172 | can be used to control how each field value is displayed. | ||
173 | .Pp | ||
174 | In addition a number options can be set for commonly used formats. | ||
175 | .Pp | ||
176 | .Dv XN_FLAG_RFC2253 | ||
177 | sets options which produce an output compatible with RFC2253. | ||
178 | It is equivalent to | ||
179 | .Dv ASN1_STRFLGS_RFC2253 | XN_FLAG_SEP_COMMA_PLUS | XN_FLAG_DN_REV | | ||
180 | .Dv XN_FLAG_FN_SN | XN_FLAG_DUMP_UNKNOWN_FIELDS . | ||
181 | .Pp | ||
182 | .Dv XN_FLAG_ONELINE | ||
183 | is a more readable one line format which is the same as: | ||
184 | .Dv ASN1_STRFLGS_RFC2253 | ASN1_STRFLGS_ESC_QUOTE | XN_FLAG_SEP_CPLUS_SPC | | ||
185 | .Dv XN_FLAG_SPC_EQ | XN_FLAG_FN_SN . | ||
186 | .Pp | ||
187 | .Dv XN_FLAG_MULTILINE | ||
188 | is a multiline format which is the same as: | ||
189 | .Dv ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | XN_FLAG_SEP_MULTILINE | | ||
190 | .Dv XN_FLAG_SPC_EQ | XN_FLAG_FN_LN | XN_FLAG_FN_ALIGN . | ||
191 | .Pp | ||
192 | .Dv XN_FLAG_COMPAT | ||
193 | uses a format identical to | ||
194 | .Fn X509_NAME_print : | ||
195 | in fact it calls | ||
196 | .Fn X509_NAME_print | ||
197 | internally. | ||
198 | .Sh SEE ALSO | ||
199 | .Xr ASN1_STRING_print_ex 3 | ||
diff --git a/src/lib/libcrypto/man/X509_STORE_CTX_get_error.3 b/src/lib/libcrypto/man/X509_STORE_CTX_get_error.3 new file mode 100644 index 0000000000..f31e438cde --- /dev/null +++ b/src/lib/libcrypto/man/X509_STORE_CTX_get_error.3 | |||
@@ -0,0 +1,297 @@ | |||
1 | .Dd $Mdocdate: November 4 2016 $ | ||
2 | .Dt X509_STORE_CTX_GET_ERROR 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm X509_STORE_CTX_get_error , | ||
6 | .Nm X509_STORE_CTX_set_error , | ||
7 | .Nm X509_STORE_CTX_get_error_depth , | ||
8 | .Nm X509_STORE_CTX_get_current_cert , | ||
9 | .Nm X509_STORE_CTX_get1_chain , | ||
10 | .Nm X509_verify_cert_error_string | ||
11 | .Nd get or set certificate verification status information | ||
12 | .Sh SYNOPSIS | ||
13 | .In openssl/x509.h | ||
14 | .In openssl/x509_vfy.h | ||
15 | .Ft int | ||
16 | .Fo X509_STORE_CTX_get_error | ||
17 | .Fa "X509_STORE_CTX *ctx" | ||
18 | .Fc | ||
19 | .Ft void | ||
20 | .Fo X509_STORE_CTX_set_error | ||
21 | .Fa "X509_STORE_CTX *ctx" | ||
22 | .Fa "int s" | ||
23 | .Fc | ||
24 | .Ft int | ||
25 | .Fo X509_STORE_CTX_get_error_depth | ||
26 | .Fa "X509_STORE_CTX *ctx" | ||
27 | .Fc | ||
28 | .Ft X509 * | ||
29 | .Fo X509_STORE_CTX_get_current_cert | ||
30 | .Fa "X509_STORE_CTX *ctx" | ||
31 | .Fc | ||
32 | .Ft STACK_OF(X509) * | ||
33 | .Fo X509_STORE_CTX_get1_chain | ||
34 | .Fa "X509_STORE_CTX *ctx" | ||
35 | .Fc | ||
36 | .Ft const char * | ||
37 | .Fo X509_verify_cert_error_string | ||
38 | .Fa "long n" | ||
39 | .Fc | ||
40 | .Sh DESCRIPTION | ||
41 | These functions are typically called after | ||
42 | .Xr X509_verify_cert 3 | ||
43 | has indicated an error or in a verification callback to determine the | ||
44 | nature of an error. | ||
45 | .Pp | ||
46 | .Fn X509_STORE_CTX_get_error | ||
47 | returns the error code of | ||
48 | .Fa ctx . | ||
49 | See the | ||
50 | .Sy ERROR CODES | ||
51 | section for a full description of all error codes. | ||
52 | .Pp | ||
53 | .Fn X509_STORE_CTX_set_error | ||
54 | sets the error code of | ||
55 | .Fa ctx | ||
56 | to | ||
57 | .Fa s . | ||
58 | For example it might be used in a verification callback to set an error | ||
59 | based on additional checks. | ||
60 | .Pp | ||
61 | .Fn X509_STORE_CTX_get_error_depth | ||
62 | returns the depth of the error. | ||
63 | This is a non-negative integer representing where in the certificate | ||
64 | chain the error occurred. | ||
65 | If it is zero, it occurred in the end entity certificate, one if it is | ||
66 | the certificate which signed the end entity certificate, and so on. | ||
67 | .Pp | ||
68 | .Fn X509_STORE_CTX_get_current_cert | ||
69 | returns the certificate in | ||
70 | .Fa ctx | ||
71 | which caused the error or | ||
72 | .Dv NULL | ||
73 | if no certificate is relevant. | ||
74 | .Pp | ||
75 | .Fn X509_STORE_CTX_get1_chain | ||
76 | returns a complete validate chain if a previous call to | ||
77 | .Xr X509_verify_cert 3 | ||
78 | is successful. | ||
79 | If the call to | ||
80 | .Xr X509_verify_cert 3 | ||
81 | is | ||
82 | .Sy not | ||
83 | successful, the returned chain may be incomplete or invalid. | ||
84 | The returned chain persists after the | ||
85 | .Fa ctx | ||
86 | structure is freed. | ||
87 | When it is no longer needed, it should be free up using | ||
88 | .Fn sk_X509_pop_free chain X509_free . | ||
89 | .Pp | ||
90 | .Fn X509_verify_cert_error_string | ||
91 | returns a human readable error string for verification error | ||
92 | .Fa n . | ||
93 | .Pp | ||
94 | The above functions should be used instead of directly referencing the | ||
95 | fields in the | ||
96 | .Sy X509_VERIFY_CTX | ||
97 | structure. | ||
98 | .Pp | ||
99 | In versions of OpenSSL before 1.0, the current certificate returned by | ||
100 | .Fn X509_STORE_CTX_get_current_cert | ||
101 | was never | ||
102 | .Dv NULL . | ||
103 | Applications should check the return value before printing out any | ||
104 | debugging information relating to the current certificate. | ||
105 | .Pp | ||
106 | If an unrecognised error code is passed to | ||
107 | .Fn X509_verify_cert_error_string , | ||
108 | the numerical value of the unknown code is returned in a static buffer. | ||
109 | This is not thread safe but will never happen unless an invalid code is | ||
110 | passed. | ||
111 | .Sh RETURN VALUES | ||
112 | .Fn X509_STORE_CTX_get_error | ||
113 | returns | ||
114 | .Dv X509_V_OK | ||
115 | or an error code. | ||
116 | .Pp | ||
117 | .Fn X509_STORE_CTX_get_error_depth | ||
118 | returns a non-negative error depth. | ||
119 | .Pp | ||
120 | .Fn X509_STORE_CTX_get_current_cert | ||
121 | returns the certificate which caused the error or | ||
122 | .Dv NULL | ||
123 | if no certificate is relevant to the error. | ||
124 | .Pp | ||
125 | .Fn X509_verify_cert_error_string | ||
126 | returns a human readable error string for verification error | ||
127 | .Fa n . | ||
128 | .Sh ERROR CODES | ||
129 | A list of error codes and messages is shown below. | ||
130 | Some of the error codes are defined but currently never returned: | ||
131 | these are described as "unused". | ||
132 | .Bl -tag -width Ds | ||
133 | .It Dv X509_V_OK : No ok | ||
134 | The operation was successful. | ||
135 | .It Dv X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT : \ | ||
136 | No unable to get issuer certificate | ||
137 | The issuer certificate could not be found: this occurs if the issuer | ||
138 | certificate of an untrusted certificate cannot be found. | ||
139 | .It Dv X509_V_ERR_UNABLE_TO_GET_CRL : No unable to get certificate CRL | ||
140 | The CRL of a certificate could not be found. | ||
141 | .It Dv X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE : \ | ||
142 | No unable to decrypt certificate's signature | ||
143 | The certificate signature could not be decrypted. | ||
144 | This means that the actual signature value could not be determined | ||
145 | rather than it not matching the expected value, this is only meaningful | ||
146 | for RSA keys. | ||
147 | .It Dv X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE : \ | ||
148 | No unable to decrypt CRL's signature | ||
149 | The CRL signature could not be decrypted: this means that the actual | ||
150 | signature value could not be determined rather than it not matching the | ||
151 | expected value. | ||
152 | Unused. | ||
153 | .It Dv X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY : \ | ||
154 | No unable to decode issuer public key | ||
155 | The public key in the certificate SubjectPublicKeyInfo could not be read. | ||
156 | .It Dv X509_V_ERR_CERT_SIGNATURE_FAILURE : No certificate signature failure | ||
157 | The signature of the certificate is invalid. | ||
158 | .It Dv X509_V_ERR_CRL_SIGNATURE_FAILURE : No CRL signature failure | ||
159 | The signature of the certificate is invalid. | ||
160 | .It Dv X509_V_ERR_CERT_NOT_YET_VALID : No certificate is not yet valid | ||
161 | The certificate is not yet valid: the notBefore date is after the | ||
162 | current time. | ||
163 | .It Dv X509_V_ERR_CERT_HAS_EXPIRED : No certificate has expired | ||
164 | The certificate has expired: that is the notAfter date is before the | ||
165 | current time. | ||
166 | .It Dv X509_V_ERR_CRL_NOT_YET_VALID : No CRL is not yet valid | ||
167 | The CRL is not yet valid. | ||
168 | .It Dv X509_V_ERR_CRL_HAS_EXPIRED : No CRL has expired | ||
169 | The CRL has expired. | ||
170 | .It Dv X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD : \ | ||
171 | No format error in certificate's notBefore field | ||
172 | The certificate notBefore field contains an invalid time. | ||
173 | .It Dv X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD : \ | ||
174 | No format error in certificate's notAfter field | ||
175 | The certificate notAfter field contains an invalid time. | ||
176 | .It Dv X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD : \ | ||
177 | No format error in CRL's lastUpdate field | ||
178 | The CRL lastUpdate field contains an invalid time. | ||
179 | .It Dv X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD : \ | ||
180 | No format error in CRL's nextUpdate field | ||
181 | The CRL nextUpdate field contains an invalid time. | ||
182 | .It Dv X509_V_ERR_OUT_OF_MEM : No out of memory | ||
183 | An error occurred trying to allocate memory. | ||
184 | This should never happen. | ||
185 | .It Dv X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT : No self signed certificate | ||
186 | The passed certificate is self signed and the same certificate cannot be | ||
187 | found in the list of trusted certificates. | ||
188 | .It Dv X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN : \ | ||
189 | No self signed certificate in certificate chain | ||
190 | The certificate chain could be built up using the untrusted certificates | ||
191 | but the root could not be found locally. | ||
192 | .It Dv X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY : \ | ||
193 | No unable to get local issuer certificate | ||
194 | The issuer certificate of a locally looked up certificate could not be found. | ||
195 | This normally means the list of trusted certificates is not complete. | ||
196 | .It Dv X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE : \ | ||
197 | No unable to verify the first certificate | ||
198 | No signatures could be verified because the chain contains only one | ||
199 | certificate and it is not self signed. | ||
200 | .It Dv X509_V_ERR_CERT_CHAIN_TOO_LONG : No certificate chain too long | ||
201 | The certificate chain length is greater than the supplied maximum depth. | ||
202 | Unused. | ||
203 | .It Dv X509_V_ERR_CERT_REVOKED : No certificate revoked | ||
204 | The certificate has been revoked. | ||
205 | .It Dv X509_V_ERR_INVALID_CA : No invalid CA certificate | ||
206 | A CA certificate is invalid. | ||
207 | Either it is not a CA or its extensions are not consistent with the | ||
208 | supplied purpose. | ||
209 | .It Dv X509_V_ERR_PATH_LENGTH_EXCEEDED : No path length constraint exceeded | ||
210 | The basicConstraints pathlength parameter has been exceeded. | ||
211 | .It Dv X509_V_ERR_INVALID_PURPOSE : No unsupported certificate purpose | ||
212 | The supplied certificate cannot be used for the specified purpose. | ||
213 | .It Dv X509_V_ERR_CERT_UNTRUSTED : No certificate not trusted | ||
214 | The root CA is not marked as trusted for the specified purpose. | ||
215 | .It Dv X509_V_ERR_CERT_REJECTED : No certificate rejected | ||
216 | The root CA is marked to reject the specified purpose. | ||
217 | .It Dv X509_V_ERR_SUBJECT_ISSUER_MISMATCH : No subject issuer mismatch | ||
218 | The current candidate issuer certificate was rejected because its | ||
219 | subject name did not match the issuer name of the current certificate. | ||
220 | This is only set if issuer check debugging is enabled it is used for | ||
221 | status notification and is | ||
222 | .Sy not | ||
223 | in itself an error. | ||
224 | .It Dv X509_V_ERR_AKID_SKID_MISMATCH : \ | ||
225 | No authority and subject key identifier mismatch | ||
226 | The current candidate issuer certificate was rejected because its | ||
227 | subject key identifier was present and did not match the authority key | ||
228 | identifier current certificate. | ||
229 | This is only set if issuer check debugging is enabled it is used for | ||
230 | status notification and is | ||
231 | .Sy not | ||
232 | in itself an error. | ||
233 | .It Dv X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH : \ | ||
234 | Noauthority and issuer serial number mismatch | ||
235 | The current candidate issuer certificate was rejected because its issuer | ||
236 | name and serial number was present and did not match the authority key | ||
237 | identifier of the current certificate. | ||
238 | This is only set if issuer check debugging is enabled it is used for | ||
239 | status notification and is | ||
240 | .Sy not | ||
241 | in itself an error. | ||
242 | .It Dv X509_V_ERR_KEYUSAGE_NO_CERTSIGN : \ | ||
243 | No key usage does not include certificate signing | ||
244 | The current candidate issuer certificate was rejected because its | ||
245 | keyUsage extension does not permit certificate signing. | ||
246 | This is only set if issuer check debugging is enabled it is used for | ||
247 | status notification and is | ||
248 | .Sy not | ||
249 | in itself an error. | ||
250 | .It Dv X509_V_ERR_INVALID_EXTENSION : \ | ||
251 | No invalid or inconsistent certificate extension | ||
252 | A certificate extension had an invalid value (for example an incorrect | ||
253 | encoding) or some value inconsistent with other extensions. | ||
254 | .It Dv X509_V_ERR_INVALID_POLICY_EXTENSION : \ | ||
255 | No invalid or inconsistent certificate policy extension | ||
256 | A certificate policies extension had an invalid value (for example an | ||
257 | incorrect encoding) or some value inconsistent with other extensions. | ||
258 | This error only occurs if policy processing is enabled. | ||
259 | .It Dv X509_V_ERR_NO_EXPLICIT_POLICY : No no explicit policy | ||
260 | The verification flags were set to require and explicit policy but none | ||
261 | was present. | ||
262 | .It Dv X509_V_ERR_DIFFERENT_CRL_SCOPE : No different CRL scope | ||
263 | The only CRLs that could be found did not match the scope of the | ||
264 | certificate. | ||
265 | .It Dv X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE : \ | ||
266 | No unsupported extension feature | ||
267 | Some feature of a certificate extension is not supported. | ||
268 | Unused. | ||
269 | .It Dv X509_V_ERR_PERMITTED_VIOLATION : No permitted subtree violation | ||
270 | A name constraint violation occurred in the permitted subtrees. | ||
271 | .It Dv X509_V_ERR_EXCLUDED_VIOLATION : No excluded subtree violation | ||
272 | A name constraint violation occurred in the excluded subtrees. | ||
273 | .It Dv X509_V_ERR_SUBTREE_MINMAX : \ | ||
274 | No name constraints minimum and maximum not supported | ||
275 | A certificate name constraints extension included a minimum or maximum | ||
276 | field: this is not supported. | ||
277 | .It Dv X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE : \ | ||
278 | No unsupported name constraint type | ||
279 | An unsupported name constraint type was encountered. | ||
280 | OpenSSL currently only supports directory name, DNS name, email and URI | ||
281 | types. | ||
282 | .It Dv X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX : \ | ||
283 | No unsupported or invalid name constraint syntax | ||
284 | The format of the name constraint is not recognised: for example an | ||
285 | email address format of a form not mentioned in RFC3280. | ||
286 | This could be caused by a garbage extension or some new feature not | ||
287 | currently supported. | ||
288 | .It Dv X509_V_ERR_CRL_PATH_VALIDATION_ERROR : No CRL path validation error | ||
289 | An error occurred when attempting to verify the CRL path. | ||
290 | This error can only happen if extended CRL checking is enabled. | ||
291 | .It Dv X509_V_ERR_APPLICATION_VERIFICATION : \ | ||
292 | No application verification failure | ||
293 | An application specific error. | ||
294 | This will never be returned unless explicitly set by an application. | ||
295 | .El | ||
296 | .Sh SEE ALSO | ||
297 | .Xr X509_verify_cert 3 | ||
diff --git a/src/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 b/src/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 new file mode 100644 index 0000000000..511933d4a1 --- /dev/null +++ b/src/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 | |||
@@ -0,0 +1,54 @@ | |||
1 | .Dd $Mdocdate: November 4 2016 $ | ||
2 | .Dt X509_STORE_CTX_GET_EX_NEW_INDEX 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm X509_STORE_CTX_get_ex_new_index , | ||
6 | .Nm X509_STORE_CTX_set_ex_data , | ||
7 | .Nm X509_STORE_CTX_get_ex_data | ||
8 | .Nd add application specific data to X509_STORE_CTX structures | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/x509_vfy.h | ||
11 | .Ft int | ||
12 | .Fo X509_STORE_CTX_get_ex_new_index | ||
13 | .Fa "long argl" | ||
14 | .Fa "void *argp" | ||
15 | .Fa "CRYPTO_EX_new *new_func" | ||
16 | .Fa "CRYPTO_EX_dup *dup_func" | ||
17 | .Fa "CRYPTO_EX_free *free_func" | ||
18 | .Fc | ||
19 | .Ft int | ||
20 | .Fo X509_STORE_CTX_set_ex_data | ||
21 | .Fa "X509_STORE_CTX *d" | ||
22 | .Fa "int idx" | ||
23 | .Fa "void *arg" | ||
24 | .Fc | ||
25 | .Ft void * | ||
26 | .Fo X509_STORE_CTX_get_ex_data | ||
27 | .Fa "X509_STORE_CTX *d" | ||
28 | .Fa "int idx" | ||
29 | .Fc | ||
30 | .Sh DESCRIPTION | ||
31 | These functions handle application specific data in | ||
32 | .Vt X509_STORE_CTX | ||
33 | structures. | ||
34 | Their usage is identical to that of | ||
35 | .Xr RSA_get_ex_new_index 3 , | ||
36 | .Xr RSA_set_ex_data 3 , | ||
37 | and | ||
38 | .Xr RSA_get_ex_data 3 . | ||
39 | .Pp | ||
40 | This mechanism is used internally by the | ||
41 | .Xr ssl 3 | ||
42 | library to store the | ||
43 | .Vt SSL | ||
44 | structure associated with a verification operation in an | ||
45 | .Vt X509_STORE_CTX | ||
46 | structure. | ||
47 | .Sh SEE ALSO | ||
48 | .Xr RSA_get_ex_new_index 3 | ||
49 | .Sh HISTORY | ||
50 | .Fn X509_STORE_CTX_get_ex_new_index , | ||
51 | .Fn X509_STORE_CTX_set_ex_data , | ||
52 | and | ||
53 | .Fn X509_STORE_CTX_get_ex_data | ||
54 | are available since OpenSSL 0.9.5. | ||
diff --git a/src/lib/libcrypto/man/X509_STORE_CTX_new.3 b/src/lib/libcrypto/man/X509_STORE_CTX_new.3 new file mode 100644 index 0000000000..6a4b9e3e53 --- /dev/null +++ b/src/lib/libcrypto/man/X509_STORE_CTX_new.3 | |||
@@ -0,0 +1,229 @@ | |||
1 | .Dd $Mdocdate: November 4 2016 $ | ||
2 | .Dt X509_STORE_CTX_NEW 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm X509_STORE_CTX_new , | ||
6 | .Nm X509_STORE_CTX_cleanup , | ||
7 | .Nm X509_STORE_CTX_free , | ||
8 | .Nm X509_STORE_CTX_init , | ||
9 | .Nm X509_STORE_CTX_trusted_stack , | ||
10 | .Nm X509_STORE_CTX_set_cert , | ||
11 | .Nm X509_STORE_CTX_set_chain , | ||
12 | .Nm X509_STORE_CTX_set0_crls , | ||
13 | .Nm X509_STORE_CTX_get0_param , | ||
14 | .Nm X509_STORE_CTX_set0_param , | ||
15 | .Nm X509_STORE_CTX_set_default | ||
16 | .Nd X509_STORE_CTX initialisation | ||
17 | .Sh SYNOPSIS | ||
18 | .In openssl/x509_vfy.h | ||
19 | .Ft X509_STORE_CTX * | ||
20 | .Fn X509_STORE_CTX_new void | ||
21 | .Ft void | ||
22 | .Fo X509_STORE_CTX_cleanup | ||
23 | .Fa "X509_STORE_CTX *ctx" | ||
24 | .Fc | ||
25 | .Ft void | ||
26 | .Fo X509_STORE_CTX_free | ||
27 | .Fa "X509_STORE_CTX *ctx" | ||
28 | .Fc | ||
29 | .Ft int | ||
30 | .Fo X509_STORE_CTX_init | ||
31 | .Fa "X509_STORE_CTX *ctx" | ||
32 | .Fa "X509_STORE *store" | ||
33 | .Fa "X509 *x509" | ||
34 | .Fa "STACK_OF(X509) *chain" | ||
35 | .Fc | ||
36 | .Ft void | ||
37 | .Fo X509_STORE_CTX_trusted_stack | ||
38 | .Fa "X509_STORE_CTX *ctx" | ||
39 | .Fa "STACK_OF(X509) *sk" | ||
40 | .Fc | ||
41 | .Ft void | ||
42 | .Fo X509_STORE_CTX_set_cert | ||
43 | .Fa "X509_STORE_CTX *ctx" | ||
44 | .Fa "X509 *x" | ||
45 | .Fc | ||
46 | .Ft void | ||
47 | .Fo X509_STORE_CTX_set_chain | ||
48 | .Fa "X509_STORE_CTX *ctx" | ||
49 | .Fa "STACK_OF(X509) *sk" | ||
50 | .Fc | ||
51 | .Ft void | ||
52 | .Fo X509_STORE_CTX_set0_crls | ||
53 | .Fa "X509_STORE_CTX *ctx" | ||
54 | .Fa "STACK_OF(X509_CRL) *sk" | ||
55 | .Fc | ||
56 | .Ft X509_VERIFY_PARAM * | ||
57 | .Fo X509_STORE_CTX_get0_param | ||
58 | .Fa "X509_STORE_CTX *ctx" | ||
59 | .Fc | ||
60 | .Ft void | ||
61 | .Fo X509_STORE_CTX_set0_param | ||
62 | .Fa "X509_STORE_CTX *ctx" | ||
63 | .Fa "X509_VERIFY_PARAM *param" | ||
64 | .Fc | ||
65 | .Ft int | ||
66 | .Fo X509_STORE_CTX_set_default | ||
67 | .Fa "X509_STORE_CTX *ctx" | ||
68 | .Fa "const char *name" | ||
69 | .Fc | ||
70 | .Sh DESCRIPTION | ||
71 | These functions initialise an | ||
72 | .Vt X509_STORE_CTX | ||
73 | structure for subsequent use by | ||
74 | .Xr X509_verify_cert 3 . | ||
75 | .Pp | ||
76 | .Fn X509_STORE_CTX_new | ||
77 | returns a newly initialised | ||
78 | .Vt X509_STORE_CTX | ||
79 | structure. | ||
80 | .Pp | ||
81 | .Fn X509_STORE_CTX_cleanup | ||
82 | internally cleans up an | ||
83 | .Vt X509_STORE_CTX | ||
84 | structure. | ||
85 | The context can then be reused with an new call to | ||
86 | .Fn X509_STORE_CTX_init . | ||
87 | .Pp | ||
88 | .Fn X509_STORE_CTX_free | ||
89 | completely frees up | ||
90 | .Fa ctx . | ||
91 | After this call | ||
92 | .Fa ctx | ||
93 | is no longer valid. | ||
94 | .Pp | ||
95 | .Fn X509_STORE_CTX_init | ||
96 | sets up | ||
97 | .Fa ctx | ||
98 | for a subsequent verification operation. | ||
99 | The trusted certificate store is set to | ||
100 | .Fa store , | ||
101 | the end entity certificate to be verified is set to | ||
102 | .Fa x509 | ||
103 | and a set of additional certificates (which will be untrusted but may be | ||
104 | used to build the chain) in | ||
105 | .Fa chain . | ||
106 | Any or all of the | ||
107 | .Fa store , | ||
108 | .Fa x509 , | ||
109 | and | ||
110 | .Fa chain | ||
111 | parameters can be | ||
112 | .Dv NULL . | ||
113 | .Pp | ||
114 | .Fn X509_STORE_CTX_trusted_stack | ||
115 | sets the set of trusted certificates of | ||
116 | .Fa ctx | ||
117 | to | ||
118 | .Fa sk . | ||
119 | This is an alternative way of specifying trusted certificates instead of | ||
120 | using an | ||
121 | .Vt X509_STORE . | ||
122 | .Pp | ||
123 | .Fn X509_STORE_CTX_set_cert | ||
124 | sets the certificate to be verified in | ||
125 | .Fa ctx | ||
126 | to | ||
127 | .Fa x . | ||
128 | .Pp | ||
129 | .Fn X509_STORE_CTX_set_chain | ||
130 | sets the additional certificate chain used by | ||
131 | .Fa ctx | ||
132 | to | ||
133 | .Fa sk . | ||
134 | .Pp | ||
135 | .Fn X509_STORE_CTX_set0_crls | ||
136 | sets a set of CRLs to use to aid certificate verification to | ||
137 | .Fa sk . | ||
138 | These CRLs will only be used if CRL verification is enabled in the | ||
139 | associated | ||
140 | .Vt X509_VERIFY_PARAM | ||
141 | structure. | ||
142 | This might be used where additional "useful" CRLs are supplied as part | ||
143 | of a protocol, for example in a PKCS#7 structure. | ||
144 | .Pp | ||
145 | X509_VERIFY_PARAM | ||
146 | .Fn X509_STORE_CTX_get0_param | ||
147 | retrieves an internal pointer to the verification parameters associated | ||
148 | with | ||
149 | .Fa ctx . | ||
150 | .Pp | ||
151 | .Fn X509_STORE_CTX_set0_param | ||
152 | sets the internal verification parameter pointer to | ||
153 | .Fa param . | ||
154 | After this call | ||
155 | .Fa param | ||
156 | should not be used. | ||
157 | .Pp | ||
158 | .Fn X509_STORE_CTX_set_default | ||
159 | looks up and sets the default verification method to | ||
160 | .Fa name . | ||
161 | This uses the function | ||
162 | .Xr X509_VERIFY_PARAM_lookup 3 | ||
163 | to find an appropriate set of parameters from | ||
164 | .Fa name . | ||
165 | .Pp | ||
166 | The certificates and CRLs in a store are used internally and should | ||
167 | .Sy not | ||
168 | be freed up until after the associated | ||
169 | .Vt X509_STORE_CTX | ||
170 | is freed. | ||
171 | Legacy applications might implicitly use an | ||
172 | .Vt X509_STORE_CTX | ||
173 | like this: | ||
174 | .Bd -literal -offset indent | ||
175 | X509_STORE_CTX ctx; | ||
176 | X509_STORE_CTX_init(&ctx, store, cert, chain); | ||
177 | .Ed | ||
178 | .Pp | ||
179 | This is | ||
180 | .Sy not | ||
181 | recommended in new applications they should instead do: | ||
182 | .Bd -literal -offset indent | ||
183 | X509_STORE_CTX *ctx; | ||
184 | ctx = X509_STORE_CTX_new(); | ||
185 | if (ctx == NULL) | ||
186 | /* Bad error */ | ||
187 | X509_STORE_CTX_init(ctx, store, cert, chain); | ||
188 | .Ed | ||
189 | .Sh RETURN VALUES | ||
190 | .Fn X509_STORE_CTX_new | ||
191 | returns an newly allocates context or | ||
192 | .Dv NULL | ||
193 | if an error occurred. | ||
194 | .Pp | ||
195 | .Fn X509_STORE_CTX_init | ||
196 | returns 1 for success or 0 if an error occurred. | ||
197 | .Pp | ||
198 | .Fn X509_STORE_CTX_get0_param | ||
199 | returns a pointer to an | ||
200 | .Vt X509_VERIFY_PARAM | ||
201 | structure or | ||
202 | .Dv NULL | ||
203 | if an error occurred. | ||
204 | .Pp | ||
205 | .Fn X509_STORE_CTX_cleanup , | ||
206 | .Fn X509_STORE_CTX_free , | ||
207 | .Fn X509_STORE_CTX_trusted_stack , | ||
208 | .Fn X509_STORE_CTX_set_cert , | ||
209 | .Fn X509_STORE_CTX_set_chain , | ||
210 | .Fn X509_STORE_CTX_set0_crls , | ||
211 | and | ||
212 | .Fn X509_STORE_CTX_set0_param | ||
213 | do not return values. | ||
214 | .Pp | ||
215 | .Fn X509_STORE_CTX_set_default | ||
216 | returns 1 for success or 0 if an error occurred. | ||
217 | .Sh SEE ALSO | ||
218 | .Xr X509_verify_cert 3 , | ||
219 | .Xr X509_VERIFY_PARAM_set_flags 3 | ||
220 | .Sh HISTORY | ||
221 | .Fn X509_STORE_CTX_set0_crls | ||
222 | was first added to OpenSSL 1.0.0. | ||
223 | .Sh BUGS | ||
224 | The certificates and CRLs in a context are used internally and should | ||
225 | .Sy not | ||
226 | be freed up until after the associated | ||
227 | .Vt X509_STORE_CTX | ||
228 | is freed. | ||
229 | Copies should be made or reference counts increased instead. | ||
diff --git a/src/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 b/src/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 new file mode 100644 index 0000000000..f588bd7d70 --- /dev/null +++ b/src/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 | |||
@@ -0,0 +1,185 @@ | |||
1 | .Dd $Mdocdate: November 4 2016 $ | ||
2 | .Dt X509_STORE_CTX_SET_VERIFY_CB 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm X509_STORE_CTX_set_verify_cb | ||
6 | .Nd set verification callback | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/x509_vfy.h | ||
9 | .Ft void | ||
10 | .Fo X509_STORE_CTX_set_verify_cb | ||
11 | .Fa "X509_STORE_CTX *ctx" | ||
12 | .Fa "int (*verify_cb)(int ok, X509_STORE_CTX *ctx)" | ||
13 | .Fc | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn X509_STORE_CTX_set_verify_cb | ||
16 | sets the verification callback of | ||
17 | .Fa ctx | ||
18 | to | ||
19 | .Fa verify_cb | ||
20 | overwriting any existing callback. | ||
21 | .Pp | ||
22 | The verification callback can be used to customise the operation of | ||
23 | certificate verification, either by overriding error conditions or | ||
24 | logging errors for debugging purposes. | ||
25 | .Pp | ||
26 | However a verification callback is | ||
27 | .Sy not | ||
28 | essential and the default operation is often sufficient. | ||
29 | .Pp | ||
30 | The | ||
31 | .Fa ok | ||
32 | parameter to the callback indicates the value the callback should return | ||
33 | to retain the default behaviour. | ||
34 | If it is zero then and error condition is indicated. | ||
35 | If it is 1 then no error occurred. | ||
36 | If the flag | ||
37 | .Dv X509_V_FLAG_NOTIFY_POLICY | ||
38 | is set, then | ||
39 | .Fa ok | ||
40 | is set to 2 to indicate the policy checking is complete. | ||
41 | .Pp | ||
42 | The | ||
43 | .Fa ctx | ||
44 | parameter to the callback is the | ||
45 | .Vt X509_STORE_CTX | ||
46 | structure that is performing the verification operation. | ||
47 | A callback can examine this structure and receive additional information | ||
48 | about the error, for example by calling | ||
49 | .Xr X509_STORE_CTX_get_current_cert 3 . | ||
50 | Additional application data can be passed to the callback via the | ||
51 | .Sy ex_data | ||
52 | mechanism. | ||
53 | .Pp | ||
54 | The verification callback can be set and inherited from the parent | ||
55 | structure performing the operation. | ||
56 | In some cases (such as S/MIME verification) the | ||
57 | .Vt X509_STORE_CTX | ||
58 | structure is created and destroyed internally and the only way to set a | ||
59 | custom verification callback is by inheriting it from the associated | ||
60 | .Vt X509_STORE . | ||
61 | .Sh RETURN VALUES | ||
62 | .Fn X509_STORE_CTX_set_verify_cb | ||
63 | does not return a value. | ||
64 | .Sh EXAMPLES | ||
65 | Default callback operation: | ||
66 | .Bd -literal | ||
67 | int | ||
68 | verify_callback(int ok, X509_STORE_CTX *ctx) | ||
69 | { | ||
70 | return ok; | ||
71 | } | ||
72 | .Ed | ||
73 | .Pp | ||
74 | Simple example, suppose a certificate in the chain is expired and we | ||
75 | wish to continue after this error: | ||
76 | .Bd -literal | ||
77 | int | ||
78 | verify_callback(int ok, X509_STORE_CTX *ctx) | ||
79 | { | ||
80 | /* Tolerate certificate expiration */ | ||
81 | if (X509_STORE_CTX_get_error(ctx) == X509_V_ERR_CERT_HAS_EXPIRED) | ||
82 | return 1; | ||
83 | /* Otherwise don't override */ | ||
84 | return ok; | ||
85 | } | ||
86 | .Ed | ||
87 | .Pp | ||
88 | More complex example, we don't wish to continue after | ||
89 | .Sy any | ||
90 | certificate has expired just one specific case: | ||
91 | .Bd -literal | ||
92 | int | ||
93 | verify_callback(int ok, X509_STORE_CTX *ctx) | ||
94 | { | ||
95 | int err = X509_STORE_CTX_get_error(ctx); | ||
96 | X509 *err_cert = X509_STORE_CTX_get_current_cert(ctx); | ||
97 | |||
98 | if (err == X509_V_ERR_CERT_HAS_EXPIRED) { | ||
99 | if (check_is_acceptable_expired_cert(err_cert) | ||
100 | return 1; | ||
101 | } | ||
102 | return ok; | ||
103 | } | ||
104 | .Ed | ||
105 | .Pp | ||
106 | Full featured logging callback. | ||
107 | In this case the | ||
108 | .Fa bio_err | ||
109 | is assumed to be a global logging | ||
110 | .Vt BIO , | ||
111 | an alternative would to store a | ||
112 | .Vt BIO | ||
113 | in | ||
114 | .Fa ctx | ||
115 | using | ||
116 | .Sy ex_data . | ||
117 | .Bd -literal | ||
118 | int | ||
119 | verify_callback(int ok, X509_STORE_CTX *ctx) | ||
120 | { | ||
121 | X509 *err_cert; | ||
122 | int err,depth; | ||
123 | |||
124 | err_cert = X509_STORE_CTX_get_current_cert(ctx); | ||
125 | err = X509_STORE_CTX_get_error(ctx); | ||
126 | depth = X509_STORE_CTX_get_error_depth(ctx); | ||
127 | |||
128 | BIO_printf(bio_err,"depth=%d ",depth); | ||
129 | if (err_cert) { | ||
130 | X509_NAME_print_ex(bio_err, | ||
131 | X509_get_subject_name(err_cert), 0, | ||
132 | XN_FLAG_ONELINE); | ||
133 | BIO_puts(bio_err, "\en"); | ||
134 | } else | ||
135 | BIO_puts(bio_err, "<no cert>\en"); | ||
136 | if (!ok) | ||
137 | BIO_printf(bio_err, "verify error:num=%d:%s\en", | ||
138 | err, X509_verify_cert_error_string(err)); | ||
139 | switch (err) { | ||
140 | case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: | ||
141 | BIO_puts(bio_err, "issuer= "); | ||
142 | X509_NAME_print_ex(bio_err, | ||
143 | X509_get_issuer_name(err_cert), 0, | ||
144 | XN_FLAG_ONELINE); | ||
145 | BIO_puts(bio_err, "\en"); | ||
146 | break; | ||
147 | case X509_V_ERR_CERT_NOT_YET_VALID: | ||
148 | case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: | ||
149 | BIO_printf(bio_err, "notBefore="); | ||
150 | ASN1_TIME_print(bio_err, | ||
151 | X509_get_notBefore(err_cert)); | ||
152 | BIO_printf(bio_err, "\en"); | ||
153 | break; | ||
154 | case X509_V_ERR_CERT_HAS_EXPIRED: | ||
155 | case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: | ||
156 | BIO_printf(bio_err, "notAfter="); | ||
157 | ASN1_TIME_print(bio_err, X509_get_notAfter(err_cert)); | ||
158 | BIO_printf(bio_err, "\en"); | ||
159 | break; | ||
160 | case X509_V_ERR_NO_EXPLICIT_POLICY: | ||
161 | policies_print(bio_err, ctx); | ||
162 | break; | ||
163 | } | ||
164 | if (err == X509_V_OK && ok == 2) | ||
165 | /* print out policies */ | ||
166 | |||
167 | BIO_printf(bio_err,"verify return:%d\en",ok); | ||
168 | return(ok); | ||
169 | } | ||
170 | .Ed | ||
171 | .Sh SEE ALSO | ||
172 | .Xr X509_STORE_CTX_get_error 3 , | ||
173 | .Xr X509_STORE_CTX_get_ex_new_index 3 , | ||
174 | .Xr X509_STORE_set_verify_cb_func 3 | ||
175 | .Sh HISTORY | ||
176 | .Fn X509_STORE_CTX_set_verify_cb | ||
177 | is available in all versions of SSLeay and OpenSSL. | ||
178 | .Sh CAVEATS | ||
179 | In general a verification callback should | ||
180 | .Sy NOT | ||
181 | unconditionally return 1 in all circumstances because this will allow | ||
182 | verification to succeed no matter what the error. | ||
183 | This effectively removes all security from the application because | ||
184 | .Sy any | ||
185 | certificate (including untrusted generated ones) will be accepted. | ||
diff --git a/src/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 b/src/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 new file mode 100644 index 0000000000..5db4313047 --- /dev/null +++ b/src/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 | |||
@@ -0,0 +1,54 @@ | |||
1 | .Dd $Mdocdate: November 4 2016 $ | ||
2 | .Dt X509_STORE_SET_VERIFY_CB_FUNC 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm X509_STORE_set_verify_cb_func , | ||
6 | .Nm X509_STORE_set_verify_cb | ||
7 | .Nd set verification callback | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/x509_vfy.h | ||
10 | .Ft void | ||
11 | .Fo X509_STORE_set_verify_cb | ||
12 | .Fa "X509_STORE *st" | ||
13 | .Fa "int (*verify_cb)(int ok, X509_STORE_CTX *ctx)" | ||
14 | .Fc | ||
15 | .Ft void | ||
16 | .Fo X509_STORE_set_verify_cb_func | ||
17 | .Fa "X509_STORE *st" | ||
18 | .Fa "int (*verify_cb)(int ok, X509_STORE_CTX *ctx)" | ||
19 | .Fc | ||
20 | .Sh DESCRIPTION | ||
21 | .Fn X509_STORE_set_verify_cb | ||
22 | sets the verification callback of | ||
23 | .Sy ctx | ||
24 | to | ||
25 | .Sy verify_cb | ||
26 | overwriting any existing callback. | ||
27 | .Pp | ||
28 | .Fn X509_STORE_set_verify_cb_func | ||
29 | also sets the verification callback but it is implemented as a macro. | ||
30 | .Pp | ||
31 | The verification callback from an | ||
32 | .Vt X509_STORE | ||
33 | is inherited by the corresponding | ||
34 | .Vt X509_STORE_CTX | ||
35 | structure when it is initialized. | ||
36 | This can be used to set the verification callback when the | ||
37 | .Vt X509_STORE_CTX | ||
38 | is otherwise inaccessible (for example during S/MIME verification). | ||
39 | .Sh RETURN VALUES | ||
40 | .Fn X509_STORE_set_verify_cb | ||
41 | and | ||
42 | .Fn X509_STORE_set_verify_cb_func | ||
43 | do not return a value. | ||
44 | .Sh SEE ALSO | ||
45 | .Xr X509_STORE_CTX_set_verify_cb 3 | ||
46 | .Sh HISTORY | ||
47 | .Fn X509_STORE_set_verify_cb_func | ||
48 | is available in all versions of SSLeay and OpenSSL. | ||
49 | .Pp | ||
50 | .Fn X509_STORE_set_verify_cb | ||
51 | was added to OpenSSL 1.0.0. | ||
52 | .Sh BUGS | ||
53 | The macro version of this function was the only one available before | ||
54 | OpenSSL 1.0.0. | ||
diff --git a/src/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 b/src/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 new file mode 100644 index 0000000000..66724ed169 --- /dev/null +++ b/src/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 | |||
@@ -0,0 +1,271 @@ | |||
1 | .Dd $Mdocdate: November 4 2016 $ | ||
2 | .Dt X509_VERIFY_PARAM_SET_FLAGS 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm X509_VERIFY_PARAM_set_flags , | ||
6 | .Nm X509_VERIFY_PARAM_clear_flags , | ||
7 | .Nm X509_VERIFY_PARAM_get_flags , | ||
8 | .Nm X509_VERIFY_PARAM_set_purpose , | ||
9 | .Nm X509_VERIFY_PARAM_set_trust , | ||
10 | .Nm X509_VERIFY_PARAM_set_depth , | ||
11 | .Nm X509_VERIFY_PARAM_get_depth , | ||
12 | .Nm X509_VERIFY_PARAM_set_time , | ||
13 | .Nm X509_VERIFY_PARAM_add0_policy , | ||
14 | .Nm X509_VERIFY_PARAM_set1_policies | ||
15 | .Nd X509 verification parameters | ||
16 | .Sh SYNOPSIS | ||
17 | .In openssl/x509_vfy.h | ||
18 | .Ft int | ||
19 | .Fo X509_VERIFY_PARAM_set_flags | ||
20 | .Fa "X509_VERIFY_PARAM *param" | ||
21 | .Fa "unsigned long flags" | ||
22 | .Fc | ||
23 | .Ft int | ||
24 | .Fo X509_VERIFY_PARAM_clear_flags | ||
25 | .Fa "X509_VERIFY_PARAM *param" | ||
26 | .Fa "unsigned long flags" | ||
27 | .Fc | ||
28 | .Ft unsigned long | ||
29 | .Fo X509_VERIFY_PARAM_get_flags | ||
30 | .Fa "X509_VERIFY_PARAM *param" | ||
31 | .Fc | ||
32 | .Ft int | ||
33 | .Fo X509_VERIFY_PARAM_set_purpose | ||
34 | .Fa "X509_VERIFY_PARAM *param" | ||
35 | .Fa "int purpose" | ||
36 | .Fc | ||
37 | .Ft int | ||
38 | .Fo X509_VERIFY_PARAM_set_trust | ||
39 | .Fa "X509_VERIFY_PARAM *param" | ||
40 | .Fa "int trust" | ||
41 | .Fc | ||
42 | .Ft void | ||
43 | .Fo X509_VERIFY_PARAM_set_time | ||
44 | .Fa "X509_VERIFY_PARAM *param" | ||
45 | .Fa "time_t t" | ||
46 | .Fc | ||
47 | .Ft int | ||
48 | .Fo X509_VERIFY_PARAM_add0_policy | ||
49 | .Fa "X509_VERIFY_PARAM *param" | ||
50 | .Fa "ASN1_OBJECT *policy" | ||
51 | .Fc | ||
52 | .Ft int | ||
53 | .Fo X509_VERIFY_PARAM_set1_policies | ||
54 | .Fa "X509_VERIFY_PARAM *param" | ||
55 | .Fa "STACK_OF(ASN1_OBJECT) *policies" | ||
56 | .Fc | ||
57 | .Ft void | ||
58 | .Fo X509_VERIFY_PARAM_set_depth | ||
59 | .Fa "X509_VERIFY_PARAM *param" | ||
60 | .Fa "int depth" | ||
61 | .Fc | ||
62 | .Ft int | ||
63 | .Fo X509_VERIFY_PARAM_get_depth | ||
64 | .Fa "const X509_VERIFY_PARAM *param" | ||
65 | .Fc | ||
66 | .Sh DESCRIPTION | ||
67 | These functions manipulate the | ||
68 | .Vt X509_VERIFY_PARAM | ||
69 | structure associated with a certificate verification operation. | ||
70 | .Pp | ||
71 | The | ||
72 | .Fn X509_VERIFY_PARAM_set_flags | ||
73 | function sets the flags in | ||
74 | .Fa param | ||
75 | by OR'ing it with | ||
76 | .Fa flags . | ||
77 | See the | ||
78 | .Sx VERIFICATION FLAGS | ||
79 | section for a complete description of values the | ||
80 | .Fa flags | ||
81 | parameter can take. | ||
82 | .Pp | ||
83 | .Fn X509_VERIFY_PARAM_get_flags | ||
84 | returns the flags in | ||
85 | .Fa param . | ||
86 | .Pp | ||
87 | .Fn X509_VERIFY_PARAM_clear_flags | ||
88 | clears the flags | ||
89 | .Fa flags | ||
90 | in | ||
91 | .Fa param . | ||
92 | .Pp | ||
93 | .Fn X509_VERIFY_PARAM_set_purpose | ||
94 | sets the verification purpose in | ||
95 | .Fa param | ||
96 | to | ||
97 | .Fa purpose . | ||
98 | This determines the acceptable purpose of the certificate chain, for | ||
99 | example SSL client or SSL server. | ||
100 | .Pp | ||
101 | .Fn X509_VERIFY_PARAM_set_trust | ||
102 | sets the trust setting in | ||
103 | .Fa param | ||
104 | to | ||
105 | .Fa trust . | ||
106 | .Pp | ||
107 | .Fn X509_VERIFY_PARAM_set_time | ||
108 | sets the verification time in | ||
109 | .Fa param | ||
110 | to | ||
111 | .Fa t . | ||
112 | Normally the current time is used. | ||
113 | .Pp | ||
114 | .Fn X509_VERIFY_PARAM_add0_policy | ||
115 | enables policy checking (it is disabled by default) and adds | ||
116 | .Fa policy | ||
117 | to the acceptable policy set. | ||
118 | .Pp | ||
119 | .Fn X509_VERIFY_PARAM_set1_policies | ||
120 | enables policy checking (it is disabled by default) and sets the | ||
121 | acceptable policy set to | ||
122 | .Fa policies . | ||
123 | Any existing policy set is cleared. | ||
124 | The | ||
125 | .Fa policies | ||
126 | parameter can be | ||
127 | .Dv NULL | ||
128 | to clear an existing policy set. | ||
129 | .Pp | ||
130 | .Fn X509_VERIFY_PARAM_set_depth | ||
131 | sets the maximum verification depth to | ||
132 | .Fa depth . | ||
133 | That is the maximum number of untrusted CA certificates that can appear | ||
134 | in a chain. | ||
135 | .Pp | ||
136 | The above functions should be used to manipulate verification parameters | ||
137 | instead of legacy functions which work in specific structures such as | ||
138 | .Xr X509_STORE_CTX_set_flags 3 . | ||
139 | .Sh RETURN VALUES | ||
140 | .Fn X509_VERIFY_PARAM_set_flags , | ||
141 | .Fn X509_VERIFY_PARAM_clear_flags , | ||
142 | .Fn X509_VERIFY_PARAM_set_purpose , | ||
143 | .Fn X509_VERIFY_PARAM_set_trust , | ||
144 | .Fn X509_VERIFY_PARAM_add0_policy , | ||
145 | and | ||
146 | .Fn X509_VERIFY_PARAM_set1_policies | ||
147 | return 1 for success or 0 for failure. | ||
148 | .Pp | ||
149 | .Fn X509_VERIFY_PARAM_get_flags | ||
150 | returns the current verification flags. | ||
151 | .Pp | ||
152 | .Fn X509_VERIFY_PARAM_set_time | ||
153 | and | ||
154 | .Fn X509_VERIFY_PARAM_set_depth | ||
155 | do not return values. | ||
156 | .Pp | ||
157 | .Fn X509_VERIFY_PARAM_get_depth | ||
158 | returns the current verification depth. | ||
159 | .Sh VERIFICATION FLAGS | ||
160 | The verification flags consists of zero or more of the following | ||
161 | flags OR'ed together. | ||
162 | .Pp | ||
163 | .Dv X509_V_FLAG_CRL_CHECK | ||
164 | enables CRL checking for the certificate chain leaf certificate. | ||
165 | An error occurs if a suitable CRL cannot be found. | ||
166 | .Pp | ||
167 | .Dv X509_V_FLAG_CRL_CHECK_ALL | ||
168 | enables CRL checking for the entire certificate chain. | ||
169 | .Pp | ||
170 | .Dv X509_V_FLAG_IGNORE_CRITICAL | ||
171 | disabled critical extension checking. | ||
172 | By default any unhandled critical extensions in certificates or (if | ||
173 | checked) CRLs results in a fatal error. | ||
174 | If this flag is set unhandled critical extensions are ignored. | ||
175 | .Sy WARNING : | ||
176 | setting this option for anything other than debugging purposes can be a | ||
177 | security risk. | ||
178 | Finer control over which extensions are supported can be performed in | ||
179 | the verification callback. | ||
180 | .Pp | ||
181 | The | ||
182 | .Dv X509_V_FLAG_X509_STRICT | ||
183 | flag disables workarounds for some broken certificates and makes the | ||
184 | verification strictly apply X509 rules. | ||
185 | .Pp | ||
186 | .Dv X509_V_FLAG_ALLOW_PROXY_CERTS | ||
187 | enables proxy certificate verification. | ||
188 | .Pp | ||
189 | .Dv X509_V_FLAG_POLICY_CHECK | ||
190 | enables certificate policy checking, by default no policy checking is | ||
191 | performed. | ||
192 | Additional information is sent to the verification callback relating to | ||
193 | policy checking. | ||
194 | .Pp | ||
195 | .Dv X509_V_FLAG_EXPLICIT_POLICY , | ||
196 | .Dv X509_V_FLAG_INHIBIT_ANY , | ||
197 | and | ||
198 | .Dv X509_V_FLAG_INHIBIT_MAP | ||
199 | set the | ||
200 | .Dq require explicit policy , | ||
201 | .Dq inhibit any policy , | ||
202 | and | ||
203 | .Dq inhibit policy mapping | ||
204 | flags, respectively, as defined in RFC3280. | ||
205 | Policy checking is automatically enabled if any of these flags are set. | ||
206 | .Pp | ||
207 | If | ||
208 | .Dv X509_V_FLAG_NOTIFY_POLICY | ||
209 | is set and the policy checking is successful a special status code is | ||
210 | set to the verification callback. | ||
211 | This permits it to examine the valid policy tree and perform additional | ||
212 | checks or simply log it for debugging purposes. | ||
213 | .Pp | ||
214 | By default some additional features such as indirect CRLs and CRLs | ||
215 | signed by different keys are disabled. | ||
216 | If | ||
217 | .Dv X509_V_FLAG_EXTENDED_CRL_SUPPORT | ||
218 | is set they are enabled. | ||
219 | .Pp | ||
220 | If | ||
221 | .Dv X509_V_FLAG_USE_DELTAS | ||
222 | is set, delta CRLs (if present) are used to determine certificate | ||
223 | status. | ||
224 | If not set, deltas are ignored. | ||
225 | .Pp | ||
226 | .Dv X509_V_FLAG_CHECK_SS_SIGNATURE | ||
227 | enables checking of the root CA self signed certificate signature. | ||
228 | By default this check is disabled because it doesn't add any additional | ||
229 | security but in some cases applications might want to check the | ||
230 | signature anyway. | ||
231 | A side effect of not checking the root CA signature is that disabled or | ||
232 | unsupported message digests on the root CA are not treated as fatal | ||
233 | errors. | ||
234 | .Pp | ||
235 | The | ||
236 | .Dv X509_V_FLAG_CB_ISSUER_CHECK | ||
237 | flag enables debugging of certificate issuer checks. | ||
238 | It is | ||
239 | .Sy not | ||
240 | needed unless you are logging certificate verification. | ||
241 | If this flag is set then additional status codes will be sent to the | ||
242 | verification callback and it | ||
243 | .Sy must | ||
244 | be prepared to handle such cases without assuming they are hard errors. | ||
245 | .Sh EXAMPLES | ||
246 | Enable CRL checking when performing certificate verification during | ||
247 | SSL connections associated with an | ||
248 | .Vt SSL_CTX | ||
249 | structure | ||
250 | .Fa ctx : | ||
251 | .Bd -literal | ||
252 | X509_VERIFY_PARAM *param; | ||
253 | param = X509_VERIFY_PARAM_new(); | ||
254 | X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK); | ||
255 | SSL_CTX_set1_param(ctx, param); | ||
256 | X509_VERIFY_PARAM_free(param); | ||
257 | .Ed | ||
258 | .Sh SEE ALSO | ||
259 | .Xr X509_verify_cert 3 | ||
260 | .Sh BUGS | ||
261 | Delta CRL checking is currently primitive. | ||
262 | Only a single delta can be used and (partly due to limitations of | ||
263 | .Vt X509_STORE ) | ||
264 | constructed CRLs are not maintained. | ||
265 | .Pp | ||
266 | If CRLs checking is enabled, CRLs are expected to be available in | ||
267 | the corresponding | ||
268 | .Vt X509_STORE | ||
269 | structure. | ||
270 | No attempt is made to download CRLs from the CRL distribution points | ||
271 | extension. | ||
diff --git a/src/lib/libcrypto/man/X509_new.3 b/src/lib/libcrypto/man/X509_new.3 new file mode 100644 index 0000000000..26c46ae3a9 --- /dev/null +++ b/src/lib/libcrypto/man/X509_new.3 | |||
@@ -0,0 +1,49 @@ | |||
1 | .Dd $Mdocdate: November 4 2016 $ | ||
2 | .Dt X509_NEW 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm X509_new , | ||
6 | .Nm X509_free | ||
7 | .Nd X509 certificate ASN1 allocation functions | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/x509.h | ||
10 | .Ft X509 * | ||
11 | .Fn X509_new void | ||
12 | .Ft void | ||
13 | .Fo X509_free | ||
14 | .Fa "X509 *a" | ||
15 | .Fc | ||
16 | .Sh DESCRIPTION | ||
17 | The X509 ASN1 allocation routines allocate and free an | ||
18 | .Vt X509 | ||
19 | structure, which represents an X509 certificate. | ||
20 | .Pp | ||
21 | .Fn X509_new | ||
22 | allocates and initializes a X509 structure. | ||
23 | .Pp | ||
24 | .Fn X509_free | ||
25 | frees up the | ||
26 | .Vt X509 | ||
27 | structure | ||
28 | .Fa a . | ||
29 | If | ||
30 | .Fa a | ||
31 | is a | ||
32 | .Dv NULL | ||
33 | pointer, no action occurs. | ||
34 | .Sh RETURN VALUES | ||
35 | If the allocation fails, | ||
36 | .Fn X509_new | ||
37 | returns | ||
38 | .Dv NULL | ||
39 | and sets an error code that can be obtained by | ||
40 | .Xr ERR_get_error 3 . | ||
41 | Otherwise it returns a pointer to the newly allocated structure. | ||
42 | .Sh SEE ALSO | ||
43 | .Xr d2i_X509 3 , | ||
44 | .Xr ERR_get_error 3 | ||
45 | .Sh HISTORY | ||
46 | .Fn X509_new | ||
47 | and | ||
48 | .Fn X509_free | ||
49 | are available in all versions of SSLeay and OpenSSL. | ||
diff --git a/src/lib/libcrypto/man/X509_verify_cert.3 b/src/lib/libcrypto/man/X509_verify_cert.3 new file mode 100644 index 0000000000..fd3d6bebda --- /dev/null +++ b/src/lib/libcrypto/man/X509_verify_cert.3 | |||
@@ -0,0 +1,54 @@ | |||
1 | .Dd $Mdocdate: November 4 2016 $ | ||
2 | .Dt X509_VERIFY_CERT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm X509_verify_cert | ||
6 | .Nd discover and verify X509 certificate chain | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/x509.h | ||
9 | .Ft int | ||
10 | .Fo X509_verify_cert | ||
11 | .Fa "X509_STORE_CTX *ctx" | ||
12 | .Fc | ||
13 | .Sh DESCRIPTION | ||
14 | The | ||
15 | .Fn X509_verify_cert | ||
16 | function attempts to discover and validate a certificate chain based on | ||
17 | parameters in | ||
18 | .Fa ctx . | ||
19 | .Pp | ||
20 | Applications rarely call this function directly, but it is used by | ||
21 | OpenSSL internally for certificate validation, in both the S/MIME and | ||
22 | SSL/TLS code. | ||
23 | .Sh RETURN VALUES | ||
24 | If a complete chain can be built and validated this function returns 1, | ||
25 | otherwise it return 0. | ||
26 | .Pp | ||
27 | In exceptional circumstances, it can also return a negative code, | ||
28 | but only if no certificate is set in | ||
29 | .Fa ctx | ||
30 | due to a programming error or if a retry operation is requested | ||
31 | during internal lookups, which never happens with standard lookup | ||
32 | methods. | ||
33 | It is however recommended that application check for <= 0 return | ||
34 | value on error. | ||
35 | .Pp | ||
36 | If the function fails, additional error information can be obtained | ||
37 | by examining | ||
38 | .Fa ctx , | ||
39 | for example using | ||
40 | .Xr X509_STORE_CTX_get_error 3 . | ||
41 | .Sh SEE ALSO | ||
42 | .Xr X509_STORE_CTX_get_error 3 | ||
43 | and the | ||
44 | .Cm verify | ||
45 | entry in | ||
46 | .Xr openssl 1 | ||
47 | .Sh HISTORY | ||
48 | .Fn X509_verify_cert | ||
49 | is available in all versions of SSLeay and OpenSSL. | ||
50 | .Sh BUGS | ||
51 | This function uses the header | ||
52 | .In openssl/x509.h | ||
53 | as opposed to most chain verification functions which use | ||
54 | .In openssl/x509_vfy.h . | ||
diff --git a/src/lib/libcrypto/man/d2i_X509.3 b/src/lib/libcrypto/man/d2i_X509.3 new file mode 100644 index 0000000000..09c65afa58 --- /dev/null +++ b/src/lib/libcrypto/man/d2i_X509.3 | |||
@@ -0,0 +1,346 @@ | |||
1 | .Dd $Mdocdate: November 4 2016 $ | ||
2 | .Dt D2I_X509 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm d2i_X509 , | ||
6 | .Nm i2d_X509 , | ||
7 | .Nm d2i_X509_bio , | ||
8 | .Nm d2i_X509_fp , | ||
9 | .Nm i2d_X509_bio , | ||
10 | .Nm i2d_X509_fp | ||
11 | .Nd X509 encode and decode functions | ||
12 | .Sh SYNOPSIS | ||
13 | .In openssl/x509.h | ||
14 | .Ft X509 * | ||
15 | .Fo d2i_X509 | ||
16 | .Fa "X509 **px" | ||
17 | .Fa "const unsigned char **in" | ||
18 | .Fa "int len" | ||
19 | .Fc | ||
20 | .Ft int | ||
21 | .Fo i2d_X509 | ||
22 | .Fa "X509 *x" | ||
23 | .Fa "unsigned char **out" | ||
24 | .Fc | ||
25 | .Ft X509 * | ||
26 | .Fo d2i_X509_bio | ||
27 | .Fa "BIO *bp" | ||
28 | .Fa "X509 **x" | ||
29 | .Fc | ||
30 | .Ft X509 * | ||
31 | .Fo d2i_X509_fp | ||
32 | .Fa "FILE *fp" | ||
33 | .Fa "X509 **x" | ||
34 | .Fc | ||
35 | .Ft int | ||
36 | .Fo i2d_X509_bio | ||
37 | .Fa "BIO *bp" | ||
38 | .Fa "X509 *x" | ||
39 | .Fc | ||
40 | .Ft int | ||
41 | .Fo i2d_X509_fp | ||
42 | .Fa "FILE *fp" | ||
43 | .Fa "X509 *x" | ||
44 | .Fc | ||
45 | .Sh DESCRIPTION | ||
46 | The X509 encode and decode routines encode and parse an | ||
47 | .Vt X509 | ||
48 | structure, which represents an X509 certificate. | ||
49 | .Pp | ||
50 | .Fn d2i_X509 | ||
51 | attempts to decode | ||
52 | .Fa len | ||
53 | bytes at | ||
54 | .Pf * Fa in . | ||
55 | If successful, a pointer to the | ||
56 | .Vt X509 | ||
57 | structure is returned. | ||
58 | If an error occurred, | ||
59 | .Dv NULL | ||
60 | is returned. | ||
61 | If | ||
62 | .Fa px | ||
63 | is not | ||
64 | .Dv NULL , | ||
65 | the returned structure is written to | ||
66 | .Pf * Fa px . | ||
67 | If | ||
68 | .Pf * Fa px | ||
69 | is not | ||
70 | .Dv NULL , | ||
71 | then it is assumed that | ||
72 | .Pf * Fa px | ||
73 | contains a valid | ||
74 | .Vt X509 | ||
75 | structure and an attempt is made to reuse it. | ||
76 | If the call is successful, | ||
77 | .Pf * Fa in | ||
78 | is incremented to the byte following the parsed data. | ||
79 | .Pp | ||
80 | .Fn i2d_X509 | ||
81 | encodes the structure pointed to by | ||
82 | .Fa x | ||
83 | into DER format. | ||
84 | If | ||
85 | .Fa out | ||
86 | is not | ||
87 | .Dv NULL , | ||
88 | it writes the DER encoded data to the buffer at | ||
89 | .Pf * Fa out | ||
90 | and increments it to point after the data just written. | ||
91 | If the return value is negative an error occurred, otherwise it returns | ||
92 | the length of the encoded data. | ||
93 | .Pp | ||
94 | For OpenSSL 0.9.7 and later if | ||
95 | .Pf * Fa out | ||
96 | is | ||
97 | .Dv NULL , | ||
98 | memory will be allocated for a buffer and the encoded data written to it. | ||
99 | In this case | ||
100 | .Pf * Fa out | ||
101 | is not incremented and it points to the start of the data just written. | ||
102 | .Pp | ||
103 | .Fn d2i_X509_bio | ||
104 | is similar to | ||
105 | .Fn d2i_X509 | ||
106 | except it attempts to parse data from | ||
107 | .Vt BIO | ||
108 | .Fa bp . | ||
109 | .Pp | ||
110 | .Fn d2i_X509_fp | ||
111 | is similar to | ||
112 | .Fn d2i_X509 | ||
113 | except it attempts to parse data from the | ||
114 | .Vt FILE | ||
115 | pointer | ||
116 | .Fa fp . | ||
117 | .Pp | ||
118 | .Fn i2d_X509_bio | ||
119 | is similar to | ||
120 | .Fn i2d_X509 | ||
121 | except it writes the encoding of the structure | ||
122 | .Fa x | ||
123 | to | ||
124 | .Vt BIO | ||
125 | .Fa bp | ||
126 | and it returns 1 for success or 0 for failure. | ||
127 | .Pp | ||
128 | .Fn i2d_X509_fp | ||
129 | is similar to | ||
130 | .Fn i2d_X509 | ||
131 | except it writes the encoding of the structure | ||
132 | .Fa x | ||
133 | to | ||
134 | .Vt BIO | ||
135 | .Fa bp | ||
136 | and it returns 1 for success or 0 for failure. | ||
137 | .Pp | ||
138 | The letters | ||
139 | .Sy i | ||
140 | and | ||
141 | .Sy d | ||
142 | in for example | ||
143 | .Fn i2d_X509 | ||
144 | stand for "internal" (that is an internal C structure) and "DER", | ||
145 | so that | ||
146 | .Fn i2d_X509 | ||
147 | converts from internal to DER. | ||
148 | .Pp | ||
149 | The functions can also understand BER forms. | ||
150 | .Pp | ||
151 | The actual | ||
152 | .Vt X509 | ||
153 | structure passed to | ||
154 | .Fn i2d_X509 | ||
155 | must be a valid populated | ||
156 | .Vt X509 | ||
157 | structure. | ||
158 | It cannot simply be fed with an empty structure such as that returned by | ||
159 | .Xr X509_new 3 . | ||
160 | .Pp | ||
161 | The encoded data is in binary form and may contain embedded zeroes. | ||
162 | Therefore any | ||
163 | .Vt FILE | ||
164 | pointers or | ||
165 | .Vt BIO Ns s | ||
166 | should be opened in binary mode. | ||
167 | Functions such as | ||
168 | .Xr strlen 3 | ||
169 | will | ||
170 | .Sy not | ||
171 | return the correct length of the encoded structure. | ||
172 | .Pp | ||
173 | The ways that | ||
174 | .Pf * Fa in | ||
175 | and | ||
176 | .Pf * Fa out | ||
177 | are incremented after the operation can trap the unwary. | ||
178 | See the | ||
179 | .Sx CAVEATS | ||
180 | section for some common errors. | ||
181 | .Pp | ||
182 | The reason for the auto increment behaviour is to reflect a typical | ||
183 | usage of ASN1 functions: after one structure is encoded or decoded, | ||
184 | another will processed after it. | ||
185 | .Sh RETURN VALUES | ||
186 | .Fn d2i_X509 , | ||
187 | .Fn d2i_X509_bio , | ||
188 | and | ||
189 | .Fn d2i_X509_fp | ||
190 | return a valid | ||
191 | .Vt X509 | ||
192 | structure or | ||
193 | .Dv NULL | ||
194 | if an error occurs. | ||
195 | .Pp | ||
196 | .Fn i2d_X509 | ||
197 | returns the number of bytes successfully encoded or a negative value if | ||
198 | an error occurs. | ||
199 | .Pp | ||
200 | .Fn i2d_X509_bio | ||
201 | and | ||
202 | .Fn i2d_X509_fp | ||
203 | return 1 for success or 0 if an error occurs. | ||
204 | .Pp | ||
205 | For all functions, the error code can be obtained by | ||
206 | .Xr ERR_get_error 3 . | ||
207 | .Sh EXAMPLES | ||
208 | Allocate and encode the DER encoding of an X509 structure: | ||
209 | .Bd -literal -offset indent | ||
210 | int len; | ||
211 | unsigned char *buf, *p; | ||
212 | |||
213 | len = i2d_X509(x, NULL); | ||
214 | buf = malloc(len); | ||
215 | if (buf == NULL) | ||
216 | /* error */ | ||
217 | p = buf; | ||
218 | i2d_X509(x, &p); | ||
219 | .Ed | ||
220 | .Pp | ||
221 | If you are using OpenSSL 0.9.7 or later then this can be simplified to: | ||
222 | .Bd -literal -offset indent | ||
223 | int len; | ||
224 | unsigned char *buf; | ||
225 | |||
226 | buf = NULL; | ||
227 | len = i2d_X509(x, &buf); | ||
228 | if (len < 0) | ||
229 | /* error */ | ||
230 | .Ed | ||
231 | .Pp | ||
232 | Attempt to decode a buffer: | ||
233 | .Bd -literal -offset indent | ||
234 | X509 *x; | ||
235 | unsigned char *buf, *p; | ||
236 | int len; | ||
237 | |||
238 | /* Something to setup buf and len */ | ||
239 | p = buf; | ||
240 | x = d2i_X509(NULL, &p, len); | ||
241 | if (x == NULL) | ||
242 | /* Some error */ | ||
243 | .Ed | ||
244 | .Pp | ||
245 | Alternative technique: | ||
246 | .Bd -literal -offset indent | ||
247 | X509 *x; | ||
248 | unsigned char *buf, *p; | ||
249 | int len; | ||
250 | |||
251 | /* Something to setup buf and len */ | ||
252 | p = buf; | ||
253 | x = NULL; | ||
254 | if(!d2i_X509(&x, &p, len)) | ||
255 | /* Some error */ | ||
256 | .Ed | ||
257 | .Sh SEE ALSO | ||
258 | .Xr ERR_get_error 3 | ||
259 | .Sh HISTORY | ||
260 | .Fn d2i_X509 , | ||
261 | .Fn i2d_X509 , | ||
262 | .Fn d2i_X509_bio , | ||
263 | .Fn d2i_X509_fp , | ||
264 | .Fn i2d_X509_bio , | ||
265 | and | ||
266 | .Fn i2d_X509_fp | ||
267 | are available in all versions of SSLeay and OpenSSL. | ||
268 | .Sh CAVEATS | ||
269 | The use of a temporary variable is mandatory. | ||
270 | A common mistake is to attempt to use a buffer directly as follows: | ||
271 | .Bd -literal -offset indent | ||
272 | int len; | ||
273 | unsigned char *buf; | ||
274 | |||
275 | len = i2d_X509(x, NULL); | ||
276 | buf = malloc(len); | ||
277 | if (buf == NULL) | ||
278 | /* error */ | ||
279 | i2d_X509(x, &buf); | ||
280 | /* Other stuff ... */ | ||
281 | free(buf); | ||
282 | .Ed | ||
283 | .Pp | ||
284 | This code will result in | ||
285 | .Fa buf | ||
286 | apparently containing garbage because it was incremented after the | ||
287 | call to point after the data just written. | ||
288 | Also | ||
289 | .Fa buf | ||
290 | will no longer contain the pointer allocated by | ||
291 | .Xr malloc 3 | ||
292 | and the subsequent call to | ||
293 | .Xr free 3 | ||
294 | may well crash. | ||
295 | .Pp | ||
296 | The auto allocation feature (setting | ||
297 | .Fa buf | ||
298 | to | ||
299 | .Dv NULL | ||
300 | only works on OpenSSL 0.9.7 and later. | ||
301 | Attempts to use it on earlier versions will typically cause a | ||
302 | segmentation violation. | ||
303 | .Pp | ||
304 | Another trap to avoid is misuse of the | ||
305 | .Fa px | ||
306 | argument to | ||
307 | .Sy d2i_X509() : | ||
308 | .Bd -literal -offset indent | ||
309 | X509 *x; | ||
310 | |||
311 | if (!d2i_X509(&x, &p, len)) | ||
312 | /* Some error */ | ||
313 | .Ed | ||
314 | .Pp | ||
315 | This will probably crash somewhere in | ||
316 | .Fn d2i_X509 . | ||
317 | The reason for this is that the variable | ||
318 | .Fa x | ||
319 | is uninitialized and an attempt will be made to interpret its (invalid) | ||
320 | value as an | ||
321 | .Vt X509 | ||
322 | structure, typically causing a segmentation violation. | ||
323 | If | ||
324 | .Fa x | ||
325 | is set to | ||
326 | .Dv NULL | ||
327 | first then this will not happen. | ||
328 | .Sh BUGS | ||
329 | In some versions of OpenSSL the "reuse" behaviour of | ||
330 | .Fn d2i_X509 | ||
331 | when | ||
332 | .Pf * Fa px | ||
333 | is valid is broken and some parts of the reused structure may persist | ||
334 | if they are not present in the new one. | ||
335 | As a result the use of this "reuse" behaviour is strongly discouraged. | ||
336 | .Pp | ||
337 | In many versions of OpenSSL, | ||
338 | .Fn i2d_X509 | ||
339 | will not return an error if mandatory fields are not initialized | ||
340 | due to a programming error. | ||
341 | Then the encoded structure may contain invalid data or omit the | ||
342 | fields entirely and will not be parsed by | ||
343 | .Fn d2i_X509 . | ||
344 | This may be fixed in future so code should not assume that | ||
345 | .Fn i2d_X509 | ||
346 | will always succeed. | ||
diff --git a/src/lib/libcrypto/man/d2i_X509_ALGOR.3 b/src/lib/libcrypto/man/d2i_X509_ALGOR.3 new file mode 100644 index 0000000000..e17678019b --- /dev/null +++ b/src/lib/libcrypto/man/d2i_X509_ALGOR.3 | |||
@@ -0,0 +1,33 @@ | |||
1 | .Dd $Mdocdate: November 4 2016 $ | ||
2 | .Dt D2I_X509_ALGOR 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm d2i_X509_ALGOR , | ||
6 | .Nm i2d_X509_ALGOR | ||
7 | .Nd AlgorithmIdentifier functions | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/x509.h | ||
10 | .Ft X509_ALGOR * | ||
11 | .Fo d2i_X509_ALGOR | ||
12 | .Fa "X509_ALGOR **a" | ||
13 | .Fa "unsigned char **pp" | ||
14 | .Fa "long length" | ||
15 | .Fc | ||
16 | .Ft int | ||
17 | .Fo i2d_X509_ALGOR | ||
18 | .Fa "X509_ALGOR *a" | ||
19 | .Fa "unsigned char **pp" | ||
20 | .Fc | ||
21 | .Sh DESCRIPTION | ||
22 | These functions decode and encode an | ||
23 | .Vt X509_ALGOR | ||
24 | structure which is equivalent to the | ||
25 | .Sy AlgorithmIdentifier | ||
26 | structure. | ||
27 | .Pp | ||
28 | Otherwise these behave in a way similar to | ||
29 | .Xr d2i_X509 3 | ||
30 | and | ||
31 | .Xr i2d_X509 3 . | ||
32 | .Sh SEE ALSO | ||
33 | .Xr d2i_X509 3 | ||
diff --git a/src/lib/libcrypto/man/d2i_X509_CRL.3 b/src/lib/libcrypto/man/d2i_X509_CRL.3 new file mode 100644 index 0000000000..e487da16d0 --- /dev/null +++ b/src/lib/libcrypto/man/d2i_X509_CRL.3 | |||
@@ -0,0 +1,54 @@ | |||
1 | .Dd $Mdocdate: November 4 2016 $ | ||
2 | .Dt D2I_X509_CRL 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm d2i_X509_CRL , | ||
6 | .Nm i2d_X509_CRL , | ||
7 | .Nm d2i_X509_CRL_bio , | ||
8 | .Nm d2i_X509_CRL_fp , | ||
9 | .Nm i2d_X509_CRL_bio , | ||
10 | .Nm i2d_X509_CRL_fp | ||
11 | .Nd PKCS#10 certificate request functions | ||
12 | .Sh SYNOPSIS | ||
13 | .In openssl/x509.h | ||
14 | .Ft X509_CRL * | ||
15 | .Fo d2i_X509_CRL | ||
16 | .Fa "X509_CRL **a" | ||
17 | .Fa "const unsigned char **pp" | ||
18 | .Fa "long length" | ||
19 | .Fc | ||
20 | .Ft int | ||
21 | .Fo i2d_X509_CRL | ||
22 | .Fa "X509_CRL *a" | ||
23 | .Fa "unsigned char **pp" | ||
24 | .Fc | ||
25 | .Ft X509_CRL * | ||
26 | .Fo d2i_X509_CRL_bio | ||
27 | .Fa "BIO *bp" | ||
28 | .Fa "X509_CRL **x" | ||
29 | .Fc | ||
30 | .Ft X509_CRL * | ||
31 | .Fo d2i_X509_CRL_fp | ||
32 | .Fa "FILE *fp" | ||
33 | .Fa "X509_CRL **x" | ||
34 | .Fc | ||
35 | .Ft int | ||
36 | .Fo i2d_X509_CRL_bio | ||
37 | .Fa "BIO *bp" | ||
38 | .Fa "X509_CRL *x" | ||
39 | .Fc | ||
40 | .Ft int | ||
41 | .Fo i2d_X509_CRL_fp | ||
42 | .Fa "FILE *fp" | ||
43 | .Fa "X509_CRL *x" | ||
44 | .Fc | ||
45 | .Sh DESCRIPTION | ||
46 | These functions decode and encode an X509 CRL (certificate revocation | ||
47 | list). | ||
48 | .Pp | ||
49 | Otherwise the functions behave in a way similar to | ||
50 | .Xr d2i_X509 3 | ||
51 | and | ||
52 | .Xr i2d_X509 3 . | ||
53 | .Sh SEE ALSO | ||
54 | .Xr d2i_X509 3 | ||
diff --git a/src/lib/libcrypto/man/d2i_X509_NAME.3 b/src/lib/libcrypto/man/d2i_X509_NAME.3 new file mode 100644 index 0000000000..b145bf5b58 --- /dev/null +++ b/src/lib/libcrypto/man/d2i_X509_NAME.3 | |||
@@ -0,0 +1,34 @@ | |||
1 | .Dd $Mdocdate: November 4 2016 $ | ||
2 | .Dt D2I_X509_NAME 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm d2i_X509_NAME , | ||
6 | .Nm i2d_X509_NAME | ||
7 | .Nd X509_NAME encoding functions | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/x509.h | ||
10 | .Ft X509_NAME * | ||
11 | .Fo d2i_X509_NAME | ||
12 | .Fa "X509_NAME **a" | ||
13 | .Fa "unsigned char **pp" | ||
14 | .Fa "long length" | ||
15 | .Fc | ||
16 | .Ft int | ||
17 | .Fo i2d_X509_NAME | ||
18 | .Fa "X509_NAME *a" | ||
19 | .Fa "unsigned char **pp" | ||
20 | .Fc | ||
21 | .Sh DESCRIPTION | ||
22 | These functions decode and encode an | ||
23 | .Vt X509_NAME | ||
24 | structure which is the same as the | ||
25 | .Sy Name | ||
26 | type defined in RFC2459 (and elsewhere) and used for example in | ||
27 | certificate subject and issuer names. | ||
28 | .Pp | ||
29 | Otherwise the functions behave in a way similar to | ||
30 | .Xr d2i_X509 3 | ||
31 | and | ||
32 | .Xr i2d_X509 3 . | ||
33 | .Sh SEE ALSO | ||
34 | .Xr d2i_X509 3 | ||
diff --git a/src/lib/libcrypto/man/d2i_X509_REQ.3 b/src/lib/libcrypto/man/d2i_X509_REQ.3 new file mode 100644 index 0000000000..c69cd00fb1 --- /dev/null +++ b/src/lib/libcrypto/man/d2i_X509_REQ.3 | |||
@@ -0,0 +1,53 @@ | |||
1 | .Dd $Mdocdate: November 4 2016 $ | ||
2 | .Dt D2I_X509_REQ 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm d2i_X509_REQ , | ||
6 | .Nm i2d_X509_REQ , | ||
7 | .Nm d2i_X509_REQ_bio , | ||
8 | .Nm d2i_X509_REQ_fp , | ||
9 | .Nm i2d_X509_REQ_bio , | ||
10 | .Nm i2d_X509_REQ_fp | ||
11 | .Nd PKCS#10 certificate request functions | ||
12 | .Sh SYNOPSIS | ||
13 | .In openssl/x509.h | ||
14 | .Ft X509_REQ * | ||
15 | .Fo d2i_X509_REQ | ||
16 | .Fa "X509_REQ **a" | ||
17 | .Fa "const unsigned char **pp" | ||
18 | .Fa "long length" | ||
19 | .Fc | ||
20 | .Ft int | ||
21 | .Fo i2d_X509_REQ | ||
22 | .Fa "X509_REQ *a" | ||
23 | .Fa "unsigned char **pp" | ||
24 | .Fc | ||
25 | .Ft X509_REQ * | ||
26 | .Fo d2i_X509_REQ_bio | ||
27 | .Fa "BIO *bp" | ||
28 | .Fa "X509_REQ **x" | ||
29 | .Fc | ||
30 | .Ft X509_REQ * | ||
31 | .Fo d2i_X509_REQ_fp | ||
32 | .Fa "FILE *fp" | ||
33 | .Fa "X509_REQ **x" | ||
34 | .Fc | ||
35 | .Ft int | ||
36 | .Fo i2d_X509_REQ_bio | ||
37 | .Fa "BIO *bp" | ||
38 | .Fa "X509_REQ *x" | ||
39 | .Fc | ||
40 | .Ft int | ||
41 | .Fo i2d_X509_REQ_fp | ||
42 | .Fa "FILE *fp" | ||
43 | .Fa "X509_REQ *x" | ||
44 | .Fc | ||
45 | .Sh DESCRIPTION | ||
46 | These functions decode and encode a PKCS#10 certificate request. | ||
47 | .Pp | ||
48 | Otherwise these behave in a way similar to | ||
49 | .Xr d2i_X509 3 | ||
50 | and | ||
51 | .Xr i2d_X509 3 . | ||
52 | .Sh SEE ALSO | ||
53 | .Xr d2i_X509 3 | ||
diff --git a/src/lib/libcrypto/man/d2i_X509_SIG.3 b/src/lib/libcrypto/man/d2i_X509_SIG.3 new file mode 100644 index 0000000000..5356dd67de --- /dev/null +++ b/src/lib/libcrypto/man/d2i_X509_SIG.3 | |||
@@ -0,0 +1,33 @@ | |||
1 | .Dd $Mdocdate: November 4 2016 $ | ||
2 | .Dt D2I_X509_SIG 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm d2i_X509_SIG , | ||
6 | .Nm i2d_X509_SIG | ||
7 | .Nd DigestInfo functions | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/x509.h | ||
10 | .Ft X509_SIG * | ||
11 | .Fo d2i_X509_SIG | ||
12 | .Fa "X509_SIG **a" | ||
13 | .Fa "unsigned char **pp" | ||
14 | .Fa "long length" | ||
15 | .Fc | ||
16 | .Ft int | ||
17 | .Fo i2d_X509_SIG | ||
18 | .Fa "X509_SIG *a" | ||
19 | .Fa "unsigned char **pp" | ||
20 | .Fc | ||
21 | .Sh DESCRIPTION | ||
22 | These functions decode and encode an | ||
23 | .Vt X509_SIG | ||
24 | structure which is equivalent to the | ||
25 | .Sy DigestInfo | ||
26 | structure defined in PKCS#1 and PKCS#7. | ||
27 | .Pp | ||
28 | Otherwise these behave in a way similar to | ||
29 | .Xr d2i_X509 3 | ||
30 | and | ||
31 | .Xr i2d_X509 3 . | ||
32 | .Sh SEE ALSO | ||
33 | .Xr d2i_X509 3 | ||
diff --git a/src/lib/libcrypto/man/x509.3 b/src/lib/libcrypto/man/x509.3 new file mode 100644 index 0000000000..1f7b7f4128 --- /dev/null +++ b/src/lib/libcrypto/man/x509.3 | |||
@@ -0,0 +1,79 @@ | |||
1 | .Dd $Mdocdate: November 4 2016 $ | ||
2 | .Dt X509 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm x509 | ||
6 | .Nd X.509 certificate handling | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/x509.h | ||
9 | .Sh DESCRIPTION | ||
10 | A X.509 certificate is a structured grouping of information about an | ||
11 | individual, a device, or anything one can imagine. | ||
12 | A X.509 CRL (certificate revocation list) is a tool to help determine if | ||
13 | a certificate is still valid. | ||
14 | The exact definition of those can be found in the X.509 document from | ||
15 | ITU-T, or in RFC3280 from PKIX. | ||
16 | In OpenSSL, the type | ||
17 | .Vt X509 | ||
18 | is used to express such a certificate, and the type | ||
19 | .Vt X509_CRL | ||
20 | is used to express a CRL. | ||
21 | .Pp | ||
22 | A related structure is a certificate request, defined in PKCS#10 from | ||
23 | RSA Security, Inc., also reflected in RFC2896. | ||
24 | In OpenSSL, the type | ||
25 | .Vt X509_REQ | ||
26 | is used to express such a certificate request. | ||
27 | .Pp | ||
28 | To handle some complex parts of a certificate, there are the types | ||
29 | .Vt X509_NAME | ||
30 | to express a certificate name, | ||
31 | .Vt X509_ATTRIBUTE | ||
32 | to express a certificate attribute, | ||
33 | .Vt X509_EXTENSION | ||
34 | to express a certificate extension, and a few more. | ||
35 | .Pp | ||
36 | Finally, there's the supertype | ||
37 | .Vt X509_INFO , | ||
38 | which can contain a CRL, a certificate, and a corresponding private key. | ||
39 | .Pp | ||
40 | The functions | ||
41 | .Fa X509_* , | ||
42 | .Fa d2i_X509_* , | ||
43 | and | ||
44 | .Fa i2d_X509_* | ||
45 | handle X.509 certificates, with some exceptions shown below. | ||
46 | .Pp | ||
47 | .Fa X509_CRL_* , | ||
48 | .Fa d2i_X509_CRL_* , | ||
49 | and | ||
50 | .Fa i2d_X509_CRL_* | ||
51 | handle X.509 CRLs. | ||
52 | .Pp | ||
53 | .Fa X509_REQ_* , | ||
54 | .Fa d2i_X509_REQ_* , | ||
55 | and | ||
56 | .Fa i2d_X509_REQ_* | ||
57 | handle PKCS#10 certificate requests. | ||
58 | .Pp | ||
59 | .Fa X509_NAME_* | ||
60 | handle certificate names. | ||
61 | .Pp | ||
62 | .Fa X509_ATTRIBUTE_* | ||
63 | handle certificate attributes. | ||
64 | .Pp | ||
65 | .Fa X509_EXTENSION_* | ||
66 | handle certificate extensions. | ||
67 | .Sh SEE ALSO | ||
68 | .Xr crypto 3 , | ||
69 | .Xr d2i_X509 3 , | ||
70 | .Xr d2i_X509_ALGOR 3 , | ||
71 | .Xr d2i_X509_CRL 3 , | ||
72 | .Xr d2i_X509_NAME 3 , | ||
73 | .Xr d2i_X509_REQ 3 , | ||
74 | .Xr d2i_X509_SIG 3 , | ||
75 | .Xr X509_NAME_add_entry_by_NID 3 , | ||
76 | .Xr X509_NAME_add_entry_by_txt 3 , | ||
77 | .Xr X509_NAME_ENTRY_get_object 3 , | ||
78 | .Xr X509_NAME_new 3 , | ||
79 | .Xr X509_NAME_print_ex 3 | ||