| | | 1 | | using System; |
| | | 2 | | |
| | | 3 | | using Renci.SshNet.Security.Org.BouncyCastle.Math.EC; |
| | | 4 | | |
| | | 5 | | namespace Renci.SshNet.Security.Org.BouncyCastle.Crypto.Parameters |
| | | 6 | | { |
| | | 7 | | internal class ECPublicKeyParameters |
| | | 8 | | : ECKeyParameters |
| | | 9 | | { |
| | | 10 | | private readonly ECPoint q; |
| | | 11 | | |
| | | 12 | | public ECPublicKeyParameters( |
| | | 13 | | ECPoint q, |
| | | 14 | | ECDomainParameters parameters) |
| | 0 | 15 | | : this("EC", q, parameters) |
| | 0 | 16 | | { |
| | 0 | 17 | | } |
| | | 18 | | |
| | | 19 | | public ECPublicKeyParameters( |
| | | 20 | | string algorithm, |
| | | 21 | | ECPoint q, |
| | | 22 | | ECDomainParameters parameters) |
| | 18 | 23 | | : base(algorithm, false, parameters) |
| | 18 | 24 | | { |
| | 18 | 25 | | if (q == null) |
| | 0 | 26 | | throw new ArgumentNullException("q"); |
| | | 27 | | |
| | 18 | 28 | | this.q = ECDomainParameters.Validate(Parameters.Curve, q); |
| | 18 | 29 | | } |
| | | 30 | | |
| | | 31 | | public ECPoint Q |
| | | 32 | | { |
| | 54 | 33 | | get { return q; } |
| | | 34 | | } |
| | | 35 | | |
| | | 36 | | public override bool Equals(object obj) |
| | 0 | 37 | | { |
| | 0 | 38 | | if (obj == this) |
| | 0 | 39 | | return true; |
| | | 40 | | |
| | 0 | 41 | | ECPublicKeyParameters other = obj as ECPublicKeyParameters; |
| | | 42 | | |
| | 0 | 43 | | if (other == null) |
| | 0 | 44 | | return false; |
| | | 45 | | |
| | 0 | 46 | | return Equals(other); |
| | 0 | 47 | | } |
| | | 48 | | |
| | | 49 | | protected bool Equals( |
| | | 50 | | ECPublicKeyParameters other) |
| | 0 | 51 | | { |
| | 0 | 52 | | return q.Equals(other.q) && base.Equals(other); |
| | 0 | 53 | | } |
| | | 54 | | |
| | | 55 | | public override int GetHashCode() |
| | 0 | 56 | | { |
| | 0 | 57 | | return q.GetHashCode() ^ base.GetHashCode(); |
| | 0 | 58 | | } |
| | | 59 | | } |
| | | 60 | | } |