forked from AcaMate/AcaMate_API
[🐛] 9차 푸시 확인
Signed-off-by: seonkyu.kim <sean.kk@daum.net>
This commit is contained in:
parent
aee9a805e0
commit
8f7f1c4894
|
@ -16,9 +16,20 @@ public class PushServiceWithP12
|
||||||
|
|
||||||
public PushServiceWithP12(string keysFilePath, string p12Path, string apnsTopic)
|
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));
|
var keys = JsonSerializer.Deserialize<Dictionary<string, string>>(File.ReadAllText(keysFilePath));
|
||||||
// TEST
|
// TEST
|
||||||
Console.WriteLine($"File Exists: {keys}");
|
Console.WriteLine("Keys content:");
|
||||||
|
foreach (var key in keys)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"{key.Key}: {key.Value}");
|
||||||
|
}
|
||||||
|
|
||||||
p12Password = keys["Password"];
|
p12Password = keys["Password"];
|
||||||
this.p12Path = p12Path;
|
this.p12Path = p12Path;
|
||||||
|
@ -47,9 +58,10 @@ public class PushServiceWithP12
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var certificate = new X509Certificate2(p12Path, p12Password,
|
var certificate = new X509Certificate2(p12Path, p12Password,
|
||||||
X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable);
|
X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable
|
||||||
|
);
|
||||||
handler.ClientCertificates.Add(certificate);
|
handler.ClientCertificates.Add(certificate);
|
||||||
|
Console.WriteLine("Certificate successfully loaded.");
|
||||||
}
|
}
|
||||||
catch (CryptographicException ex)
|
catch (CryptographicException ex)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user