// X.509からの変換 #region X.509 鍵 → ECDsaProvider(Cngkey, ECParameters) → Jwk // X.509 は、NET47以降 #if NET45 || NET46 #else #region *.cer #region Jwk /// <summary>X509CerToJwk</summary> /// <param name="certificateFilePath">X.509鍵(*.cer)</param> /// <param name="settings">JsonSerializerSettings</param> /// <returns>Jwk公開鍵</returns> public static string X509CerToJwk( string certificateFilePath, JsonSerializerSettings settings = null) { return(EccPublicKeyConverter.ParamToJwk( // *.cer is PublicKey -> ExportParameters(false) EccPublicKeyConverter.X509CerToProvider(certificateFilePath).ExportParameters(false), settings)); }
/// <summary>X509CerToECParam</summary> /// <param name="certificateFilePath">X.509鍵(*.cer)</param> /// <returns>ECParameters(公開鍵)</returns> public static ECParameters X509CerToECParam(string certificateFilePath) { return(EccPublicKeyConverter.X509CerToProvider( certificateFilePath).ExportParameters(false)); }
/// <summary>X509CerToCngkey</summary> /// <param name="certificateFilePath">X.509鍵(*.cer)</param> /// <returns>CngKey(公開鍵)</returns> public static CngKey X509CerToCngkey(string certificateFilePath) { return(((ECDsaCng)EccPublicKeyConverter.X509CerToProvider(certificateFilePath)).Key); }