/// <summary>
        /// Get Deserialized Ticket from token.
        /// </summary>
        /// <param name="token"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException"></exception>
        /// <exception cref="CryptographicException"></exception>
        public static AuthenticationTicket GetTicket(string token, LegacyTokenAuthenticationOptions options)
        {
            if (string.IsNullOrWhiteSpace(token))
            {
                throw new ArgumentNullException(nameof(token));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            if (string.IsNullOrWhiteSpace(options.DecryptionKey))
            {
                throw new ArgumentNullException(options.DecryptionKey);
            }
            if (string.IsNullOrWhiteSpace(options.ValidationKey))
            {
                throw new ArgumentNullException(options.ValidationKey);
            }

            var encryptionKey = DeriveKey(new CryptographicKey(HexToBinary(options.DecryptionKey)));
            var validationKey = DeriveKey(new CryptographicKey(HexToBinary(options.ValidationKey)));

            var raw = Unprotect(Base64UrlTextDecode(token), encryptionKey, validationKey,
                                new CryptoAlgorithmFactory(options));

            if (raw == null)
            {
                throw new CryptographicException();
            }

            var ticket = TicketSerializer.Deserialize(raw);

            return(ticket);
        }
 /// <summary>
 /// CryptoAlgorithmFactory
 /// </summary>
 /// <param name="options"></param>
 public CryptoAlgorithmFactory(LegacyTokenAuthenticationOptions options)
 {
     _options = options;
 }