public AuthenticationController(IUserRepository userRepository, IEncryptorDecryptor encryptorDecryptor, IJwtFactory jwtFactory, IOptions <JwtIssuerOptions> jwtOptions) { this._userRepository = userRepository; this._encryptorDecryptor = encryptorDecryptor; _jwtFactory = jwtFactory; _jwtOptions = jwtOptions.Value; }
internal PagedContainerHeader(Stream stm, IEncryptorDecryptor encryptorDecryptor) { if (stm.Length < HEADER_PART) { throw new InvalidDataException("PagedContainerHeader: File corrupted (too small)"); } stm.Position = 0; var buff = new byte[HEADER_PART]; stm.Read(buff, 0, buff.Length); int offset = 0; var sign = buff.GetInt(ref offset); // 4 byte if (sign != SIGN) { throw new InvalidDataException($"PagedContainerHeader: File corruped (signature {sign:X}h invalid, must be {SIGN:X}h)"); } PageSize = buff.GetInt(ref offset); // 4 byte PageUserDataSize = PageSize - 4; Extenders.ValidatePageSize(PageSize); DirectoryFirstPage = buff.GetInt(ref offset); // 4 byte if (DirectoryFirstPage < 0) { throw new InvalidDataException($"PagedContainerHeader: DirectoryFirstPage has invalid value ({DirectoryFirstPage})"); } Flags = (PersistentContainerFlags)(buff.GetUInt16(ref offset) & 0xFFFF); var flagsData = buff[offset]; CompressType = (PersistentContainerCompressType)flagsData; DataHandler = getDataHandler(CompressType, encryptorDecryptor); }
internal NoDataPacker(IEncryptorDecryptor encryptorDecryptor) => this.encryptorDecryptor = encryptorDecryptor;
public PersistentContainerSettings With(SymmetricAlgorithm algo) { encryptorDecryptor = new Symmetric(algo); return(this); }
IDataHandler getDataHandler(PersistentContainerCompressType compressType, IEncryptorDecryptor encryptorDecryptor) => compressType switch {
public void TestSetup() { _encryptorDecryptor = new EncryptorDecryptor(); }