diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-10-25 00:13:45 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-10-25 00:13:45 +0700 |
commit | 11b4d6a7afeb6f3be906a1a0ddf132df3f255b4a (patch) | |
tree | f76b51eae3e754f33c61dde13c7dd429e0f70753 /crypto/src/asn1/x509 | |
parent | fixed refactored class names in pqc/utils (diff) | |
download | BouncyCastle.NET-ed25519-11b4d6a7afeb6f3be906a1a0ddf132df3f255b4a.tar.xz |
Add Asn1GeneralizedTime and use
Diffstat (limited to 'crypto/src/asn1/x509')
-rw-r--r-- | crypto/src/asn1/x509/AttCertValidityPeriod.cs | 16 | ||||
-rw-r--r-- | crypto/src/asn1/x509/PrivateKeyUsagePeriod.cs | 10 | ||||
-rw-r--r-- | crypto/src/asn1/x509/TBSCertList.cs | 2 | ||||
-rw-r--r-- | crypto/src/asn1/x509/Time.cs | 12 | ||||
-rw-r--r-- | crypto/src/asn1/x509/V2AttributeCertificateInfoGenerator.cs | 10 | ||||
-rw-r--r-- | crypto/src/asn1/x509/V2TBSCertListGenerator.cs | 2 | ||||
-rw-r--r-- | crypto/src/asn1/x509/X509DefaultEntryConverter.cs | 2 | ||||
-rw-r--r-- | crypto/src/asn1/x509/sigi/PersonalData.cs | 8 |
8 files changed, 32 insertions, 30 deletions
diff --git a/crypto/src/asn1/x509/AttCertValidityPeriod.cs b/crypto/src/asn1/x509/AttCertValidityPeriod.cs index d31e07402..893bc0838 100644 --- a/crypto/src/asn1/x509/AttCertValidityPeriod.cs +++ b/crypto/src/asn1/x509/AttCertValidityPeriod.cs @@ -7,8 +7,8 @@ namespace Org.BouncyCastle.Asn1.X509 public class AttCertValidityPeriod : Asn1Encodable { - private readonly DerGeneralizedTime notBeforeTime; - private readonly DerGeneralizedTime notAfterTime; + private readonly Asn1GeneralizedTime notBeforeTime; + private readonly Asn1GeneralizedTime notAfterTime; public static AttCertValidityPeriod GetInstance( object obj) @@ -39,24 +39,24 @@ namespace Org.BouncyCastle.Asn1.X509 if (seq.Count != 2) throw new ArgumentException("Bad sequence size: " + seq.Count); - notBeforeTime = DerGeneralizedTime.GetInstance(seq[0]); - notAfterTime = DerGeneralizedTime.GetInstance(seq[1]); + notBeforeTime = Asn1GeneralizedTime.GetInstance(seq[0]); + notAfterTime = Asn1GeneralizedTime.GetInstance(seq[1]); } public AttCertValidityPeriod( - DerGeneralizedTime notBeforeTime, - DerGeneralizedTime notAfterTime) + Asn1GeneralizedTime notBeforeTime, + Asn1GeneralizedTime notAfterTime) { this.notBeforeTime = notBeforeTime; this.notAfterTime = notAfterTime; } - public DerGeneralizedTime NotBeforeTime + public Asn1GeneralizedTime NotBeforeTime { get { return notBeforeTime; } } - public DerGeneralizedTime NotAfterTime + public Asn1GeneralizedTime NotAfterTime { get { return notAfterTime; } } diff --git a/crypto/src/asn1/x509/PrivateKeyUsagePeriod.cs b/crypto/src/asn1/x509/PrivateKeyUsagePeriod.cs index 89e8de6cb..a87c2ee9e 100644 --- a/crypto/src/asn1/x509/PrivateKeyUsagePeriod.cs +++ b/crypto/src/asn1/x509/PrivateKeyUsagePeriod.cs @@ -36,7 +36,7 @@ namespace Org.BouncyCastle.Asn1.X509 throw new ArgumentException("unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj"); } - private DerGeneralizedTime _notBefore, _notAfter; + private Asn1GeneralizedTime _notBefore, _notAfter; private PrivateKeyUsagePeriod( Asn1Sequence seq) @@ -45,21 +45,21 @@ namespace Org.BouncyCastle.Asn1.X509 { if (tObj.TagNo == 0) { - _notBefore = DerGeneralizedTime.GetInstance(tObj, false); + _notBefore = Asn1GeneralizedTime.GetInstance(tObj, false); } else if (tObj.TagNo == 1) { - _notAfter = DerGeneralizedTime.GetInstance(tObj, false); + _notAfter = Asn1GeneralizedTime.GetInstance(tObj, false); } } } - public DerGeneralizedTime NotBefore + public Asn1GeneralizedTime NotBefore { get { return _notBefore; } } - public DerGeneralizedTime NotAfter + public Asn1GeneralizedTime NotAfter { get { return _notAfter; } } diff --git a/crypto/src/asn1/x509/TBSCertList.cs b/crypto/src/asn1/x509/TBSCertList.cs index ab847d563..865cfdd3d 100644 --- a/crypto/src/asn1/x509/TBSCertList.cs +++ b/crypto/src/asn1/x509/TBSCertList.cs @@ -194,7 +194,7 @@ namespace Org.BouncyCastle.Asn1.X509 if (seqPos < seq.Count && (seq[seqPos] is DerUtcTime - || seq[seqPos] is DerGeneralizedTime + || seq[seqPos] is Asn1GeneralizedTime || seq[seqPos] is Time)) { nextUpdate = Time.GetInstance(seq[seqPos++]); diff --git a/crypto/src/asn1/x509/Time.cs b/crypto/src/asn1/x509/Time.cs index efdf63850..791f08053 100644 --- a/crypto/src/asn1/x509/Time.cs +++ b/crypto/src/asn1/x509/Time.cs @@ -22,7 +22,7 @@ namespace Org.BouncyCastle.Asn1.X509 { if (time == null) throw new ArgumentNullException("time"); - if (!(time is DerUtcTime) && !(time is DerGeneralizedTime)) + if (!(time is DerUtcTime) && !(time is Asn1GeneralizedTime)) throw new ArgumentException("unknown object passed to Time"); this.time = time; @@ -56,8 +56,8 @@ namespace Org.BouncyCastle.Asn1.X509 return (Time)obj; if (obj is DerUtcTime) return new Time((DerUtcTime)obj); - if (obj is DerGeneralizedTime) - return new Time((DerGeneralizedTime)obj); + if (obj is Asn1GeneralizedTime) + return new Time((Asn1GeneralizedTime)obj); throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } @@ -66,10 +66,10 @@ namespace Org.BouncyCastle.Asn1.X509 { if (time is DerUtcTime) { - return ((DerUtcTime) time).AdjustedTimeString; + return ((DerUtcTime)time).AdjustedTimeString; } - return ((DerGeneralizedTime) time).GetTime(); + return ((Asn1GeneralizedTime)time).GetTime(); } /// <summary> @@ -86,7 +86,7 @@ namespace Org.BouncyCastle.Asn1.X509 } else { - return ((DerGeneralizedTime)time).ToDateTime(); + return ((Asn1GeneralizedTime)time).ToDateTime(); } } catch (FormatException e) diff --git a/crypto/src/asn1/x509/V2AttributeCertificateInfoGenerator.cs b/crypto/src/asn1/x509/V2AttributeCertificateInfoGenerator.cs index 02580b5b8..c78c966b0 100644 --- a/crypto/src/asn1/x509/V2AttributeCertificateInfoGenerator.cs +++ b/crypto/src/asn1/x509/V2AttributeCertificateInfoGenerator.cs @@ -26,11 +26,13 @@ namespace Org.BouncyCastle.Asn1.X509 internal AttCertIssuer issuer; internal AlgorithmIdentifier signature; internal DerInteger serialNumber; -// internal AttCertValidityPeriod attrCertValidityPeriod; internal Asn1EncodableVector attributes; internal DerBitString issuerUniqueID; internal X509Extensions extensions; - internal DerGeneralizedTime startDate, endDate; + + // Note: validity period start/end dates stored directly + //internal AttCertValidityPeriod attrCertValidityPeriod; + internal Asn1GeneralizedTime startDate, endDate; public V2AttributeCertificateInfoGenerator() { @@ -78,13 +80,13 @@ namespace Org.BouncyCastle.Asn1.X509 } public void SetStartDate( - DerGeneralizedTime startDate) + Asn1GeneralizedTime startDate) { this.startDate = startDate; } public void SetEndDate( - DerGeneralizedTime endDate) + Asn1GeneralizedTime endDate) { this.endDate = endDate; } diff --git a/crypto/src/asn1/x509/V2TBSCertListGenerator.cs b/crypto/src/asn1/x509/V2TBSCertListGenerator.cs index 1d58751fd..546dc91f9 100644 --- a/crypto/src/asn1/x509/V2TBSCertListGenerator.cs +++ b/crypto/src/asn1/x509/V2TBSCertListGenerator.cs @@ -101,7 +101,7 @@ namespace Org.BouncyCastle.Asn1.X509 } public void AddCrlEntry(DerInteger userCertificate, Time revocationDate, int reason, - DerGeneralizedTime invalidityDate) + Asn1GeneralizedTime invalidityDate) { var extOids = new List<DerObjectIdentifier>(); var extValues = new List<X509Extension>(); diff --git a/crypto/src/asn1/x509/X509DefaultEntryConverter.cs b/crypto/src/asn1/x509/X509DefaultEntryConverter.cs index 7282ead26..d155efc5a 100644 --- a/crypto/src/asn1/x509/X509DefaultEntryConverter.cs +++ b/crypto/src/asn1/x509/X509DefaultEntryConverter.cs @@ -46,7 +46,7 @@ namespace Org.BouncyCastle.Asn1.X509 if (oid.Equals(X509Name.DateOfBirth)) // accept time string as well as # (for compatibility) { - return new DerGeneralizedTime(value); + return new Asn1GeneralizedTime(value); } if (oid.Equals(X509Name.C) diff --git a/crypto/src/asn1/x509/sigi/PersonalData.cs b/crypto/src/asn1/x509/sigi/PersonalData.cs index 439039888..e8c75bf93 100644 --- a/crypto/src/asn1/x509/sigi/PersonalData.cs +++ b/crypto/src/asn1/x509/sigi/PersonalData.cs @@ -29,7 +29,7 @@ namespace Org.BouncyCastle.Asn1.X509.SigI { private readonly NameOrPseudonym nameOrPseudonym; private readonly BigInteger nameDistinguisher; - private readonly DerGeneralizedTime dateOfBirth; + private readonly Asn1GeneralizedTime dateOfBirth; private readonly DirectoryString placeOfBirth; private readonly string gender; private readonly DirectoryString postalAddress; @@ -88,7 +88,7 @@ namespace Org.BouncyCastle.Asn1.X509.SigI nameDistinguisher = DerInteger.GetInstance(o, false).Value; break; case 1: - dateOfBirth = DerGeneralizedTime.GetInstance(o, false); + dateOfBirth = Asn1GeneralizedTime.GetInstance(o, false); break; case 2: placeOfBirth = DirectoryString.GetInstance(o, true); @@ -118,7 +118,7 @@ namespace Org.BouncyCastle.Asn1.X509.SigI public PersonalData( NameOrPseudonym nameOrPseudonym, BigInteger nameDistinguisher, - DerGeneralizedTime dateOfBirth, + Asn1GeneralizedTime dateOfBirth, DirectoryString placeOfBirth, string gender, DirectoryString postalAddress) @@ -141,7 +141,7 @@ namespace Org.BouncyCastle.Asn1.X509.SigI get { return nameDistinguisher; } } - public DerGeneralizedTime DateOfBirth + public Asn1GeneralizedTime DateOfBirth { get { return dateOfBirth; } } |