summary refs log tree commit diff
path: root/crypto/src/bcpg/sig/IntendedRecipientFingerprint.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/bcpg/sig/IntendedRecipientFingerprint.cs')
-rw-r--r--crypto/src/bcpg/sig/IntendedRecipientFingerprint.cs28
1 files changed, 28 insertions, 0 deletions
diff --git a/crypto/src/bcpg/sig/IntendedRecipientFingerprint.cs b/crypto/src/bcpg/sig/IntendedRecipientFingerprint.cs
new file mode 100644
index 000000000..7077c2d40
--- /dev/null
+++ b/crypto/src/bcpg/sig/IntendedRecipientFingerprint.cs
@@ -0,0 +1,28 @@
+using System;
+
+using Org.BouncyCastle.Utilities;
+
+namespace Org.BouncyCastle.Bcpg.Sig
+{
+    /**
+     * packet giving the intended recipient fingerprint.
+     */
+    public class IntendedRecipientFingerprint
+        : SignatureSubpacket
+    {
+        public IntendedRecipientFingerprint(bool critical, bool isLongLength, byte[] data)
+            : base(SignatureSubpacketTag.IntendedRecipientFingerprint, critical, isLongLength, data)
+        {
+        }
+
+        public IntendedRecipientFingerprint(bool critical, int keyVersion, byte[] fingerprint)
+            : base(SignatureSubpacketTag.IntendedRecipientFingerprint, critical, false,
+                Arrays.Prepend(fingerprint, (byte)keyVersion))
+        {
+        }
+
+        public int KeyVersion => data[0];
+
+        public byte[] GetFingerprint() => Arrays.CopyOfRange(data, 1, data.Length);
+    }
+}