21        private readonly 
bool hasPrivateKey;
 
   22        private readonly 
string publicKeyBase64;
 
   34            this.hasPrivateKey = 
true;
 
   35            this.publicKeyBase64 = Convert.ToBase64String(this.publicKey);
 
   48            this.curve = ReferenceCurve;
 
   49            this.hasPrivateKey = 
false;
 
   50            this.publicKeyBase64 = Convert.ToBase64String(this.publicKey);
 
   98            string Key = LocalKey.PublicKeyBase64 + 
";" + RemoteKey.
PublicKeyBase64;
 
  100            if (sharedSecrets.TryGetValue(Key, out 
byte[] SharedKey))
 
  104            sharedSecrets[Key] = SharedKey;
 
  114        public override byte[] 
Sign(
byte[] Data)
 
  116            if (!this.hasPrivateKey)
 
  117                throw new InvalidOperationException(
"Signing requires private key.");
 
  119            byte[] Signature = this.curve.Sign(Data);
 
  129        public override byte[] 
Sign(Stream Data)
 
  131            if (!this.hasPrivateKey)
 
  132                throw new InvalidOperationException(
"Signing requires private key.");
 
  134            byte[] Signature = this.curve.Sign(Data);
 
  148            return this.curve.Verify(Data, 
PublicKey, Signature);
 
  160            return this.curve.Verify(Data, 
PublicKey, Signature);
 
  169        public override bool Verify(
byte[] Data, 
byte[] Signature)
 
  171            return this.
Verify(Data, this.publicKey, Signature);
 
  180        public override bool Verify(Stream Data, 
byte[] Signature)
 
  182            return this.
Verify(Data, this.publicKey, Signature);
 
  189                this.curve.
CurveName.Equals(EcEndpoint.curve.CurveName) &&
 
  190                this.publicKeyBase64.Equals(EcEndpoint.publicKeyBase64);
 
  196            int Result = this.curve.CurveName.GetHashCode();
 
  197            Result ^= Result << 5 ^ this.publicKeyBase64.GetHashCode();
 
Abstract base class for End-to-End encryption schemes.
 
virtual IE2eSymmetricCipher DefaultSymmetricCipher
Default symmetric cipher.
 
Abstract base class for Elliptic Curve endpoints.
 
override byte[] GetSharedSecret(IE2eEndpoint RemoteEndpoint)
Gets a shared secret
 
override byte[] Sign(Stream Data)
Signs binary data using the local private key.
 
override bool Equals(object obj)
 
readonly byte[] publicKey
Remote public key.
 
override byte[] PublicKey
Remote public key.
 
EllipticCurveEndpoint(EllipticCurve Curve, IE2eSymmetricCipher DefaultSymmetricCipher)
Abstract base class for Elliptic Curve / AES-256 hybrid ciphers.s
 
override int GetHashCode()
 
bool Verify(byte[] Data, byte[] PublicKey, byte[] Signature)
Verifies a signature.
 
EllipticCurve Curve
Elliptic Curve
 
override string PublicKeyBase64
Remote public key, as a Base64 string.
 
string CurveName
Name of elliptic curve
 
override bool Verify(Stream Data, byte[] Signature)
Verifies a signature.
 
override bool Verify(byte[] Data, byte[] Signature)
Verifies a signature.
 
EllipticCurveEndpoint(byte[] PublicKey, EllipticCurve ReferenceCurve, IE2eSymmetricCipher DefaultSymmetricCipher)
Abstract base class for Elliptic Curve / AES-256 hybrid ciphers.s
 
bool HasPrivateKey
If the key contains a private key.
 
static byte[] GetSharedKey(EllipticCurveEndpoint LocalKey, IE2eEndpoint RemoteKey)
Shared secret, for underlying AES cipher.
 
bool Verify(Stream Data, byte[] PublicKey, byte[] Signature)
Verifies a signature.
 
override byte[] Sign(byte[] Data)
Signs binary data using the local private key.
 
EllipticCurve PrevCurve
Previous Elliptic Curve
 
Implements an in-memory cache.
 
Abstract base class for elliptic curves.
 
virtual byte[] PublicKey
Encoded public key
 
virtual byte[] GetSharedKey(byte[] RemotePublicKey, HashFunctionArray HashFunction)
Gets a shared key using the Elliptic Curve Diffie-Hellman (ECDH) algorithm.
 
Contains methods for simple hash calculations.
 
static byte[] ComputeSHA256Hash(byte[] Data)
Computes the SHA-256 hash of a block of binary data.
 
Abstract base class for End-to-End encryption schemes.
 
byte[] PublicKey
Remote public key.
 
string PublicKeyBase64
Remote public key, as a Base64 string.
 
Interface for symmetric ciphers.