@@ -3,6 +3,7 @@ package certrotation
33import (
44 "crypto/x509"
55 "crypto/x509/pkix"
6+ "slices"
67 "strings"
78 "testing"
89 "time"
@@ -726,6 +727,11 @@ func TestClientRotation_NewCertificate_WithKeyPairGenerator(t *testing.T) {
726727 keyGen : crypto.ECDSAKeyPairGenerator {Curve : crypto .P256 },
727728 wantAlg : x509 .ECDSA ,
728729 },
730+ {
731+ name : "ECDSA-P384" ,
732+ keyGen : crypto.ECDSAKeyPairGenerator {Curve : crypto .P384 },
733+ wantAlg : x509 .ECDSA ,
734+ },
729735 }
730736 for _ , tc := range testCases {
731737 t .Run (tc .name , func (t * testing.T ) {
@@ -764,11 +770,21 @@ func TestServingRotation_NewCertificate_WithKeyPairGenerator(t *testing.T) {
764770 keyGen : nil ,
765771 wantAlg : x509 .RSA ,
766772 },
773+ {
774+ name : "RSA-4096" ,
775+ keyGen : crypto.RSAKeyPairGenerator {Bits : 4096 },
776+ wantAlg : x509 .RSA ,
777+ },
767778 {
768779 name : "ECDSA-P256" ,
769780 keyGen : crypto.ECDSAKeyPairGenerator {Curve : crypto .P256 },
770781 wantAlg : x509 .ECDSA ,
771782 },
783+ {
784+ name : "ECDSA-P384" ,
785+ keyGen : crypto.ECDSAKeyPairGenerator {Curve : crypto .P384 },
786+ wantAlg : x509 .ECDSA ,
787+ },
772788 }
773789 for _ , tc := range testCases {
774790 t .Run (tc .name , func (t * testing.T ) {
@@ -872,20 +888,10 @@ func TestPeerRotation_NewCertificate_WithKeyPairGenerator(t *testing.T) {
872888 }
873889
874890 // Verify both ExtKeyUsages are present
875- hasClientAuth := false
876- hasServerAuth := false
877- for _ , usage := range cert .ExtKeyUsage {
878- if usage == x509 .ExtKeyUsageClientAuth {
879- hasClientAuth = true
880- }
881- if usage == x509 .ExtKeyUsageServerAuth {
882- hasServerAuth = true
883- }
884- }
885- if ! hasClientAuth {
891+ if ! slices .Contains (cert .ExtKeyUsage , x509 .ExtKeyUsageClientAuth ) {
886892 t .Error ("missing ExtKeyUsageClientAuth" )
887893 }
888- if ! hasServerAuth {
894+ if ! slices . Contains ( cert . ExtKeyUsage , x509 . ExtKeyUsageServerAuth ) {
889895 t .Error ("missing ExtKeyUsageServerAuth" )
890896 }
891897
@@ -924,6 +930,16 @@ func TestSignerRotation_NewCertificate_WithKeyPairGenerator(t *testing.T) {
924930 keyGen : nil ,
925931 wantAlg : x509 .RSA ,
926932 },
933+ {
934+ name : "RSA-4096" ,
935+ keyGen : crypto.RSAKeyPairGenerator {Bits : 4096 },
936+ wantAlg : x509 .RSA ,
937+ },
938+ {
939+ name : "ECDSA-P256" ,
940+ keyGen : crypto.ECDSAKeyPairGenerator {Curve : crypto .P256 },
941+ wantAlg : x509 .ECDSA ,
942+ },
927943 {
928944 name : "ECDSA-P384" ,
929945 keyGen : crypto.ECDSAKeyPairGenerator {Curve : crypto .P384 },
0 commit comments