[🐛] 9차 푸시 확인

Signed-off-by: seonkyu.kim <sean.kk@daum.net>
This commit is contained in:
김선규 2024-11-30 11:47:33 +09:00
parent aee9a805e0
commit 8f7f1c4894

View File

@ -16,9 +16,20 @@ public class PushServiceWithP12
public PushServiceWithP12(string keysFilePath, string p12Path, string apnsTopic)
{
// 존재 안하면 예외 던져 버리는거
if (!File.Exists(keysFilePath))
{
Console.WriteLine($"File not found: {keysFilePath}");
throw new FileNotFoundException("The specified file was not found", keysFilePath);
}
var keys = JsonSerializer.Deserialize<Dictionary<string, string>>(File.ReadAllText(keysFilePath));
// TEST
Console.WriteLine($"File Exists: {keys}");
Console.WriteLine("Keys content:");
foreach (var key in keys)
{
Console.WriteLine($"{key.Key}: {key.Value}");
}
p12Password = keys["Password"];
this.p12Path = p12Path;
@ -47,9 +58,10 @@ public class PushServiceWithP12
try
{
var certificate = new X509Certificate2(p12Path, p12Password,
X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable);
X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable
);
handler.ClientCertificates.Add(certificate);
Console.WriteLine("Certificate successfully loaded.");
}
catch (CryptographicException ex)
{