1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
package selfsign
import (
"io/ioutil"
"testing"
"time"
"github.com/cloudflare/cfssl/config"
"github.com/cloudflare/cfssl/helpers"
)
const (
keyFile = "testdata/localhost.key"
csrFile = "testdata/localhost.csr"
)
func TestDefaultSign(t *testing.T) {
csrBytes, err := ioutil.ReadFile(csrFile)
if err != nil {
t.Fatal(err)
}
keyBytes, err := ioutil.ReadFile(keyFile)
if err != nil {
t.Fatal(err)
}
priv, err := helpers.ParsePrivateKeyPEM(keyBytes)
if err != nil {
t.Fatal(err)
}
profile := config.DefaultConfig()
profile.Expiry = 10 * time.Hour
_, err = Sign(priv, csrBytes, profile)
if err != nil {
t.Fatal(err)
}
}
|