protected override void ProcessRecord() { // 可能であれば、絶対パスだった場合とファイル名だけだった場合の分岐も設定したい // ⇒Issue済み OpensslPath opensslPath = new OpensslPath(Item.TOOLS_DIRECTORY); if (string.IsNullOrEmpty(RootCert)) { RootCert = Path.Combine(opensslPath.CertDir, Item.DEFAULT_ROOTCA_CRT_NAME); } if (string.IsNullOrEmpty(ChainCert)) { ChainCert = Path.Combine(opensslPath.CertDir, "chain.crt"); } if (string.IsNullOrEmpty(ServerCert)) { ServerCert = Path.Combine(opensslPath.CertDir, Item.DEFAULT_SERVER_CRT_NAME); } switch (Mode) { case MODE_ToNginxCert: // ToNginxCert以外のパラメータは未実装 // (今後追加する必要ができてから実装予定。多分Java(Tomcat)用を作るかも。 StringBuilder joinSB = new StringBuilder(); Action <string> AppendingCert = (file) => { if (File.Exists(file)) { using (StreamReader sr = new StreamReader(file, Encoding.UTF8)) { joinSB.Append(sr.ReadToEnd()); } } }; AppendingCert(ServerCert); AppendingCert(ChainCert); AppendingCert(RootCert); if (string.IsNullOrEmpty(Output)) { WriteObject(joinSB.ToString()); } else { using (StreamWriter sw = new StreamWriter(Output, false, new UTF8Encoding(false))) { sw.Write(joinSB.ToString()); } } break; } if (SaveConfig) { OpensslFunction.BackupConf(); } }
protected override void ProcessRecord() { OpensslFunction.SignCertificate(CACrtFile, CAKeyFile, CsrFile, CrtFile, ExpireDays); if (SaveConfig) { OpensslFunction.BackupConf(); } }
protected override void ProcessRecord() { OpensslFunction.CreateCSR(CsrFile, KeyFile, Subject, AlternateNames, RsaBits); if (SaveConfig) { OpensslFunction.BackupConf(); } }
protected override void ProcessRecord() { OpensslFunction.CreateRootCA(CACrtFile, CAKeyFile, Subject, ExpireDays, RsaBits); if (SaveConfig) { OpensslFunction.BackupConf(); } }
protected override void ProcessRecord() { OpensslFunction.RevokeCertificate(CrtFile, CACrtFile, CAKeyFile); if (SaveConfig) { OpensslFunction.BackupConf(); } }
protected override void ProcessRecord() { if (File.Exists(SourcePath)) { string text = OpensslFunction.ConvertToText(SourcePath, Csr, Crt, Key); WriteObject(text); if (SaveConfig) { OpensslFunction.BackupConf(); } } }