blob: 00a2afe19535e5f4e8160d7eebd0f535bf59831d (
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
using System;
using Org.BouncyCastle.Asn1;
using Org.BouncyCastle.Utilities;
namespace Org.BouncyCastle.Pqc.Asn1
{
// TODO[api] Should only be Asn1Encodable
public class CmcePublicKey
: Asn1Object
{
private byte[] t;
public CmcePublicKey(byte[] t)
{
this.t = t;
}
public CmcePublicKey(Asn1Sequence seq)
{
t = Arrays.Clone(Asn1OctetString.GetInstance(seq[0]).GetOctets());
}
public byte[] T => Arrays.Clone(t);
public Asn1Object ToAsn1Primitive()
{
return new DerSequence(new DerOctetString(t));
}
public static CmcePublicKey GetInstance(Object o)
{
if (o is CmcePrivateKey)
{
return (CmcePublicKey) o;
}
else if (o != null)
{
return new CmcePublicKey(Asn1Sequence.GetInstance(o));
}
return null;
}
internal override IAsn1Encoding GetEncoding(int encoding)
{
return ToAsn1Primitive().GetEncoding(encoding);
}
internal override IAsn1Encoding GetEncodingImplicit(int encoding, int tagClass, int tagNo)
{
return ToAsn1Primitive().GetEncodingImplicit(encoding, tagClass, tagNo);
}
protected override bool Asn1Equals(Asn1Object asn1Object)
{
if (this.Equals(asn1Object))
{
return true;
}
if (!(asn1Object is Asn1Encodable))
{
return false;
}
Asn1Encodable other = (Asn1Encodable) asn1Object;
return ToAsn1Primitive().Equals(other.ToAsn1Object());
}
protected override int Asn1GetHashCode()
{
return ToAsn1Primitive().GetHashCode();
}
}
}
|