summary refs log tree commit diff
path: root/crypto/src/asn1/cmp/GeneralPKIMessage.cs
blob: d91b8ef7e0679a7ae4b3f3a5540e5d9de2a6c30d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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;
        }
    }
}