Skip to content

Commit fff9fee

Browse files
karel-msjaeckel
authored andcommitted
DSA new functions - doc
1 parent f3f839e commit fff9fee

1 file changed

Lines changed: 63 additions & 10 deletions

File tree

doc/crypt.tex

Lines changed: 63 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5326,22 +5326,73 @@ \subsection{DSA Key Import}
53265326
This will import the DSA key from the buffer \textit{in} of length \textit{inlen} to the \textit{key}. If the process fails the function
53275327
will automatically free all of the heap allocated in the process (you don't have to call dsa\_free()).
53285328

5329-
\subsection{Other DSA Functions}
5329+
\mysection{Other DSA Functions}
53305330

5331-
XXX-TODO
5331+
The following functions allow to create a DSA key in 2 steps:
53325332

5333-
\begin{small}
5333+
\begin{enumerate}
5334+
\item Load or generate \textit{p}, \textit{q}, \textit{g} part of the key via \textit{dsa\_set\_pqg()}, \textit{dsa\_set\_pqg\_dsaparam()} or \textit{dsa\_generate\_pqg()}.
5335+
\item Load or generate the actual DSA key -- private (\textit{x} and \textit{y} values) or public (\textit{y} value).
5336+
\end{enumerate}
5337+
5338+
\index{dsa\_set\_pqg()}
53345339
\begin{verbatim}
53355340
int dsa_set_pqg(const unsigned char *p, unsigned long plen,
53365341
const unsigned char *q, unsigned long qlen,
53375342
const unsigned char *g, unsigned long glen,
53385343
dsa_key *key);
5339-
int dsa_set_pqg_dsaparam(const unsigned char *dsaparam, unsigned long dsaparamlen, dsa_key *key);
5340-
int dsa_generate_pqg(prng_state *prng, int wprng, int group_size, int modulus_size, dsa_key *key);
5341-
int dsa_set_key(const unsigned char *in, unsigned long inlen, int type, dsa_key *key);
5342-
int dsa_generate_key(prng_state *prng, int wprng, dsa_key *key);
53435344
\end{verbatim}
5344-
\end{small}
5345+
5346+
This will initialise the \textit{p}, \textit{q} and \textit{g} part of \textit{key} structure by directly loading binary
5347+
representation of \textit{p} (with length of \textit{plen}), \textit{q} (with length of \textit{qlen}) and \textit{g} (with length of \textit{glen}).
5348+
A simple DSA key validity check (without primality testing) is performed at the end of this function.
5349+
5350+
\index{dsa\_set\_pqg\_dsaparam()}
5351+
\begin{verbatim}
5352+
int dsa_set_pqg_dsaparam(const unsigned char *dsaparam,
5353+
unsigned long dsaparamlen,
5354+
dsa_key *key);
5355+
\end{verbatim}
5356+
5357+
This will initialise the \textit{p}, \textit{q} and \textit{g} part of \textit{key} structure by directly loading binary representation
5358+
of DSA parameters stored as a binary data in a buffer \textit{dsaparam} (with length of \textit{dsaparamlen}). A simple DSA key validity
5359+
check (without primality testing) is performed at the end of this function. The \textit{dsaparam} can be generated via:
5360+
\begin{verbatim}
5361+
openssl dsaparam 2048 -outform DER -out dsaparam.der
5362+
\end{verbatim}
5363+
5364+
\index{dsa\_generate\_pqg()}
5365+
\begin{verbatim}
5366+
int dsa_generate_pqg(prng_state *prng,
5367+
int wprng,
5368+
int group_size,
5369+
int modulus_size,
5370+
dsa_key *key);
5371+
\end{verbatim}
5372+
5373+
This will initialise the \textit{p}, \textit{q} and \textit{g} part of \textit{key} structure with newly generated random values.
5374+
As for the parameters they are the same as by \textit{dsa\_make\_key}.
5375+
5376+
\index{dsa\_set\_key()}
5377+
\begin{verbatim}
5378+
int dsa_set_key(const unsigned char *in,
5379+
unsigned long inlen,
5380+
int type,
5381+
dsa_key *key);
5382+
\end{verbatim}
5383+
5384+
This function can be used for setting the actual DSA key. If \textit{type} is \textit{PK\_PRIVATE} then the buffer \textit{in}
5385+
(with length of \textit{inlen}) contains a binary representation of \textit{x} part of the key (the public part \textit{y} is computed).
5386+
If \textit{type} is \textit{PK\_PUBLIC} then the buffer \textit{in} contains a binary representation of \textit{y} part of the key.
5387+
5388+
\index{dsa\_generate\_key()}
5389+
\begin{verbatim}
5390+
int dsa_generate_key(prng_state *prng,
5391+
int wprng,
5392+
dsa_key *key);
5393+
\end{verbatim}
5394+
5395+
This function generates a private DSA key containing both \textit{x} and \textit{y} parts.
53455396

53465397
\chapter{Standards Support}
53475398
\mysection{ASN.1 Formats}
@@ -6294,16 +6345,18 @@ \subsection{URL--safe 'base64url' encoding}
62946345
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_
62956346
\end{verbatim}
62966347
Those characters are sometimes also called URL and filename safe alphabet.
6297-
6298-
XXX-TODO
6348+
The interface is analogous to \textit{base64\_xxxx} functions in previous chapter.
62996349

63006350
\begin{verbatim}
63016351
int base64url_encode(const unsigned char *in, unsigned long len,
63026352
unsigned char *out, unsigned long *outlen);
6353+
63036354
int base64url_strict_encode(const unsigned char *in, unsigned long inlen,
63046355
unsigned char *out, unsigned long *outlen);
6356+
63056357
int base64url_decode(const unsigned char *in, unsigned long len,
63066358
unsigned char *out, unsigned long *outlen);
6359+
63076360
int base64url_strict_decode(const unsigned char *in, unsigned long len,
63086361
unsigned char *out, unsigned long *outlen);
63096362
\end{verbatim}

0 commit comments

Comments
 (0)