[GH-ISSUE #25] Without ExpireAt? #23

Closed
opened 2026-02-26 01:35:48 +03:00 by kerem · 2 comments
Owner

Originally created by @SonaBIMDev on GitHub (Oct 21, 2022).
Original GitHub issue: https://github.com/junian/Standard.Licensing/issues/25

Hi, is it possible to generate a Licence without an ExpiresAt condition?
Thx

Originally created by @SonaBIMDev on GitHub (Oct 21, 2022). Original GitHub issue: https://github.com/junian/Standard.Licensing/issues/25 Hi, is it possible to generate a Licence without an ExpiresAt condition? Thx
kerem closed this issue 2026-02-26 01:35:48 +03:00
Author
Owner

@AntiGuideAkquinet commented on GitHub (Feb 24, 2023):

Yes I think you can. I used the example provided in the README and commented out the ExpiresAt, which still produces a XML string.

var passPhrase = "TestPassphrase";

var keyGenerator = Standard.Licensing.Security.Cryptography.KeyGenerator.Create(); 
var keyPair = keyGenerator.GenerateKeyPair();
var privateKey = keyPair.ToEncryptedPrivateKeyString(passPhrase);  
var publicKey = keyPair.ToPublicKeyString();

var license = License.New()  
    .WithUniqueIdentifier(Guid.NewGuid())  
    .As(LicenseType.Trial)  
    //.ExpiresAt(DateTime.Now.AddDays(30))  
    .WithMaximumUtilization(5)  
    .WithProductFeatures(new Dictionary<string, string>  
    {  
        {"Sales Module", "yes"},  
        {"Purchase Module", "yes"},  
        {"Maximum Transactions", "10000"}  
    })  
    .LicensedTo("John Doe", "john.doe@example.com")  
    .CreateAndSignWithPrivateKey(privateKey, passPhrase);
    
Console.WriteLine(license.ToString());
<!-- gh-comment-id:1442884130 --> @AntiGuideAkquinet commented on GitHub (Feb 24, 2023): Yes I think you can. I used the example provided in the README and commented out the ExpiresAt, which still produces a XML string. ```C# var passPhrase = "TestPassphrase"; var keyGenerator = Standard.Licensing.Security.Cryptography.KeyGenerator.Create(); var keyPair = keyGenerator.GenerateKeyPair(); var privateKey = keyPair.ToEncryptedPrivateKeyString(passPhrase); var publicKey = keyPair.ToPublicKeyString(); var license = License.New() .WithUniqueIdentifier(Guid.NewGuid()) .As(LicenseType.Trial) //.ExpiresAt(DateTime.Now.AddDays(30)) .WithMaximumUtilization(5) .WithProductFeatures(new Dictionary<string, string> { {"Sales Module", "yes"}, {"Purchase Module", "yes"}, {"Maximum Transactions", "10000"} }) .LicensedTo("John Doe", "john.doe@example.com") .CreateAndSignWithPrivateKey(privateKey, passPhrase); Console.WriteLine(license.ToString()); ```
Author
Owner

@SonaBIMDev commented on GitHub (Feb 24, 2023):

Hi @AntiGuideAkquinet
Wow! I didn't believe in it anymore!
Thx for sharing!

<!-- gh-comment-id:1442899491 --> @SonaBIMDev commented on GitHub (Feb 24, 2023): Hi @AntiGuideAkquinet Wow! I didn't believe in it anymore! Thx for sharing!
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Standard.Licensing#23
No description provided.