예제 #1
0
        /// <summary>
        /// Creates a security token easily adopted into various services in the format of the <see cref="SecurityToken.ToString()"/> method.
        /// The token itself is encrypted using the <see cref="AdvancedEncryptionStandardUtility.Encrypt"/> method.
        /// </summary>
        /// <param name="settings">The to apply to <see cref="SecurityToken"/> instance.</param>
        /// <param name="securityKey">The key to use in the encryption algorithm.</param>
        /// <param name="securityInitializationVector">The initialization vector (IV) to use in the encryption algorithm.</param>
        /// <returns>A security token easily adopted into various services in the format of the <see cref="SecurityToken.ToString()"/> method.</returns>
        public static byte[] CreateEncryptedSecurityToken(SecurityTokenSettings settings, byte[] securityKey, byte[] securityInitializationVector)
        {
            SecurityToken token = SecurityToken.Create(settings);

            return(CreateEncryptedSecurityToken(token, securityKey, securityInitializationVector));
        }
예제 #2
0
 /// <summary>
 /// Creates a security token easily adopted into various services in the format of the <see cref="SecurityToken.ToString()"/> method.
 /// The token itself is encrypted using the <see cref="AdvancedEncryptionStandardUtility.Encrypt"/>
 /// </summary>
 /// <param name="token">The <see cref="SecurityToken"/> to convert and encrypt to a byte[] representation.</param>
 /// <param name="securityKey">The key to use in the encryption algorithm.</param>
 /// <param name="securityInitializationVector">The initialization vector (IV) to use in the encryption algorithm.</param>
 /// <returns>A security token easily adopted into various services in the format of the <see cref="SecurityToken.ToString()"/> method.</returns>
 public static byte[] CreateEncryptedSecurityToken(SecurityToken token, string securityKey, string securityInitializationVector)
 {
     return(CreateEncryptedSecurityToken(token, securityKey, securityInitializationVector, Encoding.UTF8));
 }