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:
parent
3f3109ccc9
commit
e0478dcafe
1 changed files with 15 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue