Exemplo n.º 1
0
int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent,
                       unsigned long flags)
{
    if (flags == XN_FLAG_COMPAT)
        return X509_NAME_print(out, nm, indent);
    return do_name_ex(send_bio_chars, out, nm, indent, flags);
}
Exemplo n.º 2
0
/**
 * functionName : pkcs7_recip_print  
 * @Param : PKCS7_RECIP_INFO *recip [ recipient information ]
 * Brief  : 
 *		print recipient information in detail
 * return :  null
 */
void pkcs7_recip_print(PKCS7_RECIP_INFO *recip){
	long version,serail;

	printf("****************************************************************\n");
	printf("recipient info print...\n");
	version = ASN1_INTEGER_get(recip->version);
	printf("version:\t%d\n",version);
	
//	printf("ISSUER AND SERIAL\n");
	serail = ASN1_INTEGER_get(recip->issuer_and_serial->serial); 
	printf("serial:\t%ld\n",serail);
	printf("ISSUER INFO:\t");
	BIO *out = BIO_new(BIO_s_file());
	BIO_set_fp(out,stdout,BIO_NOCLOSE);
	X509_NAME_print(out,recip->issuer_and_serial->issuer,0);
	BIO_free(out);
	printf("\n");

	printf("KEY ENCRYPT ALGORITHM:\t");
	out = BIO_new(BIO_s_file());
	X509_ALGOR_print(out,recip->key_enc_algor);
	BIO_free(out);

	printf("ENCRYPT KEY:");
	asn1_octet_string_print(recip->enc_key);

	printf("recipient info print end ...\n");
	printf("****************************************************************\n");
				
}
Exemplo n.º 3
0
int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long flags)
{
	if(flags == XN_FLAG_COMPAT)
		{
		BIO *btmp;
		int ret;
		btmp = BIO_new_fp(fp, BIO_NOCLOSE);
		if(!btmp) return -1;
		ret = X509_NAME_print(btmp, nm, indent);
		BIO_free(btmp);
		return ret;
		}
	return do_name_ex(send_fp_chars, fp, nm, indent, flags);
}
Exemplo n.º 4
0
void print_dn(FILE *f, CK_ULONG type, CK_VOID_PTR value,
              CK_ULONG size, CK_VOID_PTR arg)
{
    print_generic(f, type, value, size, arg);
#ifdef HAVE_OPENSSL
    if(size && value) {
        X509_NAME *name;
        name = d2i_X509_NAME(NULL, (const unsigned char **)&value, size);
        if(name) {
            BIO *bio = BIO_new(BIO_s_file());
            BIO_set_fp(bio, f, BIO_NOCLOSE);
            fprintf(f, "    DN: ");
            X509_NAME_print(bio, name, XN_FLAG_RFC2253);
            fprintf(f, "\n");
            BIO_free(bio);
        }
    }
#endif
}
Exemplo n.º 5
0
/**
 * functionName : signer_info_print
 * @Param : PKCS7_SIGNER_INFO *info [ signer information ]
 * Brief  : 
 *		print signer info with PKCS7_SIGNER_INFO type
 * return :  null
 */
void signer_info_print(PKCS7_SIGNER_INFO*info){
	long version,serail;

	printf("****************************************************************\n");
	printf("signer_info_print...\n");
	version =  ASN1_INTEGER_get(info->version);			
	printf("version:%d\n",version);

//	printf("ISSUER AND SERIAL\n");
	serail = ASN1_INTEGER_get(info->issuer_and_serial->serial); 
	printf("serial:%ld\n",serail);
	printf("ISSUER INFO:");
	BIO *out = BIO_new(BIO_s_file());
	BIO_set_fp(out,stdout,BIO_NOCLOSE);
	X509_NAME_print(out,info->issuer_and_serial->issuer,0);
	BIO_free(out);
	printf("\n");

	printf("DIGEST_ALGORITHM:");
	BIO *b_alg = BIO_new(BIO_s_file());
	X509_ALGOR_print(b_alg,info->digest_alg);
	BIO_free(b_alg);

	printf("DIGEST_ENCRYPT_ALGORITHM:");
	BIO *b_enc_alg = BIO_new(BIO_s_file());
	X509_ALGOR_print(b_enc_alg,info->digest_enc_alg);
	BIO_free(b_enc_alg);

	printf("ENCRYPT DIGEST:");
	BIO *b_enc_dig = BIO_new(BIO_s_file());
	BIO_set_fp(b_enc_dig,stdout,BIO_NOCLOSE);	
	i2a_ASN1_STRING(b_enc_dig,info->enc_digest,1);
	BIO_free(b_enc_dig);
	printf("\n");

	printf("signer_info_print... END\n");	
	printf("****************************************************************\n");
}