/// <summary>
        /// Load the <see cref="JudgeAuthenticationOptions.JudgePublicKey"/> from the specified PEM file containing a
        /// RSA public key.
        /// </summary>
        /// <param name="options">The <see cref="JudgeAuthenticationOptions"/> object.</param>
        /// <param name="file">Path to the PEM file containing public key.</param>
        /// <exception cref="ArgumentNullException">
        ///     <paramref name="options"/> is null
        ///     or
        ///     <paramref name="file"/> is null.
        /// </exception>
        public static void LoadJudgePublicKeyFromCertificate(this JudgeAuthenticationOptions options, string file)
        {
            Contract.NotNull(options, nameof(options));
            Contract.NotNull(file, nameof(file));

            options.JudgePublicKey?.Dispose();
            options.JudgePublicKey = Pem.ReadRsaKey(file);
        }
Пример #2
0
        private SecurityKey GetJwtIssuerSigningKey()
        {
            var configSection = GetJudgeConfig();
            var keyFileName   = configSection.GetValue <string>("JwtSigningKey");
            var key           = Pem.ReadRsaKey(keyFileName);

            return(new RsaSecurityKey(key));
        }