AsnDecoder.ReadUtcTime Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Reads a UtcTime value from source
with a specified tag under the specified encoding rules.
public static DateTimeOffset ReadUtcTime (ReadOnlySpan<byte> source, System.Formats.Asn1.AsnEncodingRules ruleSet, out int bytesConsumed, int twoDigitYearMax = 2049, System.Formats.Asn1.Asn1Tag? expectedTag = default);
static member ReadUtcTime : ReadOnlySpan<byte> * System.Formats.Asn1.AsnEncodingRules * int * int * Nullable<System.Formats.Asn1.Asn1Tag> -> DateTimeOffset
Public Shared Function ReadUtcTime (source As ReadOnlySpan(Of Byte), ruleSet As AsnEncodingRules, ByRef bytesConsumed As Integer, Optional twoDigitYearMax As Integer = 2049, Optional expectedTag As Nullable(Of Asn1Tag) = Nothing) As DateTimeOffset
Parameters
- source
- ReadOnlySpan<Byte>
The buffer containing encoded data.
- ruleSet
- AsnEncodingRules
The encoding constraints to use when interpreting the data.
- bytesConsumed
- Int32
When this method returns, the total number of bytes for the encoded value. This parameter is treated as uninitialized.
- twoDigitYearMax
- Int32
The largest year to represent with this value. The default value, 2049, represents the 1950-2049 range for X.509 certificates.
The tag to check for before reading, or null
for the default tag (Universal 24).
Returns
The decoded value.
Exceptions
ruleSet
is not defined.
-or-
twoDigitYearMax
is not in the range [99, 9999].
The next value does not have the correct tag.
-or-
The length encoding is not valid under the current encoding rules.
-or-
The contents are not valid under the current encoding rules.