Fix validity encoding for cert dates after 2049
authorJeremy Barton <jbarton@microsoft.com>
Tue, 24 Sep 2019 02:22:35 +0000 (19:22 -0700)
committerGitHub <noreply@github.com>
Tue, 24 Sep 2019 02:22:35 +0000 (19:22 -0700)
commit743d65b09922e9c64b7cee628a0e80dcba2be1bd
tree9b3f7a3ed3f63d1c3e44030c7e26a8c72d2f1a1c
parent6b682b7f1c9fe61bba9fa413cab8e6eae16f7e74
Fix validity encoding for cert dates after 2049

During the change from the reflection serializer to asn.xslt generation we lost
the metadata that said that X.509 Time GeneralizedTime values need to ignore
fractional seconds.

That means we're generating fractional seconds when the input DateTimeOffset
has them, which means we violate RFC in our generated certificates.

Commit migrated from https://github.com/dotnet/corefx/commit/8a65f0b14cb3f29272a18b2f6dbe4bebfd4d4177
src/libraries/Common/src/System/Security/Cryptography/Asn1/asn.xsd
src/libraries/Common/src/System/Security/Cryptography/Asn1/asn.xslt
src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/Asn1/TimeAsn.xml
src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/Asn1/TimeAsn.xml.cs
src/libraries/System.Security.Cryptography.X509Certificates/tests/CertificateCreation/CertificateRequestUsageTests.cs