Đang chuẩn bị liên kết để tải về tài liệu:
cryptography for developers 2006 phần 3
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
hoặc DER quy tắc có thể được áp dụng cho them.The các đặc điểm kỹ thuật ASN.1 thực tế hoàn toàn phức tạp hơn nhiều hơn so với yêu cầu của các tác vụ mã hóa trung bình. Chúng tôi sẽ chỉ nhìn vào các quy tắc DER, vì họ là những gì hầu hết các tiêu chuẩn mã hóa đòi hỏi. Nó cũng cần lưu ý rằng chúng ta sẽ không được hỗ trợ | ASN.1 Encoding Chapter 2 67 025 e 101 f 102 g 103 h 104 026 i 105 j . 106 k 107 l 108 027 m 109 n 110 o 111 p 112 028 q 113 r . 114 s 115 t 116 029 u 117 v 118 w 119 x 120 030 y 121 z 122 123 124 031 125 . 126 For the interested reader it is possible to save space both in the table and in the code space. If a third parameter were added to the table to say which code type the symbol belonged to e.g. IA5 or PRINTABLE a single encode decoder could be written with an additional input argument specifying which target code we are trying to use. For the sake of simplicity the routines demonstrated were implemented individually. They are fairly small and in the grand scheme of things are not significant code size contributors. UTCTIME Encodings UTCTIME encoding has been simplified in the 2002 specifications to only include one format.The time is encoded as a string in the format YYMMDDHHMMSSZ using two digits per component. The year is encoded by examining the last two digits. Nothing beyond the year 2069 can be encoded with this format as it will be interpreted as 1970 of course by that time we can just reprogram the software to treat it as 2070 . Despite the Y2K debacle they still used two digits for the date. The actual byte encoding of the string is using the ASCII code and fortunately we have to look no further than our PRINTABLE STRING routines for help. To efficiently handle dates we require some structure to hold the parameters. We could just pass all six of them as arguments to the function. However a more useful way as we shall see when dealing with SEQUENCE types is to have a structure. This structure is stored in our ASN.1 header file. asnl.h 119 UTCTIME 120 typedef struct 121 int year 122 month 123 day 124 hour 125 min 126 sec 127 UTCTIME We have made this a type so that we can simply pass UTCTIME instead of struct UTCTIME. www.syngress.com 68 Chapter 2 ASN.1 Encoding der_utctime_length.c 001 include asnl.h 002 unsigned long der_utctime_length void 003 004 .