Represents a class used to create RollingIv instances.
예제 #1
0
        /// <summary>
        /// Creates a new instance of the <see cref="EndpointCrypto"/> class used for server-side cryptography.
        /// </summary>
        /// <remarks>
        /// Encryption uses the local IV, decryption uses the remote IV.
        /// Server's local IV has flipped version, Client's local IV has regular version.
        /// </remarks>
        /// <param name="factory">The <see cref="RollingIvFactory"/> instance to use.</param>
        /// <param name="clientIv">The IV for the client.</param>
        /// <param name="serverIv">The IV for the server.</param>
        /// <returns>a new <see cref="EndpointCrypto"/> instance.</returns>
        public static EndpointCrypto Server(RollingIvFactory factory, byte[] clientIv, byte[] serverIv)
        {
            Guard.NotNull(() => factory, factory);
            Guard.NotNull(() => clientIv, clientIv);
            Guard.NotNull(() => serverIv, serverIv);

            var encryptor = factory.CreateEncryptIv(clientIv, VersionMaskType.Complement);
            var decryptor = factory.CreateDecryptIv(serverIv, VersionMaskType.None);

            return(new EndpointCrypto(encryptor, decryptor));
        }
예제 #2
0
        /// <summary>
        /// Creates a new instance of the <see cref="EndpointCrypto"/> class used for server-side cryptography.
        /// </summary>
        /// <remarks>
        /// Encryption uses the local IV, decryption uses the remote IV.
        /// Server's local IV has flipped version, Client's local IV has regular version.
        /// </remarks>
        /// <param name="factory">The <see cref="RollingIvFactory"/> instance to use.</param>
        /// <param name="clientIv">The IV for the client.</param>
        /// <param name="serverIv">The IV for the server.</param>
        /// <returns>a new <see cref="EndpointCrypto"/> instance.</returns>
        public static EndpointCrypto Server(RollingIvFactory factory, byte[] clientIv, byte[] serverIv)
        {
            Guard.NotNull(() => factory, factory);
            Guard.NotNull(() => clientIv, clientIv);
            Guard.NotNull(() => serverIv, serverIv);

            var encryptor = factory.CreateEncryptIv(clientIv, VersionMaskType.Complement);
            var decryptor = factory.CreateDecryptIv(serverIv, VersionMaskType.None);

            return new EndpointCrypto(encryptor, decryptor);
        }
예제 #3
0
        private void ConfigureInternal(OsServiceConfiguration configuration)
        {
            this.serverConfiguration = new ServerConfiguration(configuration);

            this.ivFactory = this.CreateRollingIvFactory();
            this.acceptor = this.CreateSocketAcceptor();
        }