From f03dfd147abd09645b545b27c5ed450eee9c6a17 Mon Sep 17 00:00:00 2001 From: Patrick Cowland Date: Wed, 18 Oct 2023 15:23:44 +0100 Subject: [PATCH 1/4] Add password parameter for encrypted PKCS12 key import --- management/api_certificate_management.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/management/api_certificate_management.go b/management/api_certificate_management.go index a9a2d507..4e5d3c71 100644 --- a/management/api_certificate_management.go +++ b/management/api_certificate_management.go @@ -259,6 +259,7 @@ type ApiCreateKeyRequest struct { contentType *string certificate *Certificate file **[]byte + password *string usageType *string } @@ -277,6 +278,11 @@ func (r ApiCreateKeyRequest) UsageType(usageType string) ApiCreateKeyRequest { return r } +func (r ApiCreateKeyRequest) Password(password string) ApiCreateKeyRequest { + r.password = &password + return r +} + func (r ApiCreateKeyRequest) File(file *[]byte) ApiCreateKeyRequest { r.file = &file return r @@ -381,6 +387,9 @@ func (a *CertificateManagementApiService) internalCreateKeyExecute(r ApiCreateKe if localVarHeaderParams["Content-Type"] == "multipart/form-data" { localVarFormParams.Add("usageType", parameterValueToString(*r.usageType, "")) + if r.password != nil { + localVarFormParams.Add("password", parameterValueToString(*r.password, "")) + } var fileLocalVarFormFileName string var fileLocalVarFileBytes *[]byte From 8a3f0cf1b79645f84a2608f2119caadb03190b66 Mon Sep 17 00:00:00 2001 From: Patrick Cowland Date: Wed, 18 Oct 2023 15:27:58 +0100 Subject: [PATCH 2/4] OA3 generate --- management/.openapi-generator/FILES | 1 + management/api/openapi.yaml | 16 +++++++++- management/docs/Certificate.md | 34 +++++++++++++++++++--- management/generate/pingone-management.yml | 16 +++++++++- 4 files changed, 61 insertions(+), 6 deletions(-) diff --git a/management/.openapi-generator/FILES b/management/.openapi-generator/FILES index e76f92ad..dd20bab0 100644 --- a/management/.openapi-generator/FILES +++ b/management/.openapi-generator/FILES @@ -150,6 +150,7 @@ docs/BrandingThemeConfigurationLogo.md docs/BrandingThemeDefault.md docs/BrandingThemesApi.md docs/CapabilitiesApi.md +docs/Certificate.md docs/CertificateKeyUpdate.md docs/CertificateManagementApi.md docs/CreateApplication201Response.md diff --git a/management/api/openapi.yaml b/management/api/openapi.yaml index 1e8d2465..7a7f92d4 100644 --- a/management/api/openapi.yaml +++ b/management/api/openapi.yaml @@ -5171,7 +5171,7 @@ paths: $ref: '#/components/schemas/Certificate' multipart/form-data: schema: - $ref: '#/components/schemas/PKIFileUpload' + $ref: '#/components/schemas/PKIKeyFileUpload' responses: "400": content: @@ -29282,6 +29282,20 @@ components: - file - usageType type: object + PKIKeyFileUpload: + properties: + usageType: + example: ENCRYPTION + type: string + file: + format: binary + type: string + password: + type: string + required: + - file + - usageType + type: object Population: example: createdAt: createdAt diff --git a/management/docs/Certificate.md b/management/docs/Certificate.md index 26f456f0..f3d69dee 100644 --- a/management/docs/Certificate.md +++ b/management/docs/Certificate.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**Links** | Pointer to [**LinksHATEOAS**](LinksHATEOAS.md) | | [optional] **Algorithm** | [**EnumCertificateKeyAlgorithm**](EnumCertificateKeyAlgorithm.md) | | **CreatedAt** | Pointer to **time.Time** | The time the resource was created. | [optional] [readonly] **Default** | Pointer to **bool** | Specifies whether this is the default key for the specified environment. | [optional] @@ -11,7 +12,7 @@ Name | Type | Description | Notes **ExpiresAt** | Pointer to **time.Time** | The time the key resource expires. | [optional] [readonly] **Id** | Pointer to **string** | Specifies the resource’s unique identifier. | [optional] [readonly] **IssuerDN** | Pointer to **string** | Specifies the distinguished name of the certificate issuer. | [optional] -**KeyLength** | **int32** | Specifies the key length. For RSA keys, options are 2048, 3072, and 7680. For elliptical curve (EC) keys, options are 224, 256, and 384. | +**KeyLength** | **int32** | The key length. For RSA keys, options are `2048`, `3072`, `4096`, and `7680`. For elliptical curve (EC) keys, options are `224`, `256`, `384`, and `521`. | **Name** | **string** | Specifies the resource name. | **Organization** | Pointer to [**ObjectOrganization**](ObjectOrganization.md) | | [optional] **SerialNumber** | Pointer to **big.Int** | Specifies the serial number of the key or certificate. | [optional] @@ -42,6 +43,31 @@ NewCertificateWithDefaults instantiates a new Certificate object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set +### GetLinks + +`func (o *Certificate) GetLinks() LinksHATEOAS` + +GetLinks returns the Links field if non-nil, zero value otherwise. + +### GetLinksOk + +`func (o *Certificate) GetLinksOk() (*LinksHATEOAS, bool)` + +GetLinksOk returns a tuple with the Links field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLinks + +`func (o *Certificate) SetLinks(v LinksHATEOAS)` + +SetLinks sets Links field to given value. + +### HasLinks + +`func (o *Certificate) HasLinks() bool` + +HasLinks returns a boolean if a field has been set. + ### GetAlgorithm `func (o *Certificate) GetAlgorithm() EnumCertificateKeyAlgorithm` @@ -279,20 +305,20 @@ HasOrganization returns a boolean if a field has been set. ### GetSerialNumber -`func (o *Certificate) GetSerialNumber() big.Int` +`func (o *Certificate) GetSerialNumber() int64` GetSerialNumber returns the SerialNumber field if non-nil, zero value otherwise. ### GetSerialNumberOk -`func (o *Certificate) GetSerialNumberOk() (*big.Int, bool)` +`func (o *Certificate) GetSerialNumberOk() (*int64, bool)` GetSerialNumberOk returns a tuple with the SerialNumber field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetSerialNumber -`func (o *Certificate) SetSerialNumber(v big.Int)` +`func (o *Certificate) SetSerialNumber(v int64)` SetSerialNumber sets SerialNumber field to given value. diff --git a/management/generate/pingone-management.yml b/management/generate/pingone-management.yml index d66f8601..b2108044 100644 --- a/management/generate/pingone-management.yml +++ b/management/generate/pingone-management.yml @@ -4272,6 +4272,20 @@ components: required: - file - usageType + PKIKeyFileUpload: + type: object + properties: + usageType: + type: string + example: ENCRYPTION + file: + type: string + format: binary + password: + type: string + required: + - file + - usageType Population: type: object properties: @@ -8997,7 +9011,7 @@ paths: $ref: '#/components/schemas/Certificate' multipart/form-data: schema: - $ref: '#/components/schemas/PKIFileUpload' + $ref: '#/components/schemas/PKIKeyFileUpload' parameters: - name: Content-Type in: header From fdcaaf6dac172a3eef25470cb7636aa421615692 Mon Sep 17 00:00:00 2001 From: Patrick Cowland Date: Wed, 18 Oct 2023 15:28:22 +0100 Subject: [PATCH 3/4] update certificate doc --- management/docs/Certificate.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/management/docs/Certificate.md b/management/docs/Certificate.md index f3d69dee..c77393f1 100644 --- a/management/docs/Certificate.md +++ b/management/docs/Certificate.md @@ -305,20 +305,20 @@ HasOrganization returns a boolean if a field has been set. ### GetSerialNumber -`func (o *Certificate) GetSerialNumber() int64` +`func (o *Certificate) GetSerialNumber() big.Int` GetSerialNumber returns the SerialNumber field if non-nil, zero value otherwise. ### GetSerialNumberOk -`func (o *Certificate) GetSerialNumberOk() (*int64, bool)` +`func (o *Certificate) GetSerialNumberOk() (*big.Int, bool)` GetSerialNumberOk returns a tuple with the SerialNumber field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetSerialNumber -`func (o *Certificate) SetSerialNumber(v int64)` +`func (o *Certificate) SetSerialNumber(v big.Int)` SetSerialNumber sets SerialNumber field to given value. From e610a05795055ce65f216f5c17544fee4f48a411 Mon Sep 17 00:00:00 2001 From: Patrick Cowland Date: Wed, 18 Oct 2023 15:31:05 +0100 Subject: [PATCH 4/4] changelogs --- CHANGELOG.md | 1 + management/CHANGELOG.md | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f3bc3b1..deec76c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * **Enhancement** Added `DisplayName`, `SourceId` and `SourceType` object attributes to the `Group` object model. [#264](https://github.com/patrickcping/pingone-go-sdk-v2/pull/264) * **Enhancement** Added `TlsClientAuthKeyPair` object attributes to the `Subscription` object model. [#265](https://github.com/patrickcping/pingone-go-sdk-v2/pull/265) * **Enhancement** Added `OUTBOUND_MTLS` to the `EnumCertificateKeyUsageType` enum. [#265](https://github.com/patrickcping/pingone-go-sdk-v2/pull/265) + * **Enhancement** Added ability to set a PKCS12 keystore password when building a `CreateKeyRequest`. [#266](https://github.com/patrickcping/pingone-go-sdk-v2/pull/266) # Release (2023-10-16) diff --git a/management/CHANGELOG.md b/management/CHANGELOG.md index 0a0d7bfb..7bb3ace5 100644 --- a/management/CHANGELOG.md +++ b/management/CHANGELOG.md @@ -3,6 +3,7 @@ * **Enhancement** Added `DisplayName`, `SourceId` and `SourceType` object attributes to the `Group` object model. [#264](https://github.com/patrickcping/pingone-go-sdk-v2/pull/264) * **Enhancement** Added `TlsClientAuthKeyPair` object attributes to the `Subscription` object model. [#265](https://github.com/patrickcping/pingone-go-sdk-v2/pull/265) * **Enhancement** Added `OUTBOUND_MTLS` to the `EnumCertificateKeyUsageType` enum. [#265](https://github.com/patrickcping/pingone-go-sdk-v2/pull/265) +* **Enhancement** Added ability to set a PKCS12 keystore password when building a `CreateKeyRequest`. [#266](https://github.com/patrickcping/pingone-go-sdk-v2/pull/266) # v0.30.0 (2023-10-16)