| <head> |
| <title>dsa(3) - Plan 9 from User Space</title> |
| <meta content="text/html; charset=utf-8" http-equiv=Content-Type> |
| </head> |
| <body bgcolor=#ffffff> |
| <table border=0 cellpadding=0 cellspacing=0 width=100%> |
| <tr height=10><td> |
| <tr><td width=20><td> |
| <tr><td width=20><td><b>DSA(3)</b><td align=right><b>DSA(3)</b> |
| <tr><td width=20><td colspan=2> |
| <br> |
| <p><font size=+1><b>NAME </b></font><br> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td> |
| |
| dsagen, dsasign, dsaverify, dsapuballoc, dsapubfree, dsaprivalloc, |
| dsaprivfree, dsasigalloc, dsasigfree, dsaprivtopub - digital signature |
| algorithm<br> |
| |
| </table> |
| <p><font size=+1><b>SYNOPSIS </b></font><br> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td> |
| |
| <tt><font size=+1>#include <u.h><br> |
| #include <libc.h><br> |
| #include <mp.h><br> |
| #include <libsec.h> |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| </font></tt> |
| <tt><font size=+1>DSApriv* dsagen(DSApub *opub) |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| </font></tt> |
| <tt><font size=+1>DSAsig* dsasign(DSApriv *k, mpint *m) |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| </font></tt> |
| <tt><font size=+1>int dsaverify(DSApub *k, DSAsig *sig, mpint *m) |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| </font></tt> |
| <tt><font size=+1>DSApub* dsapuballoc(void) |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| </font></tt> |
| <tt><font size=+1>void dsapubfree(DSApub*) |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| </font></tt> |
| <tt><font size=+1>DSApriv* dsaprivalloc(void) |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| </font></tt> |
| <tt><font size=+1>void dsaprivfree(DSApriv*) |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| </font></tt> |
| <tt><font size=+1>DSAsig* dsasigalloc(void) |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| </font></tt> |
| <tt><font size=+1>void dsasigfree(DSAsig*) |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| </font></tt> |
| <tt><font size=+1>DSApub* dsaprivtopub(DSApriv*)<br> |
| </font></tt> |
| </table> |
| <p><font size=+1><b>DESCRIPTION </b></font><br> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td> |
| |
| DSA is the NIST approved digital signature algorithm. The owner |
| of a key publishes the public part of the key:<br> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td> |
| |
| <tt><font size=+1>struct DSApub<br> |
| {<br> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td> |
| |
| mpint *p; // modulus<br> |
| mpint *q; // group order, q divides p−1<br> |
| mpint *alpha; // group generator<br> |
| mpint *key; // alpha**secret mod p<br> |
| |
| </table> |
| };<br> |
| </font></tt> |
| </table> |
| This part can be used for verifying signatures (with <i>dsaverify</i>) |
| created by the owner. The owner signs (with <i>dsasign</i>) using his |
| private key:<br> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td> |
| |
| <tt><font size=+1>struct DSApriv<br> |
| {<br> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td> |
| |
| DSApub pub;<br> |
| mpint *secret; // (decryption key)<br> |
| |
| </table> |
| };<br> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| </font></tt> |
| |
| </table> |
| Keys are generated using <i>dsagen</i>. If <i>dsagen</i>’s argument <i>opub</i> is |
| <tt><font size=+1>nil</font></tt>, a key is created using a new <tt><font size=+1>p</font></tt> and <tt><font size=+1>q</font></tt> generated by <i>DSAprimes</i> |
| (see <a href="../man3/prime.html"><i>prime</i>(3)</a>). Otherwise, <tt><font size=+1>p</font></tt> and <tt><font size=+1>q</font></tt> are copied from the old key. |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| |
| <i>Dsaprivtopub</i> returns a newly allocated copy of the public key |
| corresponding to the private key. |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| |
| The routines <i>dsapuballoc</i>, <i>dsapubfree</i>, <i>dsaprivalloc</i>, and <i>dsaprivfree</i> |
| are provided to manage key storage. |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| |
| <i>Dsasign</i> signs message <i>m</i> using a private key <i>k</i> yielding a<br> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td> |
| |
| <tt><font size=+1>struct DSAsig<br> |
| {<br> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td> |
| |
| mpint *r, *s;<br> |
| |
| </table> |
| };<br> |
| </font></tt> |
| </table> |
| <i>Dsaverify</i> returns 0 if the signature is valid and –1 if not. |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| |
| The routines <i>dsasigalloc</i> and <i>dsasigfree</i> are provided to manage |
| signature storage.<br> |
| |
| </table> |
| <p><font size=+1><b>SOURCE </b></font><br> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td> |
| |
| <tt><font size=+1>/usr/local/plan9/src/libsec<br> |
| </font></tt> |
| </table> |
| <p><font size=+1><b>SEE ALSO </b></font><br> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td> |
| |
| <a href="../man3/mp.html"><i>mp</i>(3)</a>, <a href="../man3/aes.html"><i>aes</i>(3)</a>, <a href="../man3/blowfish.html"><i>blowfish</i>(3)</a>, <a href="../man3/des.html"><i>des</i>(3)</a>, <a href="../man3/rc4.html"><i>rc4</i>(3)</a>, <a href="../man3/rsa.html"><i>rsa</i>(3)</a>, <a href="../man3/sechash.html"><i>sechash</i>(3)</a>, |
| <a href="../man3/prime.html"><i>prime</i>(3)</a>, <a href="../man3/rand.html"><i>rand</i>(3)</a><br> |
| |
| </table> |
| |
| <td width=20> |
| <tr height=20><td> |
| </table> |
| <!-- TRAILER --> |
| <table border=0 cellpadding=0 cellspacing=0 width=100%> |
| <tr height=15><td width=10><td><td width=10> |
| <tr><td><td> |
| <center> |
| <a href="../../"><img src="../../dist/spaceglenda100.png" alt="Space Glenda" border=1></a> |
| </center> |
| </table> |
| <!-- TRAILER --> |
| </body></html> |