コード例 #1
0
        /// <summary>GetBase64StringFromPemFilePath</summary>
        /// <param name="pemFilePath">string</param>
        /// <param name="label">RFC7468Label</param>
        /// <returns>Base64String</returns>
        public static string GetBase64StringFromPemFilePath(string pemFilePath, RFC7468Label label)
        {
            string pemString = File.ReadAllText(pemFilePath);

            return(CustomEncode.ToBase64String(
                       PrivacyEnhancedMail.GetBytesFromPemString(
                           pemString, PrivacyEnhancedMail.EnumToString(label))));
        }
コード例 #2
0
        /// <summary>GetX509FromPemFilePath</summary>
        /// <param name="pemFilePath">string</param>
        /// <param name="label">RFC7468Label</param>
        /// <returns>X509Certificate2</returns>
        public static X509Certificate2 GetX509FromPemFilePath(string pemFilePath, RFC7468Label label)
        {
            string pemString = File.ReadAllText(pemFilePath);

            return(new X509Certificate2(
                       PrivacyEnhancedMail.GetBytesFromPemString(
                           pemString, PrivacyEnhancedMail.EnumToString(label))));
        }