// TestReGenerate ensures Regenerate() is abel to use the provided CSR as a template for signing a new
// CSR using priv.
TestReGenerate ensures Regenerate() is abel to use the provided CSR as a template for signing a new
CSR using priv.
// TestReGenerate ensures Regenerate () is abel to use the provided CSR as a template for signing a new // CSR using priv .
func TestReGenerate(t *testing.T) {
	var req = &CertificateRequest{
		Names: []Name{
			{
				C:  "US",
				ST: "California",
				L:  "San Francisco",
				O:  "CloudFlare",
				OU: "Systems Engineering",
			},
		},
		CN:         "cloudflare.com",
		Hosts:      []string{"cloudflare.com", "www.cloudflare.com", "192.168.0.1"},
		KeyRequest: &KeyRequest{"ecdsa", 256},
	}
	_, key, err := ParseRequest(req)
	if err != nil {
		t.Fatalf("%v", err)
	}
	priv, err := helpers.ParsePrivateKeyPEM(key)
	if err != nil {
		t.Fatalf("%v", err)
	}
	csr, err := Generate(priv, req)
	if err != nil {
		t.Fatalf("%v", err)
	}
	if _, _, err = helpers.ParseCSR(csr); err != nil {
		t.Fatalf("%v", err)
	}
	_, err = Regenerate(priv, csr)
	if err != nil {
		t.Fatalf("%v", err)
	}
}
func TestReGenerate ( t * testing . T ) { var req = & CertificateRequest { Names : [ ] Name { { C : " " , ST : " " , L : " " , O : " " , OU : " " , } , } , CN : " " , Hosts : [ ] string { " " , " " , " " } , KeyRequest : & KeyRequest { " " , 256 } , } _ , key , err := ParseRequest ( req ) if err != nil { t . Fatalf ( " " , err ) } priv , err := helpers . ParsePrivateKeyPEM ( key ) if err != nil { t . Fatalf ( " " , err ) } csr , err := Generate ( priv , req ) if err != nil { t . Fatalf ( " " , err ) } if _ , _ , err = helpers . ParseCSR ( csr ) ; err != nil { t . Fatalf ( " " , err ) } _ , err = Regenerate ( priv , csr ) if err != nil { t . Fatalf ( " " , err ) } }
TestReGenerate ensures Regenerate() is abel to use the provided CSR as a template for signing a new
CSR using priv.
TestReGenerate ensures Regenerate () is abel to use the provided CSR as a template for signing a new CSR using priv .