summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2021-10-15 00:34:16 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2021-10-15 00:34:16 +0700
commit1760a91a88a65d7ae0798b57dd25186bd2110e76 (patch)
treeb2cbd2f16b5aa5b5d1a46e484c298a1452ba5a74
parentSEQUENCE/SET can't contain java null values (diff)
downloadBouncyCastle.NET-ed25519-1760a91a88a65d7ae0798b57dd25186bd2110e76.tar.xz
Add utility methods
-rw-r--r--crypto/src/openpgp/PgpSignatureSubpacketVector.cs9
-rw-r--r--crypto/src/openpgp/PgpUserAttributeSubpacketVector.cs9
2 files changed, 18 insertions, 0 deletions
diff --git a/crypto/src/openpgp/PgpSignatureSubpacketVector.cs b/crypto/src/openpgp/PgpSignatureSubpacketVector.cs
index 3dc96ea90..810f49c3e 100644
--- a/crypto/src/openpgp/PgpSignatureSubpacketVector.cs
+++ b/crypto/src/openpgp/PgpSignatureSubpacketVector.cs
@@ -9,6 +9,15 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp
 	/// <remarks>Container for a list of signature subpackets.</remarks>
     public class PgpSignatureSubpacketVector
     {
+        public static PgpSignatureSubpacketVector FromSubpackets(SignatureSubpacket[] packets)
+        {
+            if (packets == null)
+            {
+                packets = new SignatureSubpacket[0];
+            }
+            return new PgpSignatureSubpacketVector(packets);
+        }
+
         private readonly SignatureSubpacket[] packets;
 
 		internal PgpSignatureSubpacketVector(
diff --git a/crypto/src/openpgp/PgpUserAttributeSubpacketVector.cs b/crypto/src/openpgp/PgpUserAttributeSubpacketVector.cs
index 4cdbeda54..df5081390 100644
--- a/crypto/src/openpgp/PgpUserAttributeSubpacketVector.cs
+++ b/crypto/src/openpgp/PgpUserAttributeSubpacketVector.cs
@@ -5,6 +5,15 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp
 	/// <remarks>Container for a list of user attribute subpackets.</remarks>
     public class PgpUserAttributeSubpacketVector
     {
+        public static PgpUserAttributeSubpacketVector FromSubpackets(UserAttributeSubpacket[] packets)
+        {
+            if (packets == null)
+            {
+                packets = new UserAttributeSubpacket[0];
+            }
+            return new PgpUserAttributeSubpacketVector(packets);
+        }
+
         private readonly UserAttributeSubpacket[] packets;
 
 		internal PgpUserAttributeSubpacketVector(