Пример #1
0
        /// <summary>
        /// Gets a signing key based on settings
        /// </summary>
        /// <param name="settings">The identity settings</param>
        /// <returns></returns>
        private static ECDsaSecurityKey GetSigningKey(IdentitySettings settings)
        {
            // source directory
            var sourceDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty;

            // build full path to key
            var fullKeyPath = Path.GetFullPath(settings.SigningKeyPath, sourceDirectory);

            // read signing key path to load key
            var eccPem = File.ReadAllText(fullKeyPath);

            // build key and import
            var edc = ECDsa.Create();

            // import pem content into key
            edc?.ImportFromPem(eccPem);

            // create a security key based on ECD
            return(new ECDsaSecurityKey(edc)
            {
                KeyId = "default"
            });
        }
Пример #2
0
 /// <summary>
 /// Creates new instance of public origin middleware
 /// </summary>
 /// <param name="settings">The settings</param>
 public PublicOriginMiddleware(IdentitySettings settings)
 {
     this.settings = settings;
 }