diff options
Diffstat (limited to 'crypto/src/pqc/asn1/CmcePublicKey.cs')
-rw-r--r-- | crypto/src/pqc/asn1/CmcePublicKey.cs | 43 |
1 files changed, 13 insertions, 30 deletions
diff --git a/crypto/src/pqc/asn1/CmcePublicKey.cs b/crypto/src/pqc/asn1/CmcePublicKey.cs index 00a2afe19..e811c0d97 100644 --- a/crypto/src/pqc/asn1/CmcePublicKey.cs +++ b/crypto/src/pqc/asn1/CmcePublicKey.cs @@ -1,4 +1,5 @@ using System; + using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Utilities; @@ -8,6 +9,15 @@ namespace Org.BouncyCastle.Pqc.Asn1 public class CmcePublicKey : Asn1Object { + public static CmcePublicKey GetInstance(Object o) + { + if (o == null) + return null; + if (o is CmcePublicKey cmcePublicKey) + return cmcePublicKey; + return new CmcePublicKey(Asn1Sequence.GetInstance(o)); + } + private byte[] t; public CmcePublicKey(byte[] t) @@ -27,20 +37,6 @@ namespace Org.BouncyCastle.Pqc.Asn1 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); @@ -49,29 +45,16 @@ namespace Org.BouncyCastle.Pqc.Asn1 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()); + return ToAsn1Primitive().CallAsn1Equals(asn1Object); } protected override int Asn1GetHashCode() { - return ToAsn1Primitive().GetHashCode(); + return ToAsn1Primitive().CallAsn1GetHashCode(); } } -} \ No newline at end of file +} |