コード例 #1
0
        private JwtPayload ToJWTPayload(string data, string readersPublicKeyContents)
        {
            var payload = new JwtPayload {
                { "iss", Issuer },
                { "encrypted_key_base64", JWTService.Encrypt(secret, readersPublicKeyContents) },                  // Receivers public key
                { "encrypted_iv_base64", JWTService.Encrypt(salt, readersPublicKeyContents) },                     // Receivers public key
                { "sym_encrypted_data", SymmetricCryptoService.Encrypt(data, symCryptoKey.Key, symCryptoKey.IV) }, // These data can be large
                { "exp", (Int32)(DateTime.UtcNow.AddHours(1).Subtract(ExpirationDate)).TotalSeconds },             // Expiration
                { "iat", (Int32)(DateTime.UtcNow.Subtract(ExpirationDate)).TotalSeconds }  // Issued At
            };

            return(payload);
        }