summary refs log tree commit diff
path: root/crypto/src/asn1/pkcs/SignerInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/pkcs/SignerInfo.cs')
-rw-r--r--crypto/src/asn1/pkcs/SignerInfo.cs21
1 files changed, 5 insertions, 16 deletions
diff --git a/crypto/src/asn1/pkcs/SignerInfo.cs b/crypto/src/asn1/pkcs/SignerInfo.cs
index a3dc48b5b..c594b45e9 100644
--- a/crypto/src/asn1/pkcs/SignerInfo.cs
+++ b/crypto/src/asn1/pkcs/SignerInfo.cs
@@ -133,22 +133,11 @@ namespace Org.BouncyCastle.Asn1.Pkcs
          */
         public override Asn1Object ToAsn1Object()
         {
-            Asn1EncodableVector v = new Asn1EncodableVector(
-				version, issuerAndSerialNumber, digAlgorithm);
-
-			if (authenticatedAttributes != null)
-            {
-                v.Add(new DerTaggedObject(false, 0, authenticatedAttributes));
-            }
-
-			v.Add(digEncryptionAlgorithm, encryptedDigest);
-
-			if (unauthenticatedAttributes != null)
-            {
-                v.Add(new DerTaggedObject(false, 1, unauthenticatedAttributes));
-            }
-
-			return new DerSequence(v);
+            Asn1EncodableVector v = new Asn1EncodableVector(version, issuerAndSerialNumber, digAlgorithm);
+            v.AddOptionalTagged(false, 0, authenticatedAttributes);
+            v.Add(digEncryptionAlgorithm, encryptedDigest);
+            v.AddOptionalTagged(false, 1, unauthenticatedAttributes);
+            return new DerSequence(v);
         }
     }
 }