blob: b1af55e09e3ce5360e1728bdd1a15223d5cead8e [file] [log] [blame]
rsccfa37a72004-04-10 18:53:55 +00001.TH DSA 3
2.SH NAME
3dsagen, dsasign, dsaverify, dsapuballoc, dsapubfree, dsaprivalloc, dsaprivfree, dsasigalloc, dsasigfree, dsaprivtopub - digital signature algorithm
4.SH SYNOPSIS
5.B #include <u.h>
6.br
7.B #include <libc.h>
8.br
9.B #include <mp.h>
10.br
11.B #include <libsec.h>
12.PP
13.B
14DSApriv* dsagen(DSApub *opub)
15.PP
16.B
17DSAsig* dsasign(DSApriv *k, mpint *m)
18.PP
19.B
20int dsaverify(DSApub *k, DSAsig *sig, mpint *m)
21.PP
22.B
23DSApub* dsapuballoc(void)
24.PP
25.B
26void dsapubfree(DSApub*)
27.PP
28.B
29DSApriv* dsaprivalloc(void)
30.PP
31.B
32void dsaprivfree(DSApriv*)
33.PP
34.B
35DSAsig* dsasigalloc(void)
36.PP
37.B
38void dsasigfree(DSAsig*)
39.PP
40.B
41DSApub* dsaprivtopub(DSApriv*)
42.SH DESCRIPTION
43.PP
44DSA is the NIST approved digital signature algorithm. The owner of a key publishes
45the public part of the key:
46.EX
47 struct DSApub
48 {
49 mpint *p; // modulus
50 mpint *q; // group order, q divides p-1
51 mpint *alpha; // group generator
52 mpint *key; // alpha**secret mod p
53 };
54.EE
55This part can be used for verifying signatures (with
56.IR dsaverify )
57created by the owner.
58The owner signs (with
59.IR dsasign )
60using his private key:
61.EX
62 struct DSApriv
63 {
64 DSApub pub;
65 mpint *secret; // (decryption key)
66 };
67.EE
68.PP
69Keys are generated using
70.IR dsagen .
71If
72.IR dsagen 's
73argument
74.I opub
75is
76.BR nil ,
77a key is created using a new
78.B p
79and
80.B q
81generated by
rscbf8a59f2004-04-11 03:42:27 +000082.IR DSAprimes (3).
rsccfa37a72004-04-10 18:53:55 +000083Otherwise,
84.B p
85and
86.B q
87are copied from the old key.
88.PP
89.I Dsaprivtopub
90returns a newly allocated copy of the public key
91corresponding to the private key.
92.PP
93The routines
94.IR dsapuballoc ,
95.IR dsapubfree ,
96.IR dsaprivalloc ,
97and
98.I dsaprivfree
99are provided to manage key storage.
100.PP
101.I Dsasign
102signs message
103.I m
104using a private key
105.I k
106yielding a
107.EX
108 struct DSAsig
109 {
110 mpint *r, *s;
111 };
112.EE
113.I Dsaverify
114returns 0 if the signature is valid and \-1 if not.
115.PP
116The routines
117.I dsasigalloc
118and
119.I dsasigfree
120are provided to manage signature storage.
121.SH SOURCE
rscb5fdffe2004-04-19 19:22:56 +0000122.B /usr/local/plan9/src/libsec
rsccfa37a72004-04-10 18:53:55 +0000123.SH SEE ALSO
rscbf8a59f2004-04-11 03:42:27 +0000124.IR mp (3),
125.IR aes (3),
126.IR blowfish (3),
127.IR des (3),
128.IR rc4 (3),
129.IR rsa (3),
130.IR sechash (3),
131.IR prime (3),
132.IR rand (3)