diff options
author | sangsu <sangsu.choi@samsung.com> | 2016-06-08 10:17:41 +0900 |
---|---|---|
committer | sangsu <sangsu.choi@samsung.com> | 2016-06-08 10:18:15 +0900 |
commit | a39386a3afe2d7e0cc717a49f970f53d974fda53 (patch) | |
tree | d6deb781410d96006a58fcfcaa8f31ffcc139523 /doc/texi/coding.c.texi | |
parent | d2521ee04e00e1c060001d5d67c1cf0bd23ec260 (diff) | |
download | libtasn1-a39386a3afe2d7e0cc717a49f970f53d974fda53.tar.gz libtasn1-a39386a3afe2d7e0cc717a49f970f53d974fda53.tar.bz2 libtasn1-a39386a3afe2d7e0cc717a49f970f53d974fda53.zip |
Imported Upstream version 4.8upstream/4.8submit/upstream/20160613.071414
Change-Id: I25e57ece28b9ebb637a2b7356f57e11b7f2eb807
Signed-off-by: sangsu <sangsu.choi@samsung.com>
Diffstat (limited to 'doc/texi/coding.c.texi')
-rw-r--r-- | doc/texi/coding.c.texi | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/doc/texi/coding.c.texi b/doc/texi/coding.c.texi new file mode 100644 index 0000000..7ffdb35 --- /dev/null +++ b/doc/texi/coding.c.texi @@ -0,0 +1,111 @@ +@subheading asn1_length_der +@anchor{asn1_length_der} +@deftypefun {void} {asn1_length_der} (unsigned long int @var{len}, unsigned char * @var{der}, int * @var{der_len}) +@var{len}: value to convert. + +@var{der}: buffer to hold the returned encoding (may be @code{NULL} ). + +@var{der_len}: number of meaningful bytes of ANS (der[0]..der[der_len-1]). + +Creates the DER encoding of the provided length value. +The @code{der} buffer must have enough room for the output. The maximum +length this function will encode is @code{ASN1_MAX_LENGTH_SIZE} . + +To know the size of the DER encoding use a @code{NULL} value for @code{der} . +@end deftypefun + +@subheading asn1_octet_der +@anchor{asn1_octet_der} +@deftypefun {void} {asn1_octet_der} (const unsigned char * @var{str}, int @var{str_len}, unsigned char * @var{der}, int * @var{der_len}) +@var{str}: the input data. + +@var{str_len}: STR length (str[0]..str[*str_len-1]). + +@var{der}: encoded string returned. + +@var{der_len}: number of meaningful bytes of DER (der[0]..der[der_len-1]). + +Creates a length-value DER encoding for the input data. +The DER encoding of the input data will be placed in the @code{der} variable. + +Note that the OCTET STRING tag is not included in the output. + +This function does not return any value because it is expected +that @code{der_len} will contain enough bytes to store the string +plus the DER encoding. The DER encoding size can be obtained using +@code{asn1_length_der()} . +@end deftypefun + +@subheading asn1_encode_simple_der +@anchor{asn1_encode_simple_der} +@deftypefun {int} {asn1_encode_simple_der} (unsigned int @var{etype}, const unsigned char * @var{str}, unsigned int @var{str_len}, unsigned char * @var{tl}, unsigned int * @var{tl_len}) +@var{etype}: The type of the string to be encoded (ASN1_ETYPE_) + +@var{str}: the string data. + +@var{str_len}: the string length + +@var{tl}: the encoded tag and length + +@var{tl_len}: the bytes of the @code{tl} field + +Creates the DER encoding for various simple ASN.1 types like strings etc. +It stores the tag and length in @code{tl} , which should have space for at least +@code{ASN1_MAX_TL_SIZE} bytes. Initially @code{tl_len} should contain the size of @code{tl} . + +The complete DER encoding should consist of the value in @code{tl} appended +with the provided @code{str} . + +@strong{Returns:} @code{ASN1_SUCCESS} if successful or an error value. +@end deftypefun + +@subheading asn1_bit_der +@anchor{asn1_bit_der} +@deftypefun {void} {asn1_bit_der} (const unsigned char * @var{str}, int @var{bit_len}, unsigned char * @var{der}, int * @var{der_len}) +@var{str}: BIT string. + +@var{bit_len}: number of meaningful bits in STR. + +@var{der}: string returned. + +@var{der_len}: number of meaningful bytes of DER +(der[0]..der[ans_len-1]). + +Creates a length-value DER encoding for the input data +as it would have been for a BIT STRING. +The DER encoded data will be copied in @code{der} . + +Note that the BIT STRING tag is not included in the output. + +This function does not return any value because it is expected +that @code{der_len} will contain enough bytes to store the string +plus the DER encoding. The DER encoding size can be obtained using +@code{asn1_length_der()} . +@end deftypefun + +@subheading asn1_der_coding +@anchor{asn1_der_coding} +@deftypefun {int} {asn1_der_coding} (asn1_node @var{element}, const char * @var{name}, void * @var{ider}, int * @var{len}, char * @var{ErrorDescription}) +@var{element}: pointer to an ASN1 element + +@var{name}: the name of the structure you want to encode (it must be +inside *POINTER). + +@var{ider}: vector that will contain the DER encoding. DER must be a +pointer to memory cells already allocated. + +@var{len}: number of bytes of * @code{ider} : @code{ider} [0].. @code{ider} [len-1], Initialy +holds the sizeof of der vector. + +@var{ErrorDescription}: return the error description or an empty +string if success. + +Creates the DER encoding for the NAME structure (inside *POINTER +structure). + +@strong{Returns:} @code{ASN1_SUCCESS} if DER encoding OK, @code{ASN1_ELEMENT_NOT_FOUND} +if @code{name} is not a valid element, @code{ASN1_VALUE_NOT_FOUND} if there +is an element without a value, @code{ASN1_MEM_ERROR} if the @code{ider} vector isn't big enough and in this case @code{len} will contain the +length needed. +@end deftypefun + |