summary refs log tree commit diff
path: root/crypto/src/cmp/GeneralPkiMessage.cs
diff options
context:
space:
mode:
authorDavid Hook <dgh@bouncycastle.org>2019-01-15 08:05:41 +1100
committerDavid Hook <dgh@bouncycastle.org>2019-01-15 08:05:41 +1100
commit6ca2f2f9b941289f42d0ef0d2ef8f0cfa1e4ac86 (patch)
tree3c1d88a79669f1cf55de9a5731d63066f442de5c /crypto/src/cmp/GeneralPkiMessage.cs
parentMerge remote-tracking branch 'origin/master' (diff)
downloadBouncyCastle.NET-ed25519-6ca2f2f9b941289f42d0ef0d2ef8f0cfa1e4ac86.tar.xz
refactor of PKMacBuilder
Diffstat (limited to 'crypto/src/cmp/GeneralPkiMessage.cs')
-rw-r--r--crypto/src/cmp/GeneralPkiMessage.cs49
1 files changed, 49 insertions, 0 deletions
diff --git a/crypto/src/cmp/GeneralPkiMessage.cs b/crypto/src/cmp/GeneralPkiMessage.cs
new file mode 100644
index 000000000..d91b8ef7e
--- /dev/null
+++ b/crypto/src/cmp/GeneralPkiMessage.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Org.BouncyCastle.Asn1.Cmp
+{
+    public class GeneralPKIMessage
+    {
+        private readonly PkiMessage pkiMessage;
+
+        private static PkiMessage parseBytes(byte[] encoding)
+        {
+            return PkiMessage.GetInstance(Asn1Object.FromByteArray(encoding));
+        }
+
+        public GeneralPKIMessage(PkiMessage pkiMessage)
+        {
+            this.pkiMessage = pkiMessage;
+        }
+
+        public GeneralPKIMessage(byte[] encoding) : this(parseBytes(encoding))
+        {
+        }
+
+        public PkiHeader Header {
+            get {
+                return pkiMessage.Header;
+            }
+        }
+
+        public PkiBody Body
+        {
+            get
+            {
+                return pkiMessage.Body;
+            }
+        }
+
+        public bool HasProtection
+        {
+            get { return pkiMessage.Protection != null; }
+        }
+
+        public PkiMessage ToAsn1Structure()
+        {
+            return pkiMessage;
+        }
+    }
+}