Open markovejnovic opened 5 years ago
This seems to be an issue with using a string
in CreateAndSignPrivateKey
, due to the padding block being truncated as described here.
Worth noting that my key generation and license generation code snippets are two different code blocks.
I am storing the license to a file as well and reading it from it after. However, I'm using File.ReadAllText(path)
instead of FIle.ReadAllBytes(path)
like you are. Maybe it's worth trying like that.
Hello,
For anyone who is trying this NuGet I have downloaded the project source code and run the unit test for generating the license and it worked...then I checked my code and I think that Visual Studio used a wrong namespace for the KeyGenerator class.
Here is my code that generates the private and public keys that works:
namespace StandardLicensingLicenseGenerator
{
using System;
public class KeysGenerator
{
public Tuple<string, string> Generate(string secretPassPhrase)
{
var keyGenerator = Standard.Licensing.Security.Cryptography.KeyGenerator.Create();
var keyPair = keyGenerator.GenerateKeyPair();
var privateKey = keyPair.ToEncryptedPrivateKeyString(secretPassPhrase);
var publicKey = keyPair.ToPublicKeyString();
return new Tuple<string, string>(privateKey, publicKey);
}
}
}
I am facing the same issue every thing was working fine until last year and now i have to generate a new license and all of sudden the keys pad lock broken issue is there. even unable to parse the old licenses (with old keys) base64 error
Hello. After reading a private key created with
I am unable to create a license by reading the file:
due to an exception thrown by
BouncyCastle
: