@@ -17,14 +17,10 @@ limitations under the License.
17
17
package controller
18
18
19
19
import (
20
- "crypto/rand"
21
20
"crypto/tls"
22
21
"crypto/x509"
23
- "crypto/x509/pkix"
24
- "encoding/pem"
25
22
"errors"
26
23
"fmt"
27
- "math/big"
28
24
"net/http"
29
25
"net/url"
30
26
"os"
@@ -2494,45 +2490,6 @@ func setPodinfoImageAnnotations(img gcrv1.Image, tag string) gcrv1.Image {
2494
2490
return mutate .Annotations (img , metadata ).(gcrv1.Image )
2495
2491
}
2496
2492
2497
- // These two taken verbatim from https://ericchiang.github.io/post/go-tls/
2498
- func certTemplate () (* x509.Certificate , error ) {
2499
- // generate a random serial number (a real cert authority would
2500
- // have some logic behind this)
2501
- serialNumberLimit := new (big.Int ).Lsh (big .NewInt (1 ), 128 )
2502
- serialNumber , err := rand .Int (rand .Reader , serialNumberLimit )
2503
- if err != nil {
2504
- return nil , errors .New ("failed to generate serial number: " + err .Error ())
2505
- }
2506
-
2507
- tmpl := x509.Certificate {
2508
- SerialNumber : serialNumber ,
2509
- Subject : pkix.Name {Organization : []string {"Flux project" }},
2510
- SignatureAlgorithm : x509 .SHA256WithRSA ,
2511
- NotBefore : time .Now (),
2512
- NotAfter : time .Now ().Add (time .Hour ), // valid for an hour
2513
- BasicConstraintsValid : true ,
2514
- }
2515
- return & tmpl , nil
2516
- }
2517
-
2518
- func createCert (template , parent * x509.Certificate , pub interface {}, parentPriv interface {}) (
2519
- cert * x509.Certificate , certPEM []byte , err error ) {
2520
-
2521
- certDER , err := x509 .CreateCertificate (rand .Reader , template , parent , pub , parentPriv )
2522
- if err != nil {
2523
- return
2524
- }
2525
- // parse the resulting certificate so we can use it again
2526
- cert , err = x509 .ParseCertificate (certDER )
2527
- if err != nil {
2528
- return
2529
- }
2530
- // PEM encode the certificate (this is a standard TLS encoding)
2531
- b := pem.Block {Type : "CERTIFICATE" , Bytes : certDER }
2532
- certPEM = pem .EncodeToMemory (& b )
2533
- return
2534
- }
2535
-
2536
2493
func TestOCIContentConfigChanged (t * testing.T ) {
2537
2494
tests := []struct {
2538
2495
name string
0 commit comments