Skip to content

der: add ClarifyWriter #1835

Open
Open
@dishmaker

Description

@dishmaker

I have a pretty well-written #[cfg(feature = "clarify")] - gated writer that pretty-prints DER.

Proposal: To add Encode::to_hex_clarify, that annotates tags and types.

Example of PKCS#15:

30 3E <!-- tag: SEQUENCE len: 62 type: AuthenticationObjectChoice -->
	<!-- CHOICE: Pwd -->
	<!-- field: common_object_attributes -->
	30 1B <!-- tag: SEQUENCE len: 27 type: CommonObjectAttributes -->
		<!-- field: label -->
		0C 12 <!-- tag: UTF8String len: 18 type: String -->
			41 75 74 68 65 6E 74 69 63 61 74 69 6F 6E 20 50 
			49 4E <!--  "Authentication PIN" -->
		<!-- end: String -->
		<!-- field: flags -->
		03 02 <!-- tag: BIT STRING type: CommonObjectFlags -->
			06 
			C0 
		<!-- field: auth_id -->
		04 01 <!-- tag: OCTET STRING type: OctetString -->
			05 
		<!-- field: user_consent -->
		<!-- field: access_control_rules -->
		<!-- field: current_lcs -->
	<!-- end: CommonObjectAttributes -->
	<!-- field: class_attributes -->
	30 03 <!-- tag: SEQUENCE type: CommonAuthenticationObjectAttributes -->
		<!-- field: auth_id -->
		04 01 <!-- tag: OCTET STRING type: OctetString -->
			01 
		<!-- field: auth_reference -->
		<!-- field: se_identifier -->
	<!-- field: subclass_attributes -->
	<!-- field: type_attributes -->
	A1 1A <!-- tag: CONTEXT-SPECIFIC [1] (constructed) len: 26 
                          type: ContextSpecificExplicit<PasswordAttributes> -->
		30 18 <!-- tag: SEQUENCE len: 24 type: PasswordAttributes -->
			<!-- field: pwd_flags -->
			03 03 <!-- tag: BIT STRING type: PasswordFlags -->
				04 
				48 10 
			<!-- field: pwd_type -->
			0A 01 <!-- tag: ENUMERATED type: PasswordType -->
				01 
			<!-- field: min_length -->
			02 01 <!-- tag: INTEGER type: IntegerInRange -->
				04 
			<!-- field: stored_length -->
			02 01 <!-- tag: INTEGER type: IntegerInRange -->
				04 
			<!-- field: max_length -->
			02 01 <!-- tag: INTEGER type: IntegerInRange -->
				04 
			<!-- field: pwd_reference -->
			80 01 <!-- tag: CONTEXT-SPECIFIC [0] (primitive) type: Reference -->
				01 
			<!-- field: pad_char -->
			<!-- field: last_password_change -->
			<!-- field: path -->
			30 02 <!-- tag: SEQUENCE type: Path -->
				<!-- field: efid_or_tag_choice -->
				04 00 <!-- tag: OCTET STRING type: EfidOrTagChoice -->
					<!-- CHOICE: EfidOrPath -->
					
				<!-- field: index -->
				<!-- field: length -->
			<!-- field: verif_data_history_length -->
			<!-- field: cio_security_id -->
		<!-- end: ContextSpecificExplicit<PasswordAttributes> -->
	<!-- end: PasswordAttributes -->
<!-- end: AuthenticationObjectChoice -->

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions