1 \feffusing System.Collections.Generic;
3 using Org.BouncyCastle.Math.EC;
4 using Org.BouncyCastle.Crypto.Parameters;
9 /// Representation of ECDSA public key
11 public class CPubKey : CKey
14 /// Initializes a new instance of CPubKey class as the copy of another instance
16 /// <param name="pubKey">Another CPubKey instance</param>
17 public CPubKey(CPubKey pubKey)
19 _Public = pubKey._Public;
23 /// Initializes a new instance of CPubKey class using supplied sequence of bytes
25 /// <param name="bytes">Byte sequence</param>
26 public CPubKey(IEnumerable<byte> bytes)
28 ECPoint pQ = curve.Curve.DecodePoint(bytes.ToArray());
29 _Public = new ECPublicKeyParameters(pQ, domain);
33 /// Quick validity test
35 /// <returns>Validation result</returns>
38 get { return !_Public.Q.IsInfinity; }
42 /// Is this a compressed public key?
44 /// <returns></returns>
45 public bool IsCompressed
47 get { return _Public.Q.IsCompressed; }
50 public override string ToString()
52 return Interop.ToHex(Public);