From 1760a91a88a65d7ae0798b57dd25186bd2110e76 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Fri, 15 Oct 2021 00:34:16 +0700 Subject: Add utility methods --- crypto/src/openpgp/PgpSignatureSubpacketVector.cs | 9 +++++++++ crypto/src/openpgp/PgpUserAttributeSubpacketVector.cs | 9 +++++++++ 2 files changed, 18 insertions(+) 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 /// Container for a list of signature subpackets. 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 /// Container for a list of user attribute subpackets. 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( -- cgit 1.4.1