Skip to content

Commit

Permalink
#v4.4.2203.0-rc - Fix .Net Setup app and make SDK work with plain tex…
Browse files Browse the repository at this point in the history
…t private key (#98)
  • Loading branch information
ppatidar2021 authored Mar 28, 2022
1 parent 47719d7 commit b3e1d4d
Show file tree
Hide file tree
Showing 6 changed files with 164 additions and 284 deletions.
5 changes: 3 additions & 2 deletions BitPay/BitPay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Microsoft.Extensions.Configuration;
using Org.BouncyCastle.Math;

/**
* @author Antonio Buedo
Expand Down Expand Up @@ -1860,8 +1861,8 @@ private async Task InitKeys()
}
else
{
_ecKey = KeyUtils.CreateEcKey();
await KeyUtils.SaveEcKey(_ecKey);
_ecKey = KeyUtils.CreateEcKeyFromString(_configuration
.GetSection("BitPayConfiguration:EnvConfig:" + _env + ":PrivateKey").Value);
}
}

Expand Down
4 changes: 4 additions & 0 deletions BitPay/EcKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ public BigInteger PrivateKey
{
return _privateKey;
}
set
{

}
}

/// <summary>
Expand Down
7 changes: 6 additions & 1 deletion BitPay/KeyUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ public static EcKey CreateEcKeyFromHexString(string privateKey)
var key = new EcKey(pkey);
return key;
}

public static EcKey CreateEcKeyFromString(string privateKey)
{
var pkey = new BigInteger(privateKey);
var key = new EcKey(pkey);
return key;
}
// Convenience method.
public static EcKey CreateEcKeyFromHexStringFile(string privKeyFile)
{
Expand Down
Loading

0 comments on commit b3e1d4d

Please sign in to comment.