public async Task InvokeAsync(HttpContext context) { using (MemoryStream clone = new()) { await context.Request.Body.CopyToAsync(clone).ConfigureAwait(false); if (clone.Length != 0L) { clone.Position = 0L; context.Request.Body = PgpMethods.Decrypt(clone, this._keys.PrivateKey); } } await this._next(context).ConfigureAwait(false); }
public SecureController(PgpKeys keys) { this._publicKey = Encoding.ASCII.GetString(PgpMethods.GetKeyBytes(keys.PublicKey.Encode)); }