Commit 28647743 authored by Lev Walkin's avatar Lev Walkin

comments added to highlight transfer syntax compatibility

parent 9023deaf
...@@ -22,21 +22,6 @@ ...@@ -22,21 +22,6 @@
./x509dump -h ./x509dump -h
3.Q: Your compiler supplies a der_encode() procedure. How do I encode BER?
3.A:
The DER (and CER) are stricter subsets of a more generic BER encoding
method. If you encode data with DER or CER, all BER-conformant decoders
will easily understand that. Hence, to encode data in the BER format,
simply use the DER encoder, der_encode().
See also: ISO/IEC 8825-1 / X.690:
"ASN.1 encoding rules: Specification of
Basic Encoding Rules (BER),
Canonical Encoding Rules (CER) and
Distinguished Encoding Rules (DER)"
-- --
Lev Walkin Lev Walkin
vlm@lionet.info vlm@lionet.info
...@@ -17,7 +17,10 @@ struct asn_codec_ctx_s; /* Forward declaration */ ...@@ -17,7 +17,10 @@ struct asn_codec_ctx_s; /* Forward declaration */
/* /*
* The BER decoder of any type. * The BER decoder of any type.
* This function may be invoked directly from the application. * This function may be invoked directly from the application.
* The der_encode() function (der_encoder.h) is an opposite to ber_decode(). * Decodes BER, DER and CER data (DER and CER are different subsets of BER).
*
* NOTE: Use the der_encode() function (der_encoder.h) to produce encoding
* which is compliant with ber_decode().
*/ */
asn_dec_rval_t ber_decode(struct asn_codec_ctx_s *opt_codec_ctx, asn_dec_rval_t ber_decode(struct asn_codec_ctx_s *opt_codec_ctx,
struct asn_TYPE_descriptor_s *type_descriptor, struct asn_TYPE_descriptor_s *type_descriptor,
......
...@@ -15,7 +15,10 @@ struct asn_TYPE_descriptor_s; /* Forward declaration */ ...@@ -15,7 +15,10 @@ struct asn_TYPE_descriptor_s; /* Forward declaration */
/* /*
* The DER encoder of any type. May be invoked by the application. * The DER encoder of any type. May be invoked by the application.
* The ber_decode() function (ber_decoder.h) is an opposite of der_encode(). * Produces DER- and BER-compliant encoding. (DER is a subset of BER).
*
* NOTE: Use the ber_decode() function (ber_decoder.h) to decode data
* produced by der_encode().
*/ */
asn_enc_rval_t der_encode(struct asn_TYPE_descriptor_s *type_descriptor, asn_enc_rval_t der_encode(struct asn_TYPE_descriptor_s *type_descriptor,
void *struct_ptr, /* Structure to be encoded */ void *struct_ptr, /* Structure to be encoded */
......
...@@ -18,6 +18,7 @@ struct asn_codec_ctx_s; /* Forward declaration */ ...@@ -18,6 +18,7 @@ struct asn_codec_ctx_s; /* Forward declaration */
/* /*
* The Octet Encoding Rules (OER, X.696 08/2015) decoder for any given type. * The Octet Encoding Rules (OER, X.696 08/2015) decoder for any given type.
* This function may be invoked directly by the application. * This function may be invoked directly by the application.
* Parses CANONICAL-OER and BASIC-OER.
*/ */
asn_dec_rval_t oer_decode(struct asn_codec_ctx_s *opt_codec_ctx, asn_dec_rval_t oer_decode(struct asn_codec_ctx_s *opt_codec_ctx,
struct asn_TYPE_descriptor_s *type_descriptor, struct asn_TYPE_descriptor_s *type_descriptor,
......
...@@ -16,6 +16,8 @@ struct asn_TYPE_descriptor_s; /* Forward declaration */ ...@@ -16,6 +16,8 @@ struct asn_TYPE_descriptor_s; /* Forward declaration */
/* /*
* The Octet Encoding Rules (OER, X.696 08/2015) encoder for any type. * The Octet Encoding Rules (OER, X.696 08/2015) encoder for any type.
* This function may be invoked directly by the application. * This function may be invoked directly by the application.
* Produces CANONICAL-OER output compatible with CANONICAL-OER
* and BASIC-OER decoders.
*/ */
asn_enc_rval_t oer_encode(struct asn_TYPE_descriptor_s *type_descriptor, asn_enc_rval_t oer_encode(struct asn_TYPE_descriptor_s *type_descriptor,
void *struct_ptr, /* Structure to be encoded */ void *struct_ptr, /* Structure to be encoded */
......
...@@ -15,6 +15,7 @@ struct asn_TYPE_descriptor_s; /* Forward declaration */ ...@@ -15,6 +15,7 @@ struct asn_TYPE_descriptor_s; /* Forward declaration */
/* /*
* The XER decoder of any ASN.1 type. May be invoked by the application. * The XER decoder of any ASN.1 type. May be invoked by the application.
* Decodes CANONICAL-XER and BASIC-XER.
*/ */
asn_dec_rval_t xer_decode(struct asn_codec_ctx_s *opt_codec_ctx, asn_dec_rval_t xer_decode(struct asn_codec_ctx_s *opt_codec_ctx,
struct asn_TYPE_descriptor_s *type_descriptor, struct asn_TYPE_descriptor_s *type_descriptor,
......
...@@ -22,6 +22,7 @@ enum xer_encoder_flags_e { ...@@ -22,6 +22,7 @@ enum xer_encoder_flags_e {
/* /*
* The XER encoder of any type. May be invoked by the application. * The XER encoder of any type. May be invoked by the application.
* Produces CANONICAL-XER and BASIC-XER depending on the (xer_flags).
*/ */
asn_enc_rval_t xer_encode(struct asn_TYPE_descriptor_s *type_descriptor, asn_enc_rval_t xer_encode(struct asn_TYPE_descriptor_s *type_descriptor,
void *struct_ptr, /* Structure to be encoded */ void *struct_ptr, /* Structure to be encoded */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment