Asn1DateTimeCreateRfcDateTime Method

Encodes a .NET DateTime object to a ASN.1-encoded byte array. This method is designed to conform RFC 5280 requirement, so dates before 1950 and after 2050 year are required to be encoded by using Generalized Time encoding. UTC Time encoding is not allowed for periods beyond 1950 - 2049 years.

Definition

Namespace: SysadminsLV.Asn1Parser.Universal
Assembly: SysadminsLV.Asn1Parser (in SysadminsLV.Asn1Parser.dll) Version: 1.2.11
C#
public static Asn1DateTime CreateRfcDateTime(
	DateTime time,
	TimeZoneInfo zone = null
)

Parameters

time  DateTime
An instance of DateTime object.
zone  TimeZoneInfo  (Optional)
Specifies the time zone for the value in time parameter.

Return Value

Asn1DateTime
ASN.1 type object.

Remarks

If the Year value of the time object is less or equals to 2049 and greater or equals to 1950, an Asn1UtcTime object is returned. If year value is outside of 1950-2049 range, an Asn1GeneralizedTime object is returned.

If zone parameter is set to NULL, date and time in time parameter will be converted to a Zulu time (Universal time). If zone information is not NULL, date and time in time parameter will be converted to a GMT time and time zone will be added to encoded value.

See Also