diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-01-17 20:32:13 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-01-17 20:32:13 +0700 |
commit | 2e1dc7df1b47554ed229b65b9574973b43541a10 (patch) | |
tree | fd8b51ede5fe64ef823d8eb60c5db17e40f31544 /crypto/src/asn1/cmp/PKIHeaderBuilder.cs | |
parent | FIx fetching of DateOfCertGen extension (diff) | |
download | BouncyCastle.NET-ed25519-2e1dc7df1b47554ed229b65b9574973b43541a10.tar.xz |
Refactoring in Asn1
Diffstat (limited to 'crypto/src/asn1/cmp/PKIHeaderBuilder.cs')
-rw-r--r-- | crypto/src/asn1/cmp/PKIHeaderBuilder.cs | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/crypto/src/asn1/cmp/PKIHeaderBuilder.cs b/crypto/src/asn1/cmp/PKIHeaderBuilder.cs index cbefc73b8..ab8db958a 100644 --- a/crypto/src/asn1/cmp/PKIHeaderBuilder.cs +++ b/crypto/src/asn1/cmp/PKIHeaderBuilder.cs @@ -189,15 +189,15 @@ namespace Org.BouncyCastle.Asn1.Cmp public virtual PkiHeader Build() { Asn1EncodableVector v = new Asn1EncodableVector(pvno, sender, recipient); - AddOptional(v, 0, messageTime); - AddOptional(v, 1, protectionAlg); - AddOptional(v, 2, senderKID); - AddOptional(v, 3, recipKID); - AddOptional(v, 4, transactionID); - AddOptional(v, 5, senderNonce); - AddOptional(v, 6, recipNonce); - AddOptional(v, 7, freeText); - AddOptional(v, 8, generalInfo); + v.AddOptionalTagged(true, 0, messageTime); + v.AddOptionalTagged(true, 1, protectionAlg); + v.AddOptionalTagged(true, 2, senderKID); + v.AddOptionalTagged(true, 3, recipKID); + v.AddOptionalTagged(true, 4, transactionID); + v.AddOptionalTagged(true, 5, senderNonce); + v.AddOptionalTagged(true, 6, recipNonce); + v.AddOptionalTagged(true, 7, freeText); + v.AddOptionalTagged(true, 8, generalInfo); messageTime = null; protectionAlg = null; @@ -211,13 +211,5 @@ namespace Org.BouncyCastle.Asn1.Cmp return PkiHeader.GetInstance(new DerSequence(v)); } - - private void AddOptional(Asn1EncodableVector v, int tagNo, Asn1Encodable obj) - { - if (obj != null) - { - v.Add(new DerTaggedObject(true, tagNo, obj)); - } - } } } |