1、Information technology ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER)CAN/CSA-ISO/IEC 8825-1:13(ISO/IEC 8825-1:2008, IDT)National Standard of CanadaNOT FOR RESALE. / PUBLICATION NON DESTINE LA REVENTE.Legal Noti
2、ce for StandardsCanadian Standards Association (operating as “CSA Group”) develops standards through a consensus standards development process approved by the Standards Council of Canada. This process brings together volunteers representing varied viewpoints and interests to achieve consensus and de
3、velop a standard. Although CSA Group administers the process and establishes rules to promote fairness in achieving consensus, it does not independently test, evaluate, or verify the content of standards.Disclaimer and exclusion of liabilityThis document is provided without any representations, warr
4、anties, or conditions of any kind, express or implied, including, without limitation, implied warranties or conditions concerning this documents fitness for a particular purpose or use, its merchantability, or its non-infringement of any third partys intellectual property rights. CSA Group does not
5、warrant the accuracy, completeness, or currency of any of the information published in this document. CSA Group makes no representations or warranties regarding this documents compliance with any applicable statute, rule, or regulation. IN NO EVENT SHALL CSA GROUP, ITS VOLUNTEERS, MEMBERS, SUBSIDIAR
6、IES, OR AFFILIATED COMPANIES, OR THEIR EMPLOYEES, DIRECTORS, OR OFFICERS, BE LIABLE FOR ANY DIRECT, INDIRECT, OR INCIDENTAL DAMAGES, INJURY, LOSS, COSTS, OR EXPENSES, HOWSOEVER CAUSED, INCLUDING BUT NOT LIMITED TO SPECIAL OR CONSEQUENTIAL DAMAGES, LOST REVENUE, BUSINESS INTERRUPTION, LOST OR DAMAGED
7、 DATA, OR ANY OTHER COMMERCIAL OR ECONOMIC LOSS, WHETHER BASED IN CONTRACT, TORT (INCLUDING NEGLIGENCE), OR ANY OTHER THEORY OF LIABILITY, ARISING OUT OF OR RESULTING FROM ACCESS TO OR POSSESSION OR USE OF THIS DOCUMENT, EVEN IF CSA GROUP HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, INJURY,
8、LOSS, COSTS, OR EXPENSES.In publishing and making this document available, CSA Group is not undertaking to render professional or other services for or on behalf of any person or entity or to perform any duty owed by any person or entity to another person or entity. The information in this document
9、is directed to those who have the appropriate degree of experience to use and apply its contents, and CSA Group accepts no responsibility whatsoever arising in any way from any and all use of or reliance on the information contained in this document. CSA Group is a private not-for-profit company tha
10、t publishes voluntary standards and related documents. CSA Group has no power, nor does it undertake, to enforce compliance with the contents of the standards or other documents it publishes. Intellectual property rights and ownershipAs between CSA Group and the users of this document (whether it be
11、 in printed or electronic form), CSA Group is the owner, or the authorized licensee, of all works contained herein that are protected by copyright, all trade-marks (except as otherwise noted to the contrary), and all inventions and trade secrets that may be contained in this document, whether or not
12、 such inventions and trade secrets are protected by patents and applications for patents. Without limitation, the unauthorized use, modification, copying, or disclosure of this document may violate laws that protect CSA Groups and/or others intellectual property and may give rise to a right in CSA G
13、roup and/or others to seek legal redress for such use, modification, copying, or disclosure. To the extent permitted by licence or by law, CSA Group reserves all intellectual property rights in this document.Patent rightsAttention is drawn to the possibility that some of the elements of this standar
14、d may be the subject of patent rights. CSA Group shall not be held responsible for identifying any or all such patent rights. Users of this standard are expressly advised that determination of the validity of any such patent rights is entirely their own responsibility.Authorized use of this document
15、This document is being provided by CSA Group for informational and non-commercial use only. The user of this document is authorized to do only the following:If this document is in electronic form:sLOADTHISDOCUMENTONTOACOMPUTERFORTHESOLEPURPOSEOFREVIEWINGITsSEARCHANDBROWSETHISDOCUMENTANDsPRINTTHISDOC
16、UMENTIFITISIN0$ this remains the continuing responsibility of the SDO. An NSC reflects a consensus of a number of capable individuals whose collective interests provide, to the greatest practicable extent, a balance of representation of general interests, producers, regulators, users (including cons
17、umers), and others with relevant interests, as may be appropriate to the subject in hand. It normally is a standard which is capable of making a significant and timely contribution to the national interest.Those who have a need to apply standards areencouraged to use NSCs. These standards are subjec
18、tto periodic review. Users of NSCs are cautionedto obtain the latest edition from the SDO which publishes the standard.The responsibility for approving standards as National Standards of Canada rests with theStandards Council of Canada270 Albert Street, Suite 200Ottawa, Ontario, K1P 6N7CanadaAlthoug
19、h the intended primary application of this Standard is stated in its Scope, it is importantto note that it remains the responsibility of the users to judge its suitability for their particular purpose.TMA trade-mark of Canadian Standards Association, operating as “CSA Group”Cette norme est offerte e
20、n anglais seulement pour le moment. Le Groupe CSA publiera la versionen franais ds quelle sera produite par lorganisme rdacteur.TMA trade-mark of the Canadian Standards Association, operating as “CSA Group”National Standard of CanadaPublished in January 2013 by CSA GroupA not-for-profit private sect
21、or organization5060 Spectrum Way, Suite 100, Mississauga, Ontario, Canada L4W 5N61-800-463-6727 416-747-4044Visit our Online Store at shop.csa.caApproved byStandards Council of CanadaCAN/CSA-ISO/IEC 8825-1:13Information technology ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Ca
22、nonical Encoding Rules (CER) and Distinguished Encoding Rules (DER)Prepared by InternationalOrganizationforStandardization/ International Electrotechnical CommissionReviewed byCAN/CSA-ISO/IEC 8825-1:13Information technology ASN.1 encoding rules:Specification of Basic Encoding Rules (BER), CanonicalE
23、ncoding Rules (CER) and Distinguished Encoding RulesCSA/4 2013 CSA Group January 2013CAN/CSA-ISO/IEC 8825-1:13Information technology ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER)CSA PrefaceStandards developmen
24、t within the Information Technology sector is harmonized with international standards development. Through the CSA Technical Committee on Information Technology (TCIT), Canadians serve as the Canadian Advisory Committee (CAC) on ISO/IEC Joint Technical Committee 1 on Information Technology (ISO/IEC
25、JTC1) for the Standards Council of Canada (SCC), the ISO member body for Canada and sponsor of the Canadian National Committee of the IEC. Also, as a member of the International Telecommunication Union (ITU), Canada participates in the International Telegraph and Telephone Consultative Committee (IT
26、U-T).This Standard supersedes CAN/CSA-ISO/IEC 8825-1-04 (adoption of ISO/IEC 8825-1:2002).At the time of publication, ISO/IEC 8825-1:2008 is available from ISO and IEC in English only. CSA Group will publish the French version when it becomes available from ISO and IEC.This Standard is considered su
27、itable for use for conformity assessment within the stated scope of the Standard.This International Standard was reviewed by the TCIT under the jurisdiction of the Strategic Steering Committee on Information Technology and deemed acceptable for use in Canada. From time to time, ISO/IEC may publish a
28、ddenda, corrigenda, etc. The TCIT will review these documents for approval and publication. For a listing, refer to the Current Standards Activities page at standardsactivities.csa.ca. This Standard has been formally approved, without modification, by the Technical Committee and has been approved as
29、 a National Standard of Canada by the Standards Council of Canada. 2013 CSA GroupAll rights reserved. No part of this publication may be reproduced in any form whatsoever without the prior permission of the publisher. ISO/IEC material is reprinted with permission. Where the words “this International
30、 Standard” appear in the text, they should be interpreted as “this National Standard of Canada”.Inquiries regarding this National Standard of Canada should be addressed toCSA Group5060 Spectrum Way, Suite 100, Mississauga, Ontario, Canada L4W 5N61-800-463-6727 416-747-4000http:/csa.caTo purchase sta
31、ndards and related publications, visit our Online Store at shop.csa.ca or call toll-free 1-800-463-6727 or 416-747-4044.This Standard is subject to periodic review, and suggestions for its improvement will be referred to the appropriate committee. To submit a proposal for change, please send the fol
32、lowing information to inquiriescsagroup.org and include “Proposal for change” in the subject line:(a) Standard designation (number);(b) relevant clause, table, and/or figure number;Reference numberISO/IEC 8825-1:2008(E)ISO/IEC 2008INTERNATIONAL STANDARD ISO/IEC8825-1Fourth edition2008-12-15Informati
33、on technology ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER) Technologies de linformation Rgles de codage ASN.1: Spcification des rgles de codage de base (BER), des rgles de codage canoniques (CER) et des rgles
34、 de codage distinctives (DER) ISO/IEC 8825-1:2008(E) PDF disclaimer This PDF file may contain embedded typefaces. In accordance with Adobes licensing policy, this file may be printed or viewed but shall not be edited unless the typefaces which are embedded are licensed to and installed on the comput
35、er performing the editing. In downloading this file, parties accept therein the responsibility of not infringing Adobes licensing policy. The ISO Central Secretariat accepts no liability in this area. Adobe is a trademark of Adobe Systems Incorporated. Details of the software products used to create
36、 this PDF file can be found in the General Info relative to the file; the PDF-creation parameters were optimized for printing. Every care has been taken to ensure that the file is suitable for use by ISO member bodies. In the unlikely event that a problem relating to it is found, please inform the C
37、entral Secretariat at the address given below. COPYRIGHT PROTECTED DOCUMENT ISO/IEC 2008 All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means, electronic or mechanical, including photocopying and microfilm, without per
38、mission in writing from either ISO at the address below or ISOs member body in the country of the requester. ISO copyright office Case postale 56 CH-1211 Geneva 20 Tel. + 41 22 749 01 11 Fax + 41 22 749 09 47 E-mail copyrightiso.org Web www.iso.org ii ISO/IEC 2008 All rights reservedCAN/CSA-ISOIEC 8
39、825-1:13ISO/IEC 8825-1:2008(E) ISO/IEC 2008 All rights reserved iiiCONTENTS Page Introduction vi 1 Scope 1 2 Normative references . 1 2.1 Identical Recommendations | International Standards 1 2.2 Additional references 1 3 Definitions 2 4 Abbreviations . 2 5 Notation 2 6 Convention . 3 7 Conformance
40、3 8 Basic encoding rules. 3 8.1 General rules for encoding 3 8.1.1 Structure of an encoding . 3 8.1.2 Identifier octets .4 8.1.3 Length octets.5 8.1.4 Contents octets 6 8.1.5 End-of-contents octets. 6 8.2 Encoding of a boolean value. 6 8.3 Encoding of an integer value 7 8.4 Encoding of an enumerated
41、 value. 7 8.5 Encoding of a real value 7 8.6 Encoding of a bitstring value 8 8.7 Encoding of an octetstring value. 9 8.8 Encoding of a null value .10 8.9 Encoding of a sequence value.10 8.10 Encoding of a sequence-of value 10 8.11 Encoding of a set value .11 8.12 Encoding of a set-of value 11 8.13 E
42、ncoding of a choice value .11 8.14 Encoding of a value of a prefixed type .11 8.15 Encoding of an open type12 8.16 Encoding of an instance-of value12 8.17 Encoding of a value of the embedded-pdv type 12 8.18 Encoding of a value of the external type.12 8.19 Encoding of an object identifier value 14 8
43、.20 Encoding of a relative object identifier value .14 8.21 Encoding of an OID internationalized resource identifier value. 15 8.22 Encoding of a relative OID internationalized resource identifier value 15 8.23 Encoding for values of the restricted character string types . 15 8.24 Encoding for value
44、s of the unrestricted character string type. 17 8.25 Encoding for values of the Useful Types 17 8.26 Encoding for values of the TIME type and the useful time types . 17 8.26.1 Encoding for values of the TIME type 17 8.26.2 Encoding for values of the DATE type 18 8.26.3 Encoding for values of the TIM
45、E-OF-DAY type 18 8.26.4 Encoding for values of the DATE-TIME type . 18 8.26.5 Encoding for values of the DURATION type. 18 Foreword . v CAN/CSA-ISOIEC 8825-1:13ISO/IEC 8825-1:2008(E) iv ISO/IEC 2008 All rights reserved9.2 String encoding forms.18 9.3 Set components .18 10 Distinguished encoding rule
46、s .19 10.1 Length forms.19 10.2 String encoding forms.19 10.3 Set components .19 11 Restrictions on BER employed by both CER and DER. 19 11.1 Boolean values 19 11.2 Unused bits19 11.3 Real values 20 11.4 GeneralString values.20 11.5 Set and sequence components with default value . 20 11.6 Set-of com
47、ponents.20 11.7 GeneralizedTime.20 11.8 UTCTime 21 11.8.4 Examples of valid representations 21 11.8.5 Examples of invalid representations . 21 11.9 The TIME type and the useful time types . 21 12 Use of BER, CER and DER in transfer syntax definition22 Annex A Example of encodings. 23 A.1 ASN.1 descr
48、iption of the record structure.23 A.2 ASN.1 description of a record value.23 A.3 Representation of this record value.23 Annex B Identification of Encoding Rules. 25 Annex C Illustration of real value encoding. 26 9 Canonical encoding rules . 18 9.1 Length forms.18 CAN/CSA-ISOIEC 8825-1:13ISO/IEC 882
49、5-1:2008(E) ISO/IEC 2008 All rights reserved vForeword ISO (the International Organization for Standardization) and IEC (the International Electrotechnical Commission) form the specialized system for worldwide standardization. National bodies that are members of ISO or IEC participate in the development of International Standards through technical committ