Cryptography Reference
In-Depth Information
case ASN1_BIT_STRING:
case ASN1_OCTET_STRING:
case ASN1_OBJECT_IDENTIFIER:
{
int i;
for ( i = 0; i < token->length; i++ )
{
printf( “%.02x “, token->data[ i ] );
}
}
break;
case ASN1_NUMERIC_STRING:
case ASN1_PRINTABLE_STRING:
case ASN1_TELETEX_STRING:
case ASN1_VIDEOTEX_STRING:
case ASN1_IA5_STRING:
case ASN1_UTC_TIME:
case ASN1_GENERALIZED_TIME:
case ASN1_GRAPHIC_STRING:
case ASN1_VISIBLE_STRING:
case ASN1_GENERAL_STRING:
case ASN1_UNIVERSAL_STRING:
case ASN1_CHARACTER_STRING:
case ASN1_BMP_STRING:
case ASN1_UTF8_STRING:
{
char *str_val = ( char * ) malloc( token->length + 1 );
strncpy( str_val, ( char * ) token->data, token->length );
str_val[ token->length ] = 0;
printf( “ %s”, str_val );
free( str_val );
}
break;
default:
break;
}
}
printf( “\n” );
if ( token->children )
{
asn1show( depth + 1, token->children );
}
token = token->next;
}
}
If you run this on a DER-encoded certifi cate fi le, you get an output similar
to Table 5-6 (this was, in fact, how that table was generated). However, when
most software saves certifi cate fi les, it doesn't do it in DER form; it uses PEM
Search WWH ::




Custom Search