update internal api for the conversion logic

Signed-off-by: Norwin Schnyder <norwin.schnyder+github@gmail.com>
This commit is contained in:
Norwin Schnyder 2023-12-12 19:48:46 +01:00
parent b79e73f484
commit 9185ca3195
8 changed files with 82 additions and 0 deletions

View File

@ -410,8 +410,25 @@ type PKCS12Keystore struct {
// PasswordSecretRef is a reference to a key in a Secret resource
// containing the password used to encrypt the PKCS12 keystore.
PasswordSecretRef cmmeta.SecretKeySelector
// Algorithm is the encryption and MAC algorithms used to create the PKCS12 keystore.
//
// If provided, allowed values are either `RC2-40-CBC:HMAC-SHA-1` or `AES-256-CBC:HMAC-SHA-2`.
// Default value is `RC2-40-CBC:HMAC-SHA-1` for backward compatibility.
// Note: By default, OpenSSL 3 can't decode PKCS#12 files created using `RC2-40-CBC:HMAC-SHA-1`.
Algorithm PKCS12Algorithm
}
type PKCS12Algorithm string
const (
// PBE with RC2 certificate algorithm, PBE with 3DES key algorithm and HMAC-SHA-1 MAC algorithm.
RC2PKCS12Algorithm PKCS12Algorithm = "RC2-40-CBC:HMAC-SHA-1"
// PBES2 with PBKDF2-HMAC-SHA-256 and AES-256-CBC certificate and key algorithm and HMAC-SHA-2 MAC algorithm.
AESPKCS12Algorithm PKCS12Algorithm = "AES-256-CBC:HMAC-SHA-2"
)
// CertificateStatus defines the observed state of Certificate
type CertificateStatus struct {
// List of status conditions to indicate the status of certificates.

View File

@ -1330,6 +1330,7 @@ func autoConvert_v1_PKCS12Keystore_To_certmanager_PKCS12Keystore(in *v1.PKCS12Ke
if err := internalapismetav1.Convert_v1_SecretKeySelector_To_meta_SecretKeySelector(&in.PasswordSecretRef, &out.PasswordSecretRef, s); err != nil {
return err
}
out.Algorithm = certmanager.PKCS12Algorithm(in.Algorithm)
return nil
}
@ -1343,6 +1344,7 @@ func autoConvert_certmanager_PKCS12Keystore_To_v1_PKCS12Keystore(in *certmanager
if err := internalapismetav1.Convert_meta_SecretKeySelector_To_v1_SecretKeySelector(&in.PasswordSecretRef, &out.PasswordSecretRef, s); err != nil {
return err
}
out.Algorithm = v1.PKCS12Algorithm(in.Algorithm)
return nil
}

View File

@ -332,8 +332,27 @@ type PKCS12Keystore struct {
// PasswordSecretRef is a reference to a key in a Secret resource
// containing the password used to encrypt the PKCS12 keystore.
PasswordSecretRef cmmeta.SecretKeySelector `json:"passwordSecretRef"`
// Algorithm is the encryption and MAC algorithms used to create the PKCS12 keystore.
//
// If provided, allowed values are either `RC2-40-CBC:HMAC-SHA-1` or `AES-256-CBC:HMAC-SHA-2`.
// Default value is `RC2-40-CBC:HMAC-SHA-1` for backward compatibility.
// Note: By default, OpenSSL 3 can't decode PKCS#12 files created using `RC2-40-CBC:HMAC-SHA-1`.
// +optional
Algorithm PKCS12Algorithm `json:"algorithm,omitempty"`
}
// +kubebuilder:validation:Enum="RC2-40-CBC:HMAC-SHA-1";"AES-256-CBC:HMAC-SHA-2"
type PKCS12Algorithm string
const (
// PBE with RC2 certificate algorithm, PBE with 3DES key algorithm and HMAC-SHA-1 MAC algorithm.
RC2PKCS12Algorithm PKCS12Algorithm = "RC2-40-CBC:HMAC-SHA-1"
// PBES2 with PBKDF2-HMAC-SHA-256 and AES-256-CBC certificate and key algorithm and HMAC-SHA-2 MAC algorithm.
AESPKCS12Algorithm PKCS12Algorithm = "AES-256-CBC:HMAC-SHA-2"
)
// CertificateStatus defines the observed state of Certificate
type CertificateStatus struct {
// List of status conditions to indicate the status of certificates.

View File

@ -1336,6 +1336,7 @@ func autoConvert_v1alpha2_PKCS12Keystore_To_certmanager_PKCS12Keystore(in *PKCS1
if err := apismetav1.Convert_v1_SecretKeySelector_To_meta_SecretKeySelector(&in.PasswordSecretRef, &out.PasswordSecretRef, s); err != nil {
return err
}
out.Algorithm = certmanager.PKCS12Algorithm(in.Algorithm)
return nil
}
@ -1349,6 +1350,7 @@ func autoConvert_certmanager_PKCS12Keystore_To_v1alpha2_PKCS12Keystore(in *certm
if err := apismetav1.Convert_meta_SecretKeySelector_To_v1_SecretKeySelector(&in.PasswordSecretRef, &out.PasswordSecretRef, s); err != nil {
return err
}
out.Algorithm = PKCS12Algorithm(in.Algorithm)
return nil
}

View File

@ -338,9 +338,28 @@ type PKCS12Keystore struct {
// PasswordSecretRef is a reference to a key in a Secret resource
// containing the password used to encrypt the PKCS12 keystore.
PasswordSecretRef cmmeta.SecretKeySelector `json:"passwordSecretRef"`
// Algorithm is the encryption and MAC algorithms used to create the PKCS12 keystore.
//
// If provided, allowed values are either `RC2-40-CBC:HMAC-SHA-1` or `AES-256-CBC:HMAC-SHA-2`.
// Default value is `RC2-40-CBC:HMAC-SHA-1` for backward compatibility.
// Note: By default, OpenSSL 3 can't decode PKCS#12 files created using `RC2-40-CBC:HMAC-SHA-1`.
// +optional
Algorithm PKCS12Algorithm `json:"algorithm,omitempty"`
}
// +kubebuilder:validation:Enum="RC2-40-CBC:HMAC-SHA-1";"AES-256-CBC:HMAC-SHA-2"
type PKCS12Algorithm string
const (
// PBE with RC2 certificate algorithm, PBE with 3DES key algorithm and HMAC-SHA-1 MAC algorithm.
RC2PKCS12Algorithm PKCS12Algorithm = "RC2-40-CBC:HMAC-SHA-1"
// PBES2 with PBKDF2-HMAC-SHA-256 and AES-256-CBC certificate and key algorithm and HMAC-SHA-2 MAC algorithm.
AESPKCS12Algorithm PKCS12Algorithm = "AES-256-CBC:HMAC-SHA-2"
)
// CertificateStatus defines the observed state of Certificate
type CertificateStatus struct {
// List of status conditions to indicate the status of certificates.

View File

@ -1335,6 +1335,7 @@ func autoConvert_v1alpha3_PKCS12Keystore_To_certmanager_PKCS12Keystore(in *PKCS1
if err := apismetav1.Convert_v1_SecretKeySelector_To_meta_SecretKeySelector(&in.PasswordSecretRef, &out.PasswordSecretRef, s); err != nil {
return err
}
out.Algorithm = certmanager.PKCS12Algorithm(in.Algorithm)
return nil
}
@ -1348,6 +1349,7 @@ func autoConvert_certmanager_PKCS12Keystore_To_v1alpha3_PKCS12Keystore(in *certm
if err := apismetav1.Convert_meta_SecretKeySelector_To_v1_SecretKeySelector(&in.PasswordSecretRef, &out.PasswordSecretRef, s); err != nil {
return err
}
out.Algorithm = PKCS12Algorithm(in.Algorithm)
return nil
}

View File

@ -337,8 +337,27 @@ type PKCS12Keystore struct {
// PasswordSecretRef is a reference to a key in a Secret resource
// containing the password used to encrypt the PKCS12 keystore.
PasswordSecretRef cmmeta.SecretKeySelector `json:"passwordSecretRef"`
// Algorithm is the encryption and MAC algorithms used to create the PKCS12 keystore.
//
// If provided, allowed values are either `RC2-40-CBC:HMAC-SHA-1` or `AES-256-CBC:HMAC-SHA-2`.
// Default value is `RC2-40-CBC:HMAC-SHA-1` for backward compatibility.
// Note: By default, OpenSSL 3 can't decode PKCS#12 files created using `RC2-40-CBC:HMAC-SHA-1`.
// +optional
Algorithm PKCS12Algorithm `json:"algorithm,omitempty"`
}
// +kubebuilder:validation:Enum="RC2-40-CBC:HMAC-SHA-1";"AES-256-CBC:HMAC-SHA-2"
type PKCS12Algorithm string
const (
// PBE with RC2 certificate algorithm, PBE with 3DES key algorithm and HMAC-SHA-1 MAC algorithm.
RC2PKCS12Algorithm PKCS12Algorithm = "RC2-40-CBC:HMAC-SHA-1"
// PBES2 with PBKDF2-HMAC-SHA-256 and AES-256-CBC certificate and key algorithm and HMAC-SHA-2 MAC algorithm.
AESPKCS12Algorithm PKCS12Algorithm = "AES-256-CBC:HMAC-SHA-2"
)
// CertificateStatus defines the observed state of Certificate
type CertificateStatus struct {
// List of status conditions to indicate the status of certificates.

View File

@ -1318,6 +1318,7 @@ func autoConvert_v1beta1_PKCS12Keystore_To_certmanager_PKCS12Keystore(in *PKCS12
if err := apismetav1.Convert_v1_SecretKeySelector_To_meta_SecretKeySelector(&in.PasswordSecretRef, &out.PasswordSecretRef, s); err != nil {
return err
}
out.Algorithm = certmanager.PKCS12Algorithm(in.Algorithm)
return nil
}
@ -1331,6 +1332,7 @@ func autoConvert_certmanager_PKCS12Keystore_To_v1beta1_PKCS12Keystore(in *certma
if err := apismetav1.Convert_meta_SecretKeySelector_To_v1_SecretKeySelector(&in.PasswordSecretRef, &out.PasswordSecretRef, s); err != nil {
return err
}
out.Algorithm = PKCS12Algorithm(in.Algorithm)
return nil
}