BER allows the encoder to encode the UTCTime value in any of the formats allowed by X.680 (2008) clause 47. DER/CER (as written in X.690 (2008) Clause 12) restricts the encoding to one of the possibilities allowed by BER.
According to X.680 (2008) 47.2 b), the precision can be of one minute or one second. This is reinforced in 47.3 b) where it explicitly allows either "hhmm" or "hhmmss" format. It adds final reinforcement by stating "The alternatives in b) above allow varying precision in the specification of the time."
Control of the formatting can be achieved by using the OSS ASN.1 compiler NULLTERM directive to have the UTCTime type represented as a null-terminated character string. You then can format the date using any of the alternatives that BER allows if you do not like the one that the encoder uses by default. You can also use ossUTCTimeToInts () and ossIntsToUTCTime() runtime APIs.
The samples included with some of the Knowledge Center answers are meant for your general understanding of the OSS products. Different versions of the products might produce slightly different outputs. Consult the products documentation and samples for the most up-to-date products information and code examples.
Test drive the OSS Nokalva ASN.1, LTE, and XML Tools now! Your trial includes complete software, documentation, sample programs, free 24x7 technical support and more.
Our expert personnel can help you learn ASN.1!
We offer 4-day ASN.1 courses at our headquarters or your premises.