1
0
Fork 0
mirror of https://github.com/Luzifer/go-dhparam.git synced 2024-11-08 15:20:03 +00:00

Older OpenSSL versions do not accept "-" as input

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-10-08 11:45:02 +02:00
parent 3f3109ccc9
commit e0478dcafe
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -3,6 +3,8 @@ package dhparam
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"io/ioutil"
"os"
"os/exec" "os/exec"
"strings" "strings"
"testing" "testing"
@ -21,7 +23,19 @@ func execGeneratorIntegration(t *testing.T, bitsize int, generator Generator) {
buf := new(bytes.Buffer) buf := new(bytes.Buffer)
cmd := exec.Command("openssl", "dhparam", "-inform", "PEM", "-in", "-", "-check", "-noout", "-text") f, err := ioutil.TempFile("", "dhparam.*")
if err != nil {
t.Fatalf("Unable to create tempfile: %s", err)
}
defer os.Remove(f.Name())
if _, err = f.Write(pem); err != nil {
t.Fatalf("Unable to write tempfile: %s", err)
}
f.Close()
cmd := exec.Command("openssl", "dhparam", "-inform", "PEM", "-in", f.Name(), "-check", "-noout", "-text")
cmd.Stdin = bytes.NewReader(pem) cmd.Stdin = bytes.NewReader(pem)
cmd.Stdout = buf cmd.Stdout = buf
cmd.Stderr = buf cmd.Stderr = buf