1*ebfedea0SLionel Sambuc=pod 2*ebfedea0SLionel Sambuc 3*ebfedea0SLionel Sambuc=head1 NAME 4*ebfedea0SLionel Sambuc 5*ebfedea0SLionel Sambucdsa - Digital Signature Algorithm 6*ebfedea0SLionel Sambuc 7*ebfedea0SLionel Sambuc=head1 SYNOPSIS 8*ebfedea0SLionel Sambuc 9*ebfedea0SLionel Sambuc #include <openssl/dsa.h> 10*ebfedea0SLionel Sambuc #include <openssl/engine.h> 11*ebfedea0SLionel Sambuc 12*ebfedea0SLionel Sambuc DSA * DSA_new(void); 13*ebfedea0SLionel Sambuc void DSA_free(DSA *dsa); 14*ebfedea0SLionel Sambuc 15*ebfedea0SLionel Sambuc int DSA_size(const DSA *dsa); 16*ebfedea0SLionel Sambuc 17*ebfedea0SLionel Sambuc DSA * DSA_generate_parameters(int bits, unsigned char *seed, 18*ebfedea0SLionel Sambuc int seed_len, int *counter_ret, unsigned long *h_ret, 19*ebfedea0SLionel Sambuc void (*callback)(int, int, void *), void *cb_arg); 20*ebfedea0SLionel Sambuc 21*ebfedea0SLionel Sambuc DH * DSA_dup_DH(const DSA *r); 22*ebfedea0SLionel Sambuc 23*ebfedea0SLionel Sambuc int DSA_generate_key(DSA *dsa); 24*ebfedea0SLionel Sambuc 25*ebfedea0SLionel Sambuc int DSA_sign(int dummy, const unsigned char *dgst, int len, 26*ebfedea0SLionel Sambuc unsigned char *sigret, unsigned int *siglen, DSA *dsa); 27*ebfedea0SLionel Sambuc int DSA_sign_setup(DSA *dsa, BN_CTX *ctx, BIGNUM **kinvp, 28*ebfedea0SLionel Sambuc BIGNUM **rp); 29*ebfedea0SLionel Sambuc int DSA_verify(int dummy, const unsigned char *dgst, int len, 30*ebfedea0SLionel Sambuc const unsigned char *sigbuf, int siglen, DSA *dsa); 31*ebfedea0SLionel Sambuc 32*ebfedea0SLionel Sambuc void DSA_set_default_method(const DSA_METHOD *meth); 33*ebfedea0SLionel Sambuc const DSA_METHOD *DSA_get_default_method(void); 34*ebfedea0SLionel Sambuc int DSA_set_method(DSA *dsa, const DSA_METHOD *meth); 35*ebfedea0SLionel Sambuc DSA *DSA_new_method(ENGINE *engine); 36*ebfedea0SLionel Sambuc const DSA_METHOD *DSA_OpenSSL(void); 37*ebfedea0SLionel Sambuc 38*ebfedea0SLionel Sambuc int DSA_get_ex_new_index(long argl, char *argp, int (*new_func)(), 39*ebfedea0SLionel Sambuc int (*dup_func)(), void (*free_func)()); 40*ebfedea0SLionel Sambuc int DSA_set_ex_data(DSA *d, int idx, char *arg); 41*ebfedea0SLionel Sambuc char *DSA_get_ex_data(DSA *d, int idx); 42*ebfedea0SLionel Sambuc 43*ebfedea0SLionel Sambuc DSA_SIG *DSA_SIG_new(void); 44*ebfedea0SLionel Sambuc void DSA_SIG_free(DSA_SIG *a); 45*ebfedea0SLionel Sambuc int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp); 46*ebfedea0SLionel Sambuc DSA_SIG *d2i_DSA_SIG(DSA_SIG **v, unsigned char **pp, long length); 47*ebfedea0SLionel Sambuc 48*ebfedea0SLionel Sambuc DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); 49*ebfedea0SLionel Sambuc int DSA_do_verify(const unsigned char *dgst, int dgst_len, 50*ebfedea0SLionel Sambuc DSA_SIG *sig, DSA *dsa); 51*ebfedea0SLionel Sambuc 52*ebfedea0SLionel Sambuc DSA * d2i_DSAPublicKey(DSA **a, unsigned char **pp, long length); 53*ebfedea0SLionel Sambuc DSA * d2i_DSAPrivateKey(DSA **a, unsigned char **pp, long length); 54*ebfedea0SLionel Sambuc DSA * d2i_DSAparams(DSA **a, unsigned char **pp, long length); 55*ebfedea0SLionel Sambuc int i2d_DSAPublicKey(const DSA *a, unsigned char **pp); 56*ebfedea0SLionel Sambuc int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp); 57*ebfedea0SLionel Sambuc int i2d_DSAparams(const DSA *a,unsigned char **pp); 58*ebfedea0SLionel Sambuc 59*ebfedea0SLionel Sambuc int DSAparams_print(BIO *bp, const DSA *x); 60*ebfedea0SLionel Sambuc int DSAparams_print_fp(FILE *fp, const DSA *x); 61*ebfedea0SLionel Sambuc int DSA_print(BIO *bp, const DSA *x, int off); 62*ebfedea0SLionel Sambuc int DSA_print_fp(FILE *bp, const DSA *x, int off); 63*ebfedea0SLionel Sambuc 64*ebfedea0SLionel Sambuc=head1 DESCRIPTION 65*ebfedea0SLionel Sambuc 66*ebfedea0SLionel SambucThese functions implement the Digital Signature Algorithm (DSA). The 67*ebfedea0SLionel Sambucgeneration of shared DSA parameters is described in 68*ebfedea0SLionel SambucL<DSA_generate_parameters(3)|DSA_generate_parameters(3)>; 69*ebfedea0SLionel SambucL<DSA_generate_key(3)|DSA_generate_key(3)> describes how to 70*ebfedea0SLionel Sambucgenerate a signature key. Signature generation and verification are 71*ebfedea0SLionel Sambucdescribed in L<DSA_sign(3)|DSA_sign(3)>. 72*ebfedea0SLionel Sambuc 73*ebfedea0SLionel SambucThe B<DSA> structure consists of several BIGNUM components. 74*ebfedea0SLionel Sambuc 75*ebfedea0SLionel Sambuc struct 76*ebfedea0SLionel Sambuc { 77*ebfedea0SLionel Sambuc BIGNUM *p; // prime number (public) 78*ebfedea0SLionel Sambuc BIGNUM *q; // 160-bit subprime, q | p-1 (public) 79*ebfedea0SLionel Sambuc BIGNUM *g; // generator of subgroup (public) 80*ebfedea0SLionel Sambuc BIGNUM *priv_key; // private key x 81*ebfedea0SLionel Sambuc BIGNUM *pub_key; // public key y = g^x 82*ebfedea0SLionel Sambuc // ... 83*ebfedea0SLionel Sambuc } 84*ebfedea0SLionel Sambuc DSA; 85*ebfedea0SLionel Sambuc 86*ebfedea0SLionel SambucIn public keys, B<priv_key> is NULL. 87*ebfedea0SLionel Sambuc 88*ebfedea0SLionel SambucNote that DSA keys may use non-standard B<DSA_METHOD> implementations, 89*ebfedea0SLionel Sambuceither directly or by the use of B<ENGINE> modules. In some cases (eg. an 90*ebfedea0SLionel SambucENGINE providing support for hardware-embedded keys), these BIGNUM values 91*ebfedea0SLionel Sambucwill not be used by the implementation or may be used for alternative data 92*ebfedea0SLionel Sambucstorage. For this reason, applications should generally avoid using DSA 93*ebfedea0SLionel Sambucstructure elements directly and instead use API functions to query or 94*ebfedea0SLionel Sambucmodify keys. 95*ebfedea0SLionel Sambuc 96*ebfedea0SLionel Sambuc=head1 CONFORMING TO 97*ebfedea0SLionel Sambuc 98*ebfedea0SLionel SambucUS Federal Information Processing Standard FIPS 186 (Digital Signature 99*ebfedea0SLionel SambucStandard, DSS), ANSI X9.30 100*ebfedea0SLionel Sambuc 101*ebfedea0SLionel Sambuc=head1 SEE ALSO 102*ebfedea0SLionel Sambuc 103*ebfedea0SLionel SambucL<bn(3)|bn(3)>, L<dh(3)|dh(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>, 104*ebfedea0SLionel SambucL<rsa(3)|rsa(3)>, L<sha(3)|sha(3)>, L<engine(3)|engine(3)>, 105*ebfedea0SLionel SambucL<DSA_new(3)|DSA_new(3)>, 106*ebfedea0SLionel SambucL<DSA_size(3)|DSA_size(3)>, 107*ebfedea0SLionel SambucL<DSA_generate_parameters(3)|DSA_generate_parameters(3)>, 108*ebfedea0SLionel SambucL<DSA_dup_DH(3)|DSA_dup_DH(3)>, 109*ebfedea0SLionel SambucL<DSA_generate_key(3)|DSA_generate_key(3)>, 110*ebfedea0SLionel SambucL<DSA_sign(3)|DSA_sign(3)>, L<DSA_set_method(3)|DSA_set_method(3)>, 111*ebfedea0SLionel SambucL<DSA_get_ex_new_index(3)|DSA_get_ex_new_index(3)>, 112*ebfedea0SLionel SambucL<RSA_print(3)|RSA_print(3)> 113*ebfedea0SLionel Sambuc 114*ebfedea0SLionel Sambuc=cut 115