Beispiel #1
0
        public override IE2eEndpoint GenerateEndpoint(IE2eSymmetricCipher Cipher)
        {
            RSA RSA = RSACryptoServiceProvider.Create();

            RSA.KeySize = 1024;
            return(new RsaEndpoint(RSA, Cipher));
        }
 /// <summary>
 /// Event arguments for responses to IQ queries.
 /// </summary>
 /// <param name="E2eEncryption">End-to-end encryption algorithm used.</param>
 /// <param name="E2eReference">Reference to End-to-end encryption endpoint used.</param>
 /// <param name="E2eSymmetricCipher">Type of symmetric cipher used in E2E encryption.</param>
 /// <param name="Response">Response element.</param>
 /// <param name="Id">ID attribute.</param>
 /// <param name="To">To attribute.</param>
 /// <param name="From">From attribute.</param>
 /// <param name="Ok">If response is a proper response (true), or an error response (false).</param>
 /// <param name="State">State object passed in the original request.</param>
 public IqResultEventArgs(IEndToEndEncryption E2eEncryption, string E2eReference, IE2eSymmetricCipher E2eSymmetricCipher,
                          XmlElement Response, string Id, string To, string From, bool Ok, object State)
     : this(Response, Id, To, From, Ok, State)
 {
     this.e2eEncryption      = E2eEncryption;
     this.e2eReference       = E2eReference;
     this.e2eSymmetricCipher = E2eSymmetricCipher;
 }
Beispiel #3
0
 /// <summary>
 /// Abstract base class for Elliptic Curve / AES-256 hybrid ciphers.s
 /// </summary>
 /// <param name="Curve">Curve instance</param>
 /// <param name="DefaultSymmetricCipher">Default symmetric cipher.</param>
 public EllipticCurveEndpoint(EllipticCurve Curve, IE2eSymmetricCipher DefaultSymmetricCipher)
     : base(DefaultSymmetricCipher)
 {
     this.curve           = Curve;
     this.publicKey       = Curve.PublicKey;
     this.hasPrivateKey   = true;
     this.publicKeyBase64 = Convert.ToBase64String(this.publicKey);
 }
Beispiel #4
0
 /// <summary>
 /// Abstract base class for Elliptic Curve / AES-256 hybrid ciphers.s
 /// </summary>
 /// <param name="PublicKey">Remote public key.</param>
 /// <param name="ReferenceCurve">Reference curve</param>
 /// <param name="DefaultSymmetricCipher">Default symmetric cipher.</param>
 public EllipticCurveEndpoint(byte[] PublicKey, EllipticCurve ReferenceCurve, IE2eSymmetricCipher DefaultSymmetricCipher)
     : base(DefaultSymmetricCipher)
 {
     this.publicKey       = PublicKey;
     this.curve           = ReferenceCurve;
     this.hasPrivateKey   = false;
     this.publicKeyBase64 = Convert.ToBase64String(this.publicKey);
 }
Beispiel #5
0
 public Socks5Receiver(string Key, string StreamId, string From, string To, bool E2e, string EndpointReference,
                       IE2eSymmetricCipher SymmetricCipher)
 {
     this.Key               = Key;
     this.StreamId          = StreamId;
     this.From              = From;
     this.To                = To;
     this.E2e               = E2e;
     this.EndpointReference = EndpointReference;
     this.SymmetricCipher   = SymmetricCipher;
 }
Beispiel #6
0
 /// <summary>
 /// Event arguments for IQ queries.
 /// </summary>
 /// <param name="Component">XMPP Component.</param>
 /// <param name="Iq">IQ element.</param>
 /// <param name="Id">Id attribute of IQ stanza.</param>
 /// <param name="To">To attribute of IQ stanza.</param>
 /// <param name="From">From attribute of IQ stanza.</param>
 public IqEventArgs(XmppComponent Component, XmlElement Iq, string Id, string To, string From)
 {
     this.client             = null;
     this.component          = Component;
     this.iq                 = Iq;
     this.id                 = Id;
     this.to                 = To;
     this.from               = From;
     this.e2eEncryption      = null;
     this.e2eReference       = null;
     this.e2eSymmetricCipher = null;
 }
Beispiel #7
0
 /// <summary>
 /// Event arguments for IQ queries.
 /// </summary>
 protected IqEventArgs(IqEventArgs e)
 {
     this.client             = e.client;
     this.component          = e.component;
     this.iq                 = e.iq;
     this.id                 = e.id;
     this.to                 = e.to;
     this.from               = e.from;
     this.e2eEncryption      = e.e2eEncryption;
     this.e2eReference       = e.e2eReference;
     this.e2eSymmetricCipher = e.e2eSymmetricCipher;
 }
Beispiel #8
0
        /// <summary>
        /// RSA / AES-256 hybrid cipher.
        /// </summary>
        /// <param name="Rsa">RSA</param>
        /// <param name="SymmetricCipher">Symmetric cipher to use by default.</param>
        public RsaEndpoint(RSA Rsa, IE2eSymmetricCipher SymmetricCipher)
            : base(SymmetricCipher)
        {
            this.rsa = Rsa;

            RSAParameters P = this.rsa.ExportParameters(false);

            this.keySize  = this.rsa.KeySize;
            this.modulus  = P.Modulus;
            this.exponent = P.Exponent;

            this.Init();
        }
Beispiel #9
0
 /// <summary>
 /// Event arguments for IQ queries.
 /// </summary>
 /// <param name="Client">XMPP Client.</param>
 /// <param name="E2eEncryption">End-to-end encryption algorithm used.</param>
 /// <param name="E2eReference">Reference to End-to-end encryption endpoint used.</param>
 /// <param name="E2eSymmetricCipher">Type of symmetric cipher used in E2E encryption.</param>
 /// <param name="Iq">IQ element.</param>
 /// <param name="Id">Id attribute of IQ stanza.</param>
 /// <param name="To">To attribute of IQ stanza.</param>
 /// <param name="From">From attribute of IQ stanza.</param>
 public IqEventArgs(XmppClient Client, IEndToEndEncryption E2eEncryption,
                    string E2eReference, IE2eSymmetricCipher E2eSymmetricCipher, XmlElement Iq,
                    string Id, string To, string From)
 {
     this.client             = Client;
     this.component          = null;
     this.e2eEncryption      = E2eEncryption;
     this.e2eReference       = E2eReference;
     this.e2eSymmetricCipher = E2eSymmetricCipher;
     this.iq   = Iq;
     this.id   = Id;
     this.to   = To;
     this.from = From;
 }
 internal ClientChunkRecord(HttpxClient Client, HttpxResponseEventArgs e, HttpResponse Response,
                            HttpxResponseDataEventHandler DataCallback, object State, string StreamId, string From, string To, bool E2e,
                            string EndpointReference, IE2eSymmetricCipher SymmetricCipher)
     : base()
 {
     this.client            = Client;
     this.e                 = e;
     this.response          = Response;
     this.dataCallback      = DataCallback;
     this.state             = State;
     this.streamId          = StreamId;
     this.from              = From;
     this.to                = To;
     this.e2e               = E2e;
     this.endpointReference = EndpointReference;
     this.symmetricCipher   = SymmetricCipher;
 }
 /// <summary>
 /// Event arguments for responses to IQ queries.
 /// </summary>
 /// <param name="e">Values are taken from this object.</param>
 protected IqResultEventArgs(IqResultEventArgs e)
 {
     this.response           = e.response;
     this.errorElement       = e.errorElement;
     this.errorType          = e.errorType;
     this.stanzaError        = e.stanzaError;
     this.errorText          = e.errorText;
     this.state              = e.state;
     this.id                 = e.id;
     this.to                 = e.to;
     this.from               = e.from;
     this.errorCode          = e.errorCode;
     this.ok                 = e.ok;
     this.e2eEncryption      = e.e2eEncryption;
     this.e2eReference       = e.e2eReference;
     this.e2eSymmetricCipher = e.e2eSymmetricCipher;
 }
Beispiel #12
0
        /// <summary>
        /// RSA / AES-256 hybrid cipher.
        /// </summary>
        /// <param name="KeySize">Size of key</param>
        /// <param name="Modulus">Modulus of RSA public key.</param>
        /// <param name="Exponent">Exponent of RSA public key.</param>
        /// <param name="SymmetricCipher">Symmetric cipher to use by default.</param>
        public RsaEndpoint(int KeySize, byte[] Modulus, byte[] Exponent,
                           IE2eSymmetricCipher SymmetricCipher)
            : base(SymmetricCipher)
        {
            this.rsa = CreateRSA(KeySize);

            this.keySize  = KeySize;
            this.modulus  = Modulus;
            this.exponent = Exponent;

            RSAParameters Param = new RSAParameters()
            {
                Modulus  = Modulus,
                Exponent = Exponent
            };

            this.rsa.ImportParameters(Param);

            this.Init();
        }
Beispiel #13
0
 public override IE2eEndpoint GenerateEndpoint(IE2eSymmetricCipher Cipher)
 {
     return(new NistP256Endpoint(Cipher));
 }
 /// <summary>
 /// NIST P-256 Curve
 /// </summary>
 /// <param name="PublicKey">Remote public key.</param>
 /// <param name="SymmetricCipher">Symmetric cipher to use by default.</param>
 public NistP256Endpoint(byte[] PublicKey, IE2eSymmetricCipher SymmetricCipher)
     : base(PublicKey, new NistP256(), SymmetricCipher)
 {
 }
 /// <summary>
 /// NIST P-256 Curve
 /// </summary>
 /// <param name="Curve">Curve instance</param>
 /// <param name="SymmetricCipher">Symmetric cipher to use by default.</param>
 public NistP256Endpoint(NistP256 Curve, IE2eSymmetricCipher SymmetricCipher)
     : base(Curve, SymmetricCipher)
 {
 }
 /// <summary>
 /// NIST P-256 Curve
 /// </summary>
 /// <param name="SymmetricCipher">Symmetric cipher to use by default.</param>
 public NistP256Endpoint(IE2eSymmetricCipher SymmetricCipher)
     : this(new NistP256(), SymmetricCipher)
 {
 }
Beispiel #17
0
 public override IE2eEndpoint GenerateEndpoint(IE2eSymmetricCipher Cipher)
 {
     return(new RsaEndpoint(2048, Cipher));
 }
Beispiel #18
0
 /// <summary>
 /// Edwards448 Edwards Curve
 /// </summary>
 /// <param name="PublicKey">Remote public key.</param>
 /// <param name="SymmetricCipher">Symmetric cipher to use by default.</param>
 public Edwards448Endpoint(byte[] PublicKey, IE2eSymmetricCipher SymmetricCipher)
     : base(PublicKey, new Edwards448(), SymmetricCipher)
 {
 }
Beispiel #19
0
 /// <summary>
 /// Curve25519 Montgomery Curve
 /// </summary>
 /// <param name="Curve">Curve instance</param>
 /// <param name="SymmetricCipher">Symmetric cipher to use by default.</param>
 public Curve25519Endpoint(Curve25519 Curve, IE2eSymmetricCipher SymmetricCipher)
     : base(Curve, SymmetricCipher)
 {
 }
Beispiel #20
0
 /// <summary>
 /// Edwards448 Edwards Curve
 /// </summary>
 /// <param name="SymmetricCipher">Symmetric cipher to use by default.</param>
 public Edwards448Endpoint(IE2eSymmetricCipher SymmetricCipher)
     : this(new Edwards448(), SymmetricCipher)
 {
 }
 /// <summary>
 /// Curve448 Montgomery Curve
 /// </summary>
 /// <param name="Curve">Curve instance</param>
 /// <param name="SymmetricCipher">Symmetric cipher to use by default.</param>
 public Curve448Endpoint(Curve448 Curve, IE2eSymmetricCipher SymmetricCipher)
     : base(Curve, SymmetricCipher)
 {
 }
 /// <summary>
 /// Curve448 Montgomery Curve
 /// </summary>
 /// <param name="SymmetricCipher">Symmetric cipher to use by default.</param>
 public Curve448Endpoint(IE2eSymmetricCipher SymmetricCipher)
     : this(new Curve448(), SymmetricCipher)
 {
 }
Beispiel #23
0
 /// <summary>
 /// Curve25519 Montgomery Curve
 /// </summary>
 /// <param name="SymmetricCipher">Symmetric cipher to use by default.</param>
 public Curve25519Endpoint(IE2eSymmetricCipher SymmetricCipher)
     : this(new Curve25519(), SymmetricCipher)
 {
 }
Beispiel #24
0
 /// <summary>
 /// <see cref="IDisposable.Dispose"/>
 /// </summary>
 public virtual void Dispose()
 {
     this.defaultSymmetricCipher?.Dispose();
     this.defaultSymmetricCipher = null;
 }
Beispiel #25
0
 /// <summary>
 /// Curve25519 Montgomery Curve
 /// </summary>
 /// <param name="PublicKey">Remote public key.</param>
 /// <param name="SymmetricCipher">Symmetric cipher to use by default.</param>
 public Curve25519Endpoint(byte[] PublicKey, IE2eSymmetricCipher SymmetricCipher)
     : base(PublicKey, new Curve25519(), SymmetricCipher)
 {
 }
Beispiel #26
0
 /// <summary>
 /// Edwards448 Edwards Curve
 /// </summary>
 /// <param name="Edwards">Edwards instance</param>
 /// <param name="SymmetricCipher">Symmetric cipher to use by default.</param>
 public Edwards448Endpoint(Edwards448 Edwards, IE2eSymmetricCipher SymmetricCipher)
     : base(Edwards, SymmetricCipher)
 {
 }
Beispiel #27
0
 /// <summary>
 /// RSA / AES-256 hybrid cipher.
 /// </summary>
 /// <param name="KeySize">Size of key</param>
 /// <param name="SymmetricCipher">Symmetric cipher to use by default.</param>
 public RsaEndpoint(int KeySize, IE2eSymmetricCipher SymmetricCipher)
     : this(CreateRSA(KeySize), SymmetricCipher)
 {
 }
Beispiel #28
0
 public override IE2eEndpoint GenerateEndpoint(IE2eSymmetricCipher Cipher)
 {
     return(new Edwards25519Endpoint(Cipher));
 }
Beispiel #29
0
 public override IE2eEndpoint GenerateEndpoint(IE2eSymmetricCipher Cipher)
 {
     return(new Curve448Endpoint(Cipher));
 }
Beispiel #30
0
 public abstract IE2eEndpoint GenerateEndpoint(IE2eSymmetricCipher Cipher);