You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.7 KiB
63 lines
1.7 KiB
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR) |
|
#pragma warning disable |
|
using System; |
|
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1; |
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cmp; |
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Cmp |
|
{ |
|
public class GeneralPkiMessage |
|
{ |
|
private readonly PkiMessage pkiMessage; |
|
|
|
private static PkiMessage ParseBytes(byte[] encoding) |
|
{ |
|
return PkiMessage.GetInstance(Asn1Object.FromByteArray(encoding)); |
|
} |
|
|
|
/// <summary> |
|
/// Wrap a PKIMessage ASN.1 structure. |
|
/// </summary> |
|
/// <param name="pkiMessage">PKI message.</param> |
|
public GeneralPkiMessage(PkiMessage pkiMessage) |
|
{ |
|
this.pkiMessage = pkiMessage; |
|
} |
|
|
|
/// <summary> |
|
/// Create a PKIMessage from the passed in bytes. |
|
/// </summary> |
|
/// <param name="encoding">BER/DER encoding of the PKIMessage</param> |
|
public GeneralPkiMessage(byte[] encoding) |
|
: this(ParseBytes(encoding)) |
|
{ |
|
} |
|
|
|
public PkiHeader Header |
|
{ |
|
get { return pkiMessage.Header; } |
|
} |
|
|
|
public PkiBody Body |
|
{ |
|
get { return pkiMessage.Body; } |
|
} |
|
|
|
/// <summary> |
|
/// Return true if this message has protection bits on it. A return value of true |
|
/// indicates the message can be used to construct a ProtectedPKIMessage. |
|
/// </summary> |
|
public bool HasProtection |
|
{ |
|
get { return pkiMessage.Protection != null; } |
|
} |
|
|
|
public PkiMessage ToAsn1Structure() |
|
{ |
|
return pkiMessage; |
|
} |
|
} |
|
} |
|
#pragma warning restore |
|
#endif
|
|
|