예제 #1
0
파일: p1024.c 프로젝트: 002301/node
main()
	{
	DH *dh;

	dh=DH_new();
	dh->p=BN_bin2bn(data,sizeof(data),NULL);
	dh->g=BN_new();
	BN_set_word(dh->g,2);
	PEM_write_DHparams(stdout,dh);
	}
예제 #2
0
main()
	{
	DH *dh;

	dh=DH_new();
	dh->p=BN_bin2bn(data,sizeof(data),NULL);
	dh->g=BN_new();
	BN_set_word(dh->g,2);
	PEM_write_DHparams(OPENSSL_TYPE__FILE_STDOUT,dh);
	}
예제 #3
0
파일: 2cca.c 프로젝트: randunel/2cca
int generate_dhparam(int dh_bits)
{
    DH * dh ;
    char filename[FIELD_SZ+1];
    FILE * out;

    sprintf(filename, "dh%d.pem", dh_bits);
    if ((out=fopen(filename, "wb"))==NULL) {
        fprintf(stderr, "Cannot create %s: aborting\n", filename);
        return -1;
    }
    dh = DH_new();
    printf("Generating DH parameters (%d bits) -- this can take long\n", dh_bits);
    DH_generate_parameters_ex(dh, dh_bits, DH_GENERATOR_2, 0);
    PEM_write_DHparams(out, dh);
    fclose(out);
    printf("done\n");
    return 0;
}
예제 #4
0
		inline void dh_key::write_parameters(file _file) const
		{
			throw_error_if_not(PEM_write_DHparams(_file.raw(), ptr().get()) != 0);
		}