Esempio n. 1
0
 public UsuarioRepository(IMapperProvider mapperProvider, IProtector protector, ApplicationDbContext context)
 {
     this.mapperProvider = mapperProvider;
     this.protector      = protector;
     this.context        = context;
     this.mapper         = this.mapperProvider.GetMapper();
 }
        private void RunTrip(byte[] entropy, DataProtectionScope scope, IProtector protector)
        {
            var encrypted   = protector.Protect(_sampleBytes, entropy, scope);
            var unencrypted = protector.Unprotect(encrypted, entropy, scope);
            var result      = Encoding.UTF8.GetString(unencrypted);

            Assert.Equal(SampleText, result);
        }
Esempio n. 3
0
        public static async Task TestPassword <T>(this IProtector <T> protector, T raw)
        {
            ProtectionKey key = new ProtectionKey
            {
                Password = "******"
            };
            var pro = await protector.Protect(raw, key);

            Assert.IsFalse(await protector.IsProtected(raw));
            Assert.IsTrue(await protector.IsProtected(pro));

            var depro = await protector.Deprotect(pro, key);

            Assert.IsFalse(await protector.IsProtected(depro));
            depro.ShouldDeepEqual(raw);

            /*await Assert.ThrowsExceptionAsync<ProtectionException>(() => protector.Deprotect(pro, new ProtectionKey
             * {
             *  Password = "******"
             * }));*/
        }
 public TCPProvider(TcpClient client)
 {
     _client    = client ?? throw new ArgumentNullException(nameof(client));
     _stream    = _client.GetStream();
     _protector = IoC.GetService <IProtector>();
 }
Esempio n. 5
0
 public LicenseExpirationHandler(IVisualStudio visualStudio, IProtector protector)
 {
     this.visualStudio = visualStudio;
     this.protector    = protector;
 }
Esempio n. 6
0
 public PostFSRepo(string absPath, string rootPath, IFileProvider fileProvider, IProtector <Document> protector) : base(rootPath, fileProvider)
 {
     Protector    = protector;
     AbsolutePath = absPath;
 }
Esempio n. 7
0
 public PostFSRepo(string rootPath, IProtector <Document> protector) : base(rootPath)
 {
     Protector = protector;
 }
Esempio n. 8
0
 /// <summary>
 /// Create <see cref="KeyLoader"/> instance
 /// </summary>
 /// <param name="ipAddress">IP address or hostname of sourse</param>
 /// <param name="protector">Data protector</param>
 public KeyLoader(string ipAddress, IProtector protector)
 {
     this.ipAddress = ipAddress ?? throw new ArgumentNullException(nameof(ipAddress));
     this.protector = protector ?? throw new ArgumentNullException(nameof(protector));
 }