126 lines
5.7 KiB
HTML
Executable File
126 lines
5.7 KiB
HTML
Executable File
<?xml version="1.0" ?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>ASN1_TYPE_get</title>
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
<link rev="made" href="mailto:root@localhost" />
|
|
</head>
|
|
|
|
<body style="background-color: white">
|
|
|
|
|
|
<!-- INDEX BEGIN -->
|
|
<div name="index">
|
|
<p><a name="__index__"></a></p>
|
|
|
|
<ul>
|
|
|
|
<li><a href="#name">NAME</a></li>
|
|
<li><a href="#synopsis">SYNOPSIS</a></li>
|
|
<li><a href="#description">DESCRIPTION</a></li>
|
|
<li><a href="#notes">NOTES</a></li>
|
|
<li><a href="#return_values">RETURN VALUES</a></li>
|
|
<li><a href="#copyright">COPYRIGHT</a></li>
|
|
</ul>
|
|
|
|
<hr name="index" />
|
|
</div>
|
|
<!-- INDEX END -->
|
|
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="name">NAME</a></h1>
|
|
<p>ASN1_TYPE_get, ASN1_TYPE_set, ASN1_TYPE_set1, ASN1_TYPE_cmp, ASN1_TYPE_unpack_sequence, ASN1_TYPE_pack_sequence - ASN1_TYPE utility
|
|
functions</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="synopsis">SYNOPSIS</a></h1>
|
|
<pre>
|
|
#include <openssl/asn1.h></pre>
|
|
<pre>
|
|
int ASN1_TYPE_get(const ASN1_TYPE *a);
|
|
void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
|
|
int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value);
|
|
int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b);</pre>
|
|
<pre>
|
|
void *ASN1_TYPE_unpack_sequence(const ASN1_ITEM *it, const ASN1_TYPE *t);
|
|
ASN1_TYPE *ASN1_TYPE_pack_sequence(const ASN1_ITEM *it, void *s,
|
|
ASN1_TYPE **t);</pre>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="description">DESCRIPTION</a></h1>
|
|
<p>These functions allow an <strong>ASN1_TYPE</strong> structure to be manipulated. The
|
|
<strong>ASN1_TYPE</strong> structure can contain any ASN.1 type or constructed type
|
|
such as a SEQUENCE: it is effectively equivalent to the ASN.1 ANY type.</p>
|
|
<p>ASN1_TYPE_get() returns the type of <em>a</em>.</p>
|
|
<p>ASN1_TYPE_set() sets the value of <em>a</em> to <em>type</em> and <em>value</em>. This
|
|
function uses the pointer <em>value</em> internally so it must <strong>not</strong> be freed
|
|
up after the call.</p>
|
|
<p>ASN1_TYPE_set1() sets the value of <em>a</em> to <em>type</em> a copy of <em>value</em>.</p>
|
|
<p>ASN1_TYPE_cmp() compares ASN.1 types <em>a</em> and <em>b</em> and returns 0 if
|
|
they are identical and nonzero otherwise.</p>
|
|
<p>ASN1_TYPE_unpack_sequence() attempts to parse the SEQUENCE present in
|
|
<em>t</em> using the ASN.1 structure <em>it</em>. If successful it returns a pointer
|
|
to the ASN.1 structure corresponding to <em>it</em> which must be freed by the
|
|
caller. If it fails it return NULL.</p>
|
|
<p>ASN1_TYPE_pack_sequence() attempts to encode the ASN.1 structure <em>s</em>
|
|
corresponding to <em>it</em> into an <strong>ASN1_TYPE</strong>. If successful the encoded
|
|
<strong>ASN1_TYPE</strong> is returned. If <em>t</em> and <em>*t</em> are not NULL the encoded type
|
|
is written to <em>t</em> overwriting any existing data. If <em>t</em> is not NULL
|
|
but <em>*t</em> is NULL the returned <strong>ASN1_TYPE</strong> is written to <em>*t</em>.</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="notes">NOTES</a></h1>
|
|
<p>The type and meaning of the <em>value</em> parameter for ASN1_TYPE_set() and
|
|
ASN1_TYPE_set1() is determined by the <em>type</em> parameter.
|
|
If <em>type</em> is <strong>V_ASN1_NULL</strong> <em>value</em> is ignored. If <em>type</em> is
|
|
<strong>V_ASN1_BOOLEAN</strong>
|
|
then the boolean is set to TRUE if <em>value</em> is not NULL. If <em>type</em> is
|
|
<strong>V_ASN1_OBJECT</strong> then value is an <strong>ASN1_OBJECT</strong> structure. Otherwise <em>type</em>
|
|
is and <strong>ASN1_STRING</strong> structure. If <em>type</em> corresponds to a primitive type
|
|
(or a string type) then the contents of the <strong>ASN1_STRING</strong> contain the content
|
|
octets of the type. If <em>type</em> corresponds to a constructed type or
|
|
a tagged type (<strong>V_ASN1_SEQUENCE</strong>, <strong>V_ASN1_SET</strong> or <strong>V_ASN1_OTHER</strong>) then the
|
|
<strong>ASN1_STRING</strong> contains the entire ASN.1 encoding verbatim (including tag and
|
|
length octets).</p>
|
|
<p>ASN1_TYPE_cmp() may not return zero if two types are equivalent but have
|
|
different encodings. For example the single content octet of the boolean TRUE
|
|
value under BER can have any nonzero encoding but ASN1_TYPE_cmp() will
|
|
only return zero if the values are the same.</p>
|
|
<p>If either or both of the parameters passed to ASN1_TYPE_cmp() is NULL the
|
|
return value is nonzero. Technically if both parameters are NULL the two
|
|
types could be absent OPTIONAL fields and so should match, however passing
|
|
NULL values could also indicate a programming error (for example an
|
|
unparsable type which returns NULL) for types which do <strong>not</strong> match. So
|
|
applications should handle the case of two absent values separately.</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="return_values">RETURN VALUES</a></h1>
|
|
<p>ASN1_TYPE_get() returns the type of the <strong>ASN1_TYPE</strong> argument.</p>
|
|
<p>ASN1_TYPE_set() does not return a value.</p>
|
|
<p>ASN1_TYPE_set1() returns 1 for success and 0 for failure.</p>
|
|
<p>ASN1_TYPE_cmp() returns 0 if the types are identical and nonzero otherwise.</p>
|
|
<p>ASN1_TYPE_unpack_sequence() returns a pointer to an ASN.1 structure or
|
|
NULL on failure.</p>
|
|
<p>ASN1_TYPE_pack_sequence() return an <strong>ASN1_TYPE</strong> structure if it succeeds or
|
|
NULL on failure.</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="copyright">COPYRIGHT</a></h1>
|
|
<p>Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.</p>
|
|
<p>Licensed under the Apache License 2.0 (the "License"). You may not use
|
|
this file except in compliance with the License. You can obtain a copy
|
|
in the file LICENSE in the source distribution or at
|
|
<a href="https://www.openssl.org/source/license.html">https://www.openssl.org/source/license.html</a>.</p>
|
|
|
|
</body>
|
|
|
|
</html>
|