test ike crypto works, new protos from pb

This commit is contained in:
raphaeIl
2025-01-11 10:23:59 -05:00
parent 0b12a29289
commit 01ebb3239d
661 changed files with 322271 additions and 220654 deletions

View File

@@ -9,6 +9,7 @@ using Novaria.Common.Utils;
using System.IO;
using System.Numerics;
using System.Security.Cryptography;
using Microsoft.AspNetCore.Http;
namespace Novaria.SDKServer.Controllers.Api
{
@@ -53,26 +54,35 @@ namespace Novaria.SDKServer.Controllers.Api
[HttpOptions] // Ike
public IActionResult OptionsRequest()
{
Log.Information("Received Gateway Ike Options Request, Payload: ");
// store key which is used in AeadTool
using var memoryStream = new MemoryStream();
Request.Body.CopyTo(memoryStream); // Copy request body to MemoryStream
byte[] rawBytes = memoryStream.ToArray(); // Get raw bytes from MemoryStream
// Set response headers
Response.Headers.Add("Date", DateTime.UtcNow.ToString("R"));
Response.Headers.Add("Content-Length", "251");
Response.Headers.Add("Connection", "keep-alive");
Utils.PrintByteArray(rawBytes);
//byte[] msgId = BitConverter.GetBytes(msg.msgId);
// Set cookies
Response.Headers.Append("Set-Cookie", "acw_tc=cb6df452e3196d1ec00d2fcdf7726b25ed2accbaa45e1066701a61d2da90b384;path=/;HttpOnly;Max-Age=1800");
Response.Headers.Append("Set-Cookie", "SERVERID=eef797ff9d3671d413582d7dc2f39f29|1736422941|1736422941;Path=/");
Response.Headers.Append("Set-Cookie", "SERVERCORSID=eef797ff9d3671d413582d7dc2f39f29|1736422941|1736422941;Path=/;SameSite=None;Secure");
// Set binary content as the response body
string filePath = "E:\\documents\\Decompiling\\Extracted\\NOVA\\Novaria\\Novaria.SDKServer\\options_response"; // Replace with the actual file path
byte[] fileBytes = System.IO.File.ReadAllBytes(filePath);
//// Set response headers
//Response.Headers.Add("Date", DateTime.UtcNow.ToString("R"));
//Response.Headers.Add("Content-Length", "251");
//Response.Headers.Add("Connection", "keep-alive");
// Write bytes directly to response body
Response.Body.WriteAsync(fileBytes, 0, fileBytes.Length);
//// Set cookies
//Response.Headers.Append("Set-Cookie", "acw_tc=cb6df452e3196d1ec00d2fcdf7726b25ed2accbaa45e1066701a61d2da90b384;path=/;HttpOnly;Max-Age=1800");
//Response.Headers.Append("Set-Cookie", "SERVERID=eef797ff9d3671d413582d7dc2f39f29|1736422941|1736422941;Path=/");
//Response.Headers.Append("Set-Cookie", "SERVERCORSID=eef797ff9d3671d413582d7dc2f39f29|1736422941|1736422941;Path=/;SameSite=None;Secure");
// Return no content since the body is written manually
//// Set binary content as the response body
//string filePath = "E:\\documents\\Decompiling\\Extracted\\NOVA\\Novaria\\Novaria.SDKServer\\options_response"; // Replace with the actual file path
//byte[] fileBytes = System.IO.File.ReadAllBytes(filePath);
//// Write bytes directly to response body
//Response.Body.WriteAsync(fileBytes, 0, fileBytes.Length);
//// Return no content since the body is written manually
return new EmptyResult();
}