Beispiel #1
0
 public static Token CreateAndSign(string username,string profileImg, AccessType accessLevel, DateTimeOffset? expiredTime)
 {
     var expiration = expiredTime.HasValue ? expiredTime.Value : DateTimeOffset.Now + TimeSpan.FromDays(2);
     var token = new Token(username, profileImg, accessLevel, expiration);
     SignToken(token);
     return token;
 }
Beispiel #2
0
 private static Token SignToken(Token token)
 {
     using (var signer = DsaHelper.GetPrivateKey())
     {
         var rbgHash = token.ComposeData();
         var sigBytes = signer.CreateSignature(rbgHash);
         var sigStr = ConvertToString(sigBytes);
         token.Signature = sigStr;
     }
     return token;
 }