dnauck / Portable.Licensing

Portable.Licensing is a cross platform software licensing framework which allows you to implement licensing into your application or library. It provides you all tools to create and validate licenses for your software.
http://dev.nauck-it.de/projects/portable-licensing
MIT License
592 stars 173 forks source link

The input is not a valid Base-64 #58

Closed m-hcz closed 1 year ago

m-hcz commented 1 year ago

Hi, could u help me with this error "'The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters"?

License was generated by Portable.Licensing 1.1.0 in .NET 7 console app and validation was by Portable.Licensing 1.1.0 in WPF app .NET 4.8.

image

Shahabs2004 commented 1 year ago

I had the same problem. Until I realized that instead of using the file content, I passed the file name to the function. Make sure that the file content is read correctly(i mean public key File). Read publickey File into a reachtextbox to Check it

Shahabs2004 commented 1 year ago
        var publicKey = File.ReadAllText("publicKey.pem");
        var Testlicense = Portable.Licensing.License.Load(File.ReadAllText("license.lic"));
        var validationFailures = Testlicense.Validate()
                                .ExpirationDate()
        .When(lic => lic.Type == LicenseType.Trial)
                                .And()
                                .Signature(publicKey)
                                .AssertValidLicense();
m-hcz commented 1 year ago

thanks for help :)