/usr/share/doc/libgcrypt11-doc/html/Using-cryptographic-functions.html is in libgcrypt11-doc 1.5.3-2ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This manual is for Libgcrypt
(version 1.5.3, 17 December 2013),
which is GNU's library of cryptographic building blocks.
Copyright (C) 2000, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2011 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version. The text of the license can be found in the
section entitled "GNU General Public License". -->
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>The Libgcrypt Reference Manual: Using cryptographic functions</title>
<meta name="description" content="The Libgcrypt Reference Manual: Using cryptographic functions">
<meta name="keywords" content="The Libgcrypt Reference Manual: Using cryptographic functions">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="AC-Interface.html#AC-Interface" rel="up" title="AC Interface">
<link href="Handle_002dindependent-functions.html#Handle_002dindependent-functions" rel="next" title="Handle-independent functions">
<link href="Working-with-keys.html#Working-with-keys" rel="prev" title="Working with keys">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Using-cryptographic-functions"></a>
<div class="header">
<p>
Next: <a href="Handle_002dindependent-functions.html#Handle_002dindependent-functions" accesskey="n" rel="next">Handle-independent functions</a>, Previous: <a href="Working-with-keys.html#Working-with-keys" accesskey="p" rel="prev">Working with keys</a>, Up: <a href="AC-Interface.html#AC-Interface" accesskey="u" rel="up">AC Interface</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Using-cryptographic-functions-1"></a>
<h4 class="subsection">6.6.6 Using cryptographic functions</h4>
<p>The following flags might be relevant:
</p>
<dl compact="compact">
<dt><code>GCRY_AC_FLAG_NO_BLINDING</code></dt>
<dd><p>Disable any blinding, which might be supported by the chosen
algorithm; blinding is the default.
</p></dd>
</dl>
<p>There exist two kinds of cryptographic functions available through the
ac interface: primitives, and high-level functions.
</p>
<p>Primitives deal with MPIs (data sets) directly; what they provide is
direct access to the cryptographic operations provided by an algorithm
implementation.
</p>
<p>High-level functions deal with octet strings, according to a specified
“scheme”. Schemes make use of “encoding methods”, which are
responsible for converting the provided octet strings into MPIs, which
are then forwared to the cryptographic primitives. Since schemes are
to be used for a special purpose in order to achieve a particular
security goal, there exist “encryption schemes” and “signature
schemes”. Encoding methods can be used seperately or implicitly
through schemes.
</p>
<p>What follows is a description of the cryptographic primitives.
</p>
<dl>
<dt><a name="index-gcry_005fac_005fdata_005fencrypt"></a>Function: <em>gcry_error_t</em> <strong>gcry_ac_data_encrypt</strong> <em>(gcry_ac_handle_t <var>handle</var>, unsigned int <var>flags</var>, gcry_ac_key_t <var>key</var>, gcry_mpi_t <var>data_plain</var>, gcry_ac_data_t *<var>data_encrypted</var>)</em></dt>
<dd><p>Encrypts the plain text MPI value <var>data_plain</var> with the key public
<var>key</var> under the control of the flags <var>flags</var> and stores the
resulting data set into <var>data_encrypted</var>.
</p></dd></dl>
<dl>
<dt><a name="index-gcry_005fac_005fdata_005fdecrypt"></a>Function: <em>gcry_error_t</em> <strong>gcry_ac_data_decrypt</strong> <em>(gcry_ac_handle_t <var>handle</var>, unsigned int <var>flags</var>, gcry_ac_key_t <var>key</var>, gcry_mpi_t *<var>data_plain</var>, gcry_ac_data_t <var>data_encrypted</var>)</em></dt>
<dd><p>Decrypts the encrypted data contained in the data set
<var>data_encrypted</var> with the secret key KEY under the control of the
flags <var>flags</var> and stores the resulting plain text MPI value in
<var>DATA_PLAIN</var>.
</p></dd></dl>
<dl>
<dt><a name="index-gcry_005fac_005fdata_005fsign"></a>Function: <em>gcry_error_t</em> <strong>gcry_ac_data_sign</strong> <em>(gcry_ac_handle_t <var>handle</var>, gcry_ac_key_t <var>key</var>, gcry_mpi_t <var>data</var>, gcry_ac_data_t *<var>data_signature</var>)</em></dt>
<dd><p>Signs the data contained in <var>data</var> with the secret key <var>key</var>
and stores the resulting signature in the data set
<var>data_signature</var>.
</p></dd></dl>
<dl>
<dt><a name="index-gcry_005fac_005fdata_005fverify"></a>Function: <em>gcry_error_t</em> <strong>gcry_ac_data_verify</strong> <em>(gcry_ac_handle_t <var>handle</var>, gcry_ac_key_t <var>key</var>, gcry_mpi_t <var>data</var>, gcry_ac_data_t <var>data_signature</var>)</em></dt>
<dd><p>Verifies that the signature contained in the data set
<var>data_signature</var> is indeed the result of signing the data
contained in <var>data</var> with the secret key belonging to the public
key <var>key</var>.
</p></dd></dl>
<p>What follows is a description of the high-level functions.
</p>
<p>The type “gcry_ac_em_t” is used for specifying encoding methods; the
following methods are supported:
</p>
<dl compact="compact">
<dt><code>GCRY_AC_EME_PKCS_V1_5</code></dt>
<dd><p>PKCS-V1_5 Encoding Method for Encryption. Options must be provided
through a pointer to a correctly initialized object of type
gcry_ac_eme_pkcs_v1_5_t.
</p>
</dd>
<dt><code>GCRY_AC_EMSA_PKCS_V1_5</code></dt>
<dd><p>PKCS-V1_5 Encoding Method for Signatures with Appendix. Options must
be provided through a pointer to a correctly initialized object of
type gcry_ac_emsa_pkcs_v1_5_t.
</p></dd>
</dl>
<p>Option structure types:
</p>
<dl compact="compact">
<dt><code>gcry_ac_eme_pkcs_v1_5_t</code></dt>
<dd><dl compact="compact">
<dt><code>gcry_ac_key_t key</code></dt>
<dt><code>gcry_ac_handle_t handle</code></dt>
</dl>
</dd>
<dt><code>gcry_ac_emsa_pkcs_v1_5_t</code></dt>
<dd><dl compact="compact">
<dt><code>gcry_md_algo_t md</code></dt>
<dt><code>size_t em_n</code></dt>
</dl>
</dd>
</dl>
<p>Encoding methods can be used directly through the following functions:
</p>
<dl>
<dt><a name="index-gcry_005fac_005fdata_005fencode"></a>Function: <em>gcry_error_t</em> <strong>gcry_ac_data_encode</strong> <em>(gcry_ac_em_t <var>method</var>, unsigned int <var>flags</var>, void *<var>options</var>, unsigned char *<var>m</var>, size_t <var>m_n</var>, unsigned char **<var>em</var>, size_t *<var>em_n</var>)</em></dt>
<dd><p>Encodes the message contained in <var>m</var> of size <var>m_n</var> according
to <var>method</var>, <var>flags</var> and <var>options</var>. The newly created
encoded message is stored in <var>em</var> and <var>em_n</var>.
</p></dd></dl>
<dl>
<dt><a name="index-gcry_005fac_005fdata_005fdecode"></a>Function: <em>gcry_error_t</em> <strong>gcry_ac_data_decode</strong> <em>(gcry_ac_em_t <var>method</var>, unsigned int <var>flags</var>, void *<var>options</var>, unsigned char *<var>em</var>, size_t <var>em_n</var>, unsigned char **<var>m</var>, size_t *<var>m_n</var>)</em></dt>
<dd><p>Decodes the message contained in <var>em</var> of size <var>em_n</var> according
to <var>method</var>, <var>flags</var> and <var>options</var>. The newly created
decoded message is stored in <var>m</var> and <var>m_n</var>.
</p></dd></dl>
<p>The type “gcry_ac_scheme_t” is used for specifying schemes; the
following schemes are supported:
</p>
<dl compact="compact">
<dt><code>GCRY_AC_ES_PKCS_V1_5</code></dt>
<dd><p>PKCS-V1_5 Encryption Scheme. No options can be provided.
</p></dd>
<dt><code>GCRY_AC_SSA_PKCS_V1_5</code></dt>
<dd><p>PKCS-V1_5 Signature Scheme (with Appendix). Options can be provided
through a pointer to a correctly initialized object of type
gcry_ac_ssa_pkcs_v1_5_t.
</p></dd>
</dl>
<p>Option structure types:
</p>
<dl compact="compact">
<dt><code>gcry_ac_ssa_pkcs_v1_5_t</code></dt>
<dd><dl compact="compact">
<dt><code>gcry_md_algo_t md</code></dt>
</dl>
</dd>
</dl>
<p>The functions implementing schemes:
</p>
<dl>
<dt><a name="index-gcry_005fac_005fdata_005fencrypt_005fscheme"></a>Function: <em>gcry_error_t</em> <strong>gcry_ac_data_encrypt_scheme</strong> <em>(gcry_ac_handle_t <var>handle</var>, gcry_ac_scheme_t <var>scheme</var>, unsigned int <var>flags</var>, void *<var>opts</var>, gcry_ac_key_t <var>key</var>, gcry_ac_io_t *<var>io_message</var>, gcry_ac_io_t *<var>io_cipher</var>)</em></dt>
<dd><p>Encrypts the plain text readable from <var>io_message</var> through
<var>handle</var> with the public key <var>key</var> according to <var>scheme</var>,
<var>flags</var> and <var>opts</var>. If <var>opts</var> is not NULL, it has to be a
pointer to a structure specific to the chosen scheme (gcry_ac_es_*_t).
The encrypted message is written to <var>io_cipher</var>.
</p></dd></dl>
<dl>
<dt><a name="index-gcry_005fac_005fdata_005fdecrypt_005fscheme"></a>Function: <em>gcry_error_t</em> <strong>gcry_ac_data_decrypt_scheme</strong> <em>(gcry_ac_handle_t <var>handle</var>, gcry_ac_scheme_t <var>scheme</var>, unsigned int <var>flags</var>, void *<var>opts</var>, gcry_ac_key_t <var>key</var>, gcry_ac_io_t *<var>io_cipher</var>, gcry_ac_io_t *<var>io_message</var>)</em></dt>
<dd><p>Decrypts the cipher text readable from <var>io_cipher</var> through
<var>handle</var> with the secret key <var>key</var> according to <var>scheme</var>,
<var>flags</var> and <var>opts</var>. If <var>opts</var> is not NULL, it has to be a
pointer to a structure specific to the chosen scheme (gcry_ac_es_*_t).
The decrypted message is written to <var>io_message</var>.
</p></dd></dl>
<dl>
<dt><a name="index-gcry_005fac_005fdata_005fsign_005fscheme"></a>Function: <em>gcry_error_t</em> <strong>gcry_ac_data_sign_scheme</strong> <em>(gcry_ac_handle_t <var>handle</var>, gcry_ac_scheme_t <var>scheme</var>, unsigned int <var>flags</var>, void *<var>opts</var>, gcry_ac_key_t <var>key</var>, gcry_ac_io_t *<var>io_message</var>, gcry_ac_io_t *<var>io_signature</var>)</em></dt>
<dd><p>Signs the message readable from <var>io_message</var> through <var>handle</var>
with the secret key <var>key</var> according to <var>scheme</var>, <var>flags</var>
and <var>opts</var>. If <var>opts</var> is not NULL, it has to be a pointer to
a structure specific to the chosen scheme (gcry_ac_ssa_*_t). The
signature is written to <var>io_signature</var>.
</p></dd></dl>
<dl>
<dt><a name="index-gcry_005fac_005fdata_005fverify_005fscheme"></a>Function: <em>gcry_error_t</em> <strong>gcry_ac_data_verify_scheme</strong> <em>(gcry_ac_handle_t <var>handle</var>, gcry_ac_scheme_t <var>scheme</var>, unsigned int <var>flags</var>, void *<var>opts</var>, gcry_ac_key_t <var>key</var>, gcry_ac_io_t *<var>io_message</var>, gcry_ac_io_t *<var>io_signature</var>)</em></dt>
<dd><p>Verifies through <var>handle</var> that the signature readable from
<var>io_signature</var> is indeed the result of signing the message
readable from <var>io_message</var> with the secret key belonging to the
public key <var>key</var> according to <var>scheme</var> and <var>opts</var>. If
<var>opts</var> is not NULL, it has to be an anonymous structure
(gcry_ac_ssa_*_t) specific to the chosen scheme.
</p></dd></dl>
<hr>
<div class="header">
<p>
Next: <a href="Handle_002dindependent-functions.html#Handle_002dindependent-functions" accesskey="n" rel="next">Handle-independent functions</a>, Previous: <a href="Working-with-keys.html#Working-with-keys" accesskey="p" rel="prev">Working with keys</a>, Up: <a href="AC-Interface.html#AC-Interface" accesskey="u" rel="up">AC Interface</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|