summaryrefslogtreecommitdiff
path: root/lib/libcrypto/man/PKCS7_set_content.3
blob: fa057341d5c787892844a564ac898c57aed60a77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
.\" $OpenBSD: PKCS7_set_content.3,v 1.2 2020/05/24 12:37:30 schwarze Exp $
.\"
.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: May 24 2020 $
.Dt PKCS7_SET_CONTENT 3
.Os
.Sh NAME
.Nm PKCS7_set_content ,
.Nm PKCS7_content_new
.Nd set the nested contentInfo in a PKCS#7 structure
.Sh SYNOPSIS
.In openssl/pkcs7.h
.Ft int
.Fo PKCS7_set_content
.Fa "PKCS7 *outer"
.Fa "PKCS7 *inner"
.Fc
.Ft int
.Fo PKCS7_content_new
.Fa "PKCS7 *outer"
.Fa "int inner_type"
.Fc
.Sh DESCRIPTION
If the
.Fa contentType
of the
.Fa outer
PKCS7 structure is
.Vt SignedData
or
.Vt DigestedData ,
.Fn PKCS7_set_content
sets the
.Fa contentInfo
field of the
.Fa content
field of
.Fa outer
to
.Fa inner ,
without copying
.Fa inner .
If there was previous
.Fa contentInfo ,
it is freed rather than overwritten.
The rest of the internal state of
.Fa outer
and of its
.Fa content
remains unchanged.
.Pp
.Fn PKCS7_content_new
is similar except that it first allocates and initializes a new, empty
.Fa inner
object of the given
.Fa inner_type
using
.Xr PKCS7_new 3
and
.Xr PKCS7_set_type 3 .
The
.Fa inner_type
can be any of the NIDs listed in the
.Xr PKCS7_set_type 3
manual.
.Sh RETURN VALUES
These functions return 1 on success or 0 on failure.
They fail if the
.Fa contentType
of
.Fa outer
is unsupported.
.Fn PKCS7_content_new
can also fail when memory is exhausted.
In case of failure,
.Fa outer
remains unchanged.
.Sh SEE ALSO
.Xr PKCS7_dataInit 3 ,
.Xr PKCS7_new 3 ,
.Xr PKCS7_set_type 3 ,
.Xr PKCS7_sign 3
.Sh STANDARDS
RFC 2315: PKCS #7: Cryptographic Message Syntax Version 1.5
.Bl -bullet -compact -offset 1n -width 1n
.It
Section 7. General syntax
.It
Section 9. Signed-data content type
.It
Section 12.\& Digested-data content type
.El
.Sh HISTORY
These functions first appeared in SSLeay 0.8.1
and have been available since
.Ox 2.4 .
.Sh CAVEATS
Despite the function names, these functions do not set the
.Fa content
field of
.Fa outer ,
but only the
.Fa contentInfo
field inside it.
The rest of the
.Fa content
remains unchanged.