diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-03-24 13:52:42 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-03-24 13:52:42 +0700 |
commit | 51ba2aeaa7a6169210c71d61515b9f564021685c (patch) | |
tree | 7b886cd3e76ba542b3ea0b30cfb99f113075004f | |
parent | Falcon: delay complete_private() verify failure for potential vulnerability (diff) | |
download | BouncyCastle.NET-ed25519-51ba2aeaa7a6169210c71d61515b9f564021685c.tar.xz |
Refactor PgpEncryptedDataList
-rw-r--r-- | crypto/src/openpgp/PgpEncryptedDataList.cs | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/crypto/src/openpgp/PgpEncryptedDataList.cs b/crypto/src/openpgp/PgpEncryptedDataList.cs index b756147f1..c768c804a 100644 --- a/crypto/src/openpgp/PgpEncryptedDataList.cs +++ b/crypto/src/openpgp/PgpEncryptedDataList.cs @@ -6,12 +6,12 @@ using Org.BouncyCastle.Utilities.Collections; namespace Org.BouncyCastle.Bcpg.OpenPgp { - /// <remarks>A holder for a list of PGP encryption method packets.</remarks> + /// <remarks>A holder for a list of PGP encryption method packets.</remarks> public class PgpEncryptedDataList : PgpObject { - private readonly List<PgpEncryptedData> list = new List<PgpEncryptedData>(); - private readonly InputStreamPacket data; + private readonly List<PgpEncryptedData> m_list = new List<PgpEncryptedData>(); + private readonly InputStreamPacket m_data; public PgpEncryptedDataList(BcpgInputStream bcpgInput) { @@ -26,17 +26,17 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp if (!(lastPacket is InputStreamPacket inputStreamPacket)) throw new IOException("unexpected packet in stream: " + lastPacket); - this.data = inputStreamPacket; + m_data = inputStreamPacket; foreach (var packet in packets) { if (packet is SymmetricKeyEncSessionPacket symmetricKey) { - list.Add(new PgpPbeEncryptedData(symmetricKey, data)); + m_list.Add(new PgpPbeEncryptedData(symmetricKey, m_data)); } else if (packet is PublicKeyEncSessionPacket publicKey) { - list.Add(new PgpPublicKeyEncryptedData(publicKey, data)); + m_list.Add(new PgpPublicKeyEncryptedData(publicKey, m_data)); } else { @@ -45,24 +45,15 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp } } - public PgpEncryptedData this[int index] - { - get { return (PgpEncryptedData) list[index]; } - } + public PgpEncryptedData this[int index] => m_list[index]; - public int Count - { - get { return list.Count; } - } + public int Count => m_list.Count; - public bool IsEmpty - { - get { return list.Count == 0; } - } + public bool IsEmpty => m_list.Count == 0; public IEnumerable<PgpEncryptedData> GetEncryptedDataObjects() { - return CollectionUtilities.Proxy(list); + return CollectionUtilities.Proxy(m_list); } } } |