DSA(3)
π DSA(3) π
okay so bestie, you're reading the DSA(3) page from the Library Functions Manual β digital signature algorithm edition. no cap, we're keeping every detail. β¨
πΈ NAME πΈ
asn1toDSApriv, dsagen, dsasign, dsaverify, dsapuballoc, dsapubfree, dsaprivalloc, dsaprivfree, dsasigalloc, dsasigfree, dsaprivtopub β the digital signature algorithm crew. π«Ά
β¨ SYNOPSIS β¨
#include <u.h>
#include <libc.h>
#include <mp.h>
#include <libsec.h>
DSApriv* dsagen(DSApub *opub)
DSAsig* dsasign(DSApriv *k, mpint *m)
int dsaverify(DSApub *k, DSAsig *sig, mpint *m)
DSApub* dsapuballoc(void)
void dsapubfree(DSApub*)
DSApriv* dsaprivalloc(void)
void dsaprivfree(DSApriv*)
DSAsig* dsasigalloc(void)
void dsasigfree(DSAsig*)
DSApub* dsaprivtopub(DSApriv*)
DSApriv* asn1toDSApriv(uchar *priv, int npriv)
π DESCRIPTION π
DSA is the NIST approved digital signature algorithm. The owner of a key publishes the public part of the key:
struct DSApub
{
mpint *p; // modulus
mpint *q; // group order, q divides p-1
mpint *alpha; // group generator
mpint *key; // alpha**secret mod p
};
That public part is main character energy for verifying signatures (with dsaverify) created by the owner. The owner signs (with dsasign) using his private key:
struct DSApriv
{
DSApub pub;
mpint *secret; // (decryption key)
};
Keys are generated using dsagen. If dsagen's argument opub is nil, a key is created using a new p and q generated by DSAprimes (see prime(3)). Otherwise, p and q are copied from the old key. iykyk π
dsaprivtopub returns a newly allocated copy of the public key corresponding to the private key. slay.
The routines dsapuballoc, dsapubfree, dsaprivalloc, and dsaprivfree are provided to manage key storage. storage management ate, honestly. π
dsasign signs message m using a private key k, yielding a
struct DSAsig
{
mpint *r, *s;
};
dsaverify returns 0 if the signature is valid and -1 if not. vibe check passed = 0, bestie. β
The routines dsasigalloc and dsasigfree are provided to manage signature storage.
asn1toDSApriv converts an ASN1 formatted DSA private key into the corresponding DSApriv structure; see rsa(3) for other ASN1 routines. π¦
π¦ SOURCE π¦
/src/libsec β that's the source, periodt. π
π SEE ALSO π
go peek at these too, bestie:
bestie sign-off: this is DSA(3) from the Library Functions Manual, source is /src/libsec, and the footer/manual line is literally DSA(3) β no date is shown on this page, so I'm not inventing one. π
β¨π«Ά
π¦ where this page comes from
- alpine 3.24: plan9port-doc 0_git20260208-r0 Β· LPL-1.02
- arch rolling: plan9port 20261021-2 Β· custom
- nixos 26.05: plan9port 0-unstable-2025-11-10
- nixos 26.05: plan9port-wayland 0-unstable-2025-11-26
- nixpkgs unstable: plan9port 0-unstable-2025-11-10
- nixpkgs unstable: plan9port-wayland 0-unstable-2025-11-26
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms