Exemplo n.º 1
0
        /// <summary>
        /// X509CerToProvider
        /// X.509公開鍵(*.cer)からRsaProviderへ変換
        /// </summary>
        /// <param name="certificateFilePath"></param>
        /// <returns>RSACryptoServiceProvider</returns>
        public static RSACryptoServiceProvider X509CerToProvider(string certificateFilePath)
        {
            DigitalSignX509 dsX509 = new DigitalSignX509(
                certificateFilePath, "", "SHA256", X509KeyStorageFlags.DefaultKeySet);

            if (dsX509.X509Certificate.PrivateKey == null)
            {
                AsymmetricAlgorithm aa = dsX509.X509Certificate.PublicKey.Key;
                if (aa is RSACryptoServiceProvider)
                {
                    return((RSACryptoServiceProvider)aa);
                }
                else
                {
                }
            }
            else
            {
            }

            return(null);
        }
Exemplo n.º 2
0
 /// <summary>Constructor</summary>
 /// <param name="certificateFilePath">DigitalSignX509に渡すcertificateFilePathパラメタ</param>
 /// <param name="password">DigitalSignX509に渡すpasswordパラメタ</param>
 /// <param name="flag">X509KeyStorageFlags</param>
 public JWT_RS256_X509(string certificateFilePath, string password, X509KeyStorageFlags flag)
 {
     this.DigitalSignX509 = new DigitalSignX509(certificateFilePath, password, "SHA256", flag);
 }