bits = 0; fprintf(f, "%u", bits); if (write_bignum(f, key->dsa->p) && write_bignum(f, key->dsa->q) && write_bignum(f, key->dsa->g) && write_bignum(f, key->dsa->pub_key)) { success = 1; } else { error("key_write: failed for DSA key"); }
int len, n; unsigned char *blob, *uu; dsa_make_key_blob(key, &blob, &len); uu = xmalloc(2*len); n = uuencode(blob, len, uu); fprintf(f, "%s %s", SSH_DSS, uu); xfree(blob); xfree(uu); success = 1;
key_write(Key *key, FILE *f){	int success = 0;	unsigned int bits = 0;	if (key->type == KEY_RSA && key->rsa != NULL) {		/* size of modulus 'n' */		bits = BN_num_bits(key->rsa->n);		fprintf(f, "%u", bits);		if (write_bignum(f, key->rsa->e) &&		    write_bignum(f, key->rsa->n)) {			success = 1;		} else {			error("key_write: failed for RSA key");		}	} else if (key->type == KEY_DSA && key->dsa != NULL) {		/* bits == 0 means DSA key */		bits = 0;		fprintf(f, "%u", bits);		if (write_bignum(f, key->dsa->p) &&		    write_bignum(f, key->dsa->q) &&		    write_bignum(f, key->dsa->g) &&		    write_bignum(f, key->dsa->pub_key)) {			success = 1;		} else {			error("key_write: failed for DSA key");		}	}	return success;}