PageRenderTime 21ms CodeModel.GetById 12ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms


XML | 210 lines | 209 code | 0 blank | 1 comment | 0 complexity | 300bf21d840bbd35ded21b6ee30e8ddd MD5 | raw file
  1<?xml version="1.0"?>
  3    <assembly>
  4        <name>Delta.Utilities.Cryptography</name>
  5    </assembly>
  6    <members>
  7        <member name="T:Delta.Utilities.Cryptography.AES">
  8            <summary>
  9            AES Cryptography helper class to encrypt and decrypt binary data in a
 10            symmetric way (from both sides) with a key and a random seed value. The
 11            private key should be kept secret (e.g. only be transmitted once
 12            to the client or hidden via source code, so only the client with
 13            the key can decrypt) and the random seed value is usually transmitted
 14            from the client to the server. The random seed value can either be
 15            transmitted as a plain byte array (assuming the private key is kept
 16            secretly enough) or you can encrypt it with a public key using the
 17            <see cref="T:Delta.Utilities.Cryptography.RSA"/> class to provide real security. In any case both sides
 18            can encrypt and decrypt data with good speed (see Performance tests in
 19            Delta.Utilities.Tests), but both need the exact same AES private key
 20            and seed value. Small messages also can have a slight overhead because
 21            all data is aligned by the seed size (16 bytes).
 22            <para/>
 23            This class uses the AES Cryptography functionality of .NET, which works
 24            fine on all platforms the Delta Engine supports. A good article about it:
 26            </summary>
 27        </member>
 28        <member name="F:Delta.Utilities.Cryptography.AES.KeyLength">
 29            <summary>
 30            For AES Cryptography the key length can be 128, 192 or 256 bits.
 31            We choose 256 bits, which is 32 bytes. Note: 16 byte keys (128 bits)
 32            are about 10% faster, but it is not worth it. The AES algorithm is
 33            slow anyway and saving 10% CPU time is not going to matter.
 34            </summary>
 35        </member>
 36        <member name="F:Delta.Utilities.Cryptography.AES.SeedLength">
 37            <summary>
 38            The seed value is always 16 bytes (128 bits) for AES cryptography.
 39            </summary>
 40        </member>
 41        <member name="M:Delta.Utilities.Cryptography.AES.CreatePrivateKey">
 42            <summary>
 43            Create private key for AES Cryptography in 256 bits, which is 32 bytes.
 44            </summary>
 45            <returns>New private key to be used</returns>
 46        </member>
 47        <member name="M:Delta.Utilities.Cryptography.AES.Encrypt(System.IO.Stream,System.Byte[])">
 48            <summary>
 49            Encrypt input stream with given key using the AES crypto functions.
 50            Note: Both the length of the input stream and the IV key are saved
 51            into the stream for the Decrypt method. All you need to decrypt is
 52            the data stream and the privateKey. Since this is not very secure it is
 53            only used for testing, see <see cref="!:SocketHelper.SendMessageBytes"/>
 54            on a real use case, which uses the instance methods of this class.
 55            </summary>
 56            <param name="inputStream">Input stream of some data</param>
 57            <param name="privateKey">256 bit key (32 bytes)</param>
 58            <returns>Encrypted memory stream, which can be passed on for
 59            networking, authentication, saving files, etc.</returns>
 60        </member>
 61        <member name="M:Delta.Utilities.Cryptography.AES.Decrypt(System.IO.Stream,System.Byte[])">
 62            <summary>
 63            Decrypt encrypted data again (see the Encrypt method). Note: Both the
 64            length of the input stream and the IV seed are saved into the stream
 65            for this method. All you need to decrypt is the data stream and the
 66            privateKey. Since this is not very secure it is only used for testing,
 67            see <see cref="!:SocketHelper.SendMessageBytes"/> on a real use case,
 68            which uses the instance methods of this class.
 69            </summary>
 70            <param name="encryptedData">Data stream returned by Encrypt</param>
 71            <param name="privateKey">Private key for decryption (should be kept
 72            really private and never be transmitted). Please note that while this
 73            is pretty safe and without the private key it is very unlikely that
 74            anyone will decrypt this data, keeping the key really private is most
 75            likely impossible if it is published with your application. PGP is
 76            a much safer option (see links above), but it will make your
 77            application much more complex (which is too much for the Delta Engine
 78            cross platform compatibility, but ok for Windows only tools).
 79            </param>
 80            <returns>The original data that was encrypted before with Encrypt.
 81            This data can be used for network transmission, saving files or
 82            authentication data, etc.</returns>
 83        </member>
 84        <member name="F:Delta.Utilities.Cryptography.AES.aes">
 85            <summary>
 86            Keep an instance of the AES crypto class around, which remembers our
 87            private key (Key) and the seed value (IV). Using the instance methods
 88            of this class is much faster than using the static methods.
 89            </summary>
 90        </member>
 91        <member name="M:Delta.Utilities.Cryptography.AES.#ctor(System.Byte[])">
 92            <summary>
 93            Create new AES Cryptography instance, which is faster than using the
 94            static methods in this class and it provides us with an easy way to
 95            transmit and use the seed (or also called salt) value the first time
 96            and then just use it every time we are encrypting or decrypting data.
 97            Note: Use the Seed property to get the generated random seed value.
 98            </summary>
 99            <param name="privateKey">Private key, which must be 32 bytes</param>
100        </member>
101        <member name="M:Delta.Utilities.Cryptography.AES.#ctor(System.Byte[],System.Byte[])">
102            <summary>
103            Create new AES Cryptography instance, which is faster than using the
104            static methods in this class and it provides us with an easy way to
105            transmit and use the salt value the first time and then just use it
106            every time we are encrypting or decrypting something.
107            </summary>
108            <param name="privateKey">Private key, which must be 32 bytes</param>
109            <param name="seedValue">Seed value, which must be 16 bytes
110            and is usually transmitted from the server via networking (when not
111            using any extra encryption like RSA)</param>
112        </member>
113        <member name="M:Delta.Utilities.Cryptography.AES.Encrypt(System.Byte[])">
114            <summary>
115            Encrypt input data with the current Cryptography instance, to decrypt
116            it the exact same instance with the same key and IV values is needed.
117            </summary>
118            <param name="inputData">Input data to encrypt</param>
119            <returns>The encrypted data</returns>
120        </member>
121        <member name="M:Delta.Utilities.Cryptography.AES.Decrypt(System.Byte[],System.Int32)">
122            <summary>
123            Decrypt encrypted data again (see the Encrypt method). Note: The
124            private key and the IV key must be transmitted and setup before
125            this method is called. The length of the output data also must be
126            known and should be transmitted before this block of encrypted data
127            because the algorithm requires it to be 16 byte blocks, but our output
128            data can be any size.
129            </summary>
130            <param name="encryptedData">Data stream returned by Encrypt</param>
131            <param name="outputDataLength">Length of the output data (the
132            encryptedData.Length might be 0-15 bytes bigger).</param>
133        </member>
134        <member name="P:Delta.Utilities.Cryptography.AES.Seed">
135            <summary>
136            Get the random seed value (16 byte), which was either generated in
137            the constructor or passed as an input parameter. Please note that
138            both the private key and the salt value must be the same for encrypting
139            and decrypting data.
140            </summary>
141        </member>
142        <!-- Badly formed XML comment ignored for member "T:Delta.Utilities.Cryptography.RSA" -->
143        <member name="F:Delta.Utilities.Cryptography.RSA.KeySizeInBits">
144            <summary>
145            Use the 2048 bit key default value, which is pretty big and secure.
146            Generating 512 bit or 1024 bit keys is much faster, but those can be
147            guessed and hacked much quicker (still very hard however).
148            </summary>
149        </member>
150        <member name="F:Delta.Utilities.Cryptography.RSA.DataLength">
151            <summary>
152            Data length for packets. Encrypted data always has this length and
153            you cannot use any input data exceeding this length for encryption.
154            When decrypting we will get back the original array size however.
155            </summary>
156        </member>
157        <member name="F:Delta.Utilities.Cryptography.RSA.rsaProvider">
158            <summary>
159            .NET RSA cryptography provider, which works fine on Windows. We always
160            use a 2048 bit key and OAEP padding.
161            </summary>
162        </member>
163        <member name="M:Delta.Utilities.Cryptography.RSA.#ctor(Delta.Utilities.Xml.XmlNode)">
164            <summary>
165            Create new RSA class instance with the given private or public key.
166            If privateOrPublicKey is null, both keys will be generated (which can
167            take a few seconds even on a fast PC).
168            </summary>
169            <param name="privateOrPublicKey">
170            Loaded public or private key xml data. On clients this is usually just
171            the public key, the server keeps the private key secret. If this is
172            null both the private and the public key are generated and can be
173            saved out via Save.
174            </param>
175        </member>
176        <member name="M:Delta.Utilities.Cryptography.RSA.Save(System.Boolean)">
177            <summary>
178            Export private key or just the public key to an xml node, which can
179            be saved locally and used again next program start (much quicker to
180            load than to generate new keys all the time).
181            </summary>
182            <param name="exportPrivateKey">Export the whole private key? Should
183            only be done on the server, if this is false this method just exports
184            the public key (to be used by the clients).</param>
185            <returns>Xml node with exported key data, which can be saved out to
186            a file like Public.RSA.key or Pivate.RSA.key.</returns>
187        </member>
188        <member name="M:Delta.Utilities.Cryptography.RSA.Encrypt(System.Byte[])">
189            <summary>
190            Encrypt helper method. Please note that you are only allowed to
191            encrypt a maximum of 256 bytes of data (because of the 2048 bits key).
192            Anything bigger will result in an exception.
193            </summary>
194            <param name="dataToEncrypt">Data we want to encrypt. A good candidate
195            is an AES key or seed value or a password hash from a user.</param>
196            <returns>Encrypted data, which is usually a bit longer than the input
197            data. Only the server with the private key can decrypt this.</returns>
198        </member>
199        <member name="M:Delta.Utilities.Cryptography.RSA.Decrypt(System.Byte[])">
200            <summary>
201            Decrypt a previously encrypted message. While encryption is possible
202            with public keys, you will need the private key to decrypt a message
203            again. This method will fail if only the public key is available
204            (e.g. on the client). Only call this on the server side.
205            </summary>
206            <param name="dataToDecrypt">Data to decrypt</param>
207            <returns>Decrypted original data the sender gave us</returns>
208        </member>
209    </members>