diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-07-21 00:26:34 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-07-21 00:26:34 +0700 |
commit | 9f36987f992075b2f61214f6d83433efd597e93e (patch) | |
tree | 4cc2e19d8dc1229479acbcdf2bb62811b0344785 /crypto/src/asn1/cmp/KeyRecRepContent.cs | |
parent | Refactoring in Asn1.Cms (diff) | |
download | BouncyCastle.NET-ed25519-9f36987f992075b2f61214f6d83433efd597e93e.tar.xz |
Refactoring in Asn1.Cmp
Diffstat (limited to 'crypto/src/asn1/cmp/KeyRecRepContent.cs')
-rw-r--r-- | crypto/src/asn1/cmp/KeyRecRepContent.cs | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/crypto/src/asn1/cmp/KeyRecRepContent.cs b/crypto/src/asn1/cmp/KeyRecRepContent.cs index 8121988d2..e465346eb 100644 --- a/crypto/src/asn1/cmp/KeyRecRepContent.cs +++ b/crypto/src/asn1/cmp/KeyRecRepContent.cs @@ -16,7 +16,7 @@ namespace Org.BouncyCastle.Asn1.Cmp public static KeyRecRepContent GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit) { - return GetInstance(Asn1Sequence.GetInstance(taggedObject, declaredExplicit)); + return new KeyRecRepContent(Asn1Sequence.GetInstance(taggedObject, declaredExplicit)); } private readonly PkiStatusInfo m_status; @@ -44,7 +44,7 @@ namespace Org.BouncyCastle.Asn1.Cmp m_keyPairHist = Asn1Sequence.GetInstance(tObj.GetExplicitBaseObject()); break; default: - throw new ArgumentException("unknown tag number: " + tObj.TagNo, "seq"); + throw new ArgumentException("unknown tag number: " + tObj.TagNo); } } } @@ -53,15 +53,9 @@ namespace Org.BouncyCastle.Asn1.Cmp public virtual CmpCertificate NewSigCert => m_newSigCert; - public virtual CmpCertificate[] GetCACerts() - { - return m_caCerts?.MapElements(CmpCertificate.GetInstance); - } + public virtual CmpCertificate[] GetCACerts() => m_caCerts?.MapElements(CmpCertificate.GetInstance); - public virtual CertifiedKeyPair[] GetKeyPairHist() - { - return m_keyPairHist?.MapElements(CertifiedKeyPair.GetInstance); - } + public virtual CertifiedKeyPair[] GetKeyPairHist() => m_keyPairHist?.MapElements(CertifiedKeyPair.GetInstance); /** * <pre> @@ -78,7 +72,8 @@ namespace Org.BouncyCastle.Asn1.Cmp */ public override Asn1Object ToAsn1Object() { - Asn1EncodableVector v = new Asn1EncodableVector(m_status); + Asn1EncodableVector v = new Asn1EncodableVector(4); + v.Add(m_status); v.AddOptionalTagged(true, 0, m_newSigCert); v.AddOptionalTagged(true, 1, m_caCerts); v.AddOptionalTagged(true, 2, m_keyPairHist); |