Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Revert "feat: add kmip client registration with CSR"

Sheencf0a62551c19
diff --git a/backend/src/ee/routes/v1/kmip-router.ts b/backend/src/ee/routes/v1/kmip-router.ts
index 4c1aa55875..78d82a3850 100644
--- a/backend/src/ee/routes/v1/kmip-router.ts
+++ b/backend/src/ee/routes/v1/kmip-router.ts
@@ -287,21 +287,16 @@ export const registerKmipRouter = async (server: FastifyZodProvider) => {
params: z.object({
id: z.string()
}),
- body: z
- .object({
- keyAlgorithm: z.nativeEnum(CertKeyAlgorithm).optional(),
- ttl: z.string().refine((val) => ms(val) > 0, "TTL must be a positive number"),
- csr: z.string().trim().min(1, "CSR cannot be empty").max(4096).optional()
- })
- .refine((data) => data.csr || data.keyAlgorithm, {
- message: "Either csr or keyAlgorithm must be provided"
- }),
+ body: z.object({
+ keyAlgorithm: z.nativeEnum(CertKeyAlgorithm),
+ ttl: z.string().refine((val) => ms(val) > 0, "TTL must be a positive number")
+ }),
response: {
200: z.object({
serialNumber: z.string(),
certificateChain: z.string(),
certificate: z.string(),
- privateKey: z.string().optional()
+ privateKey: z.string()
})
}
},
@@ -326,8 +321,7 @@ export const registerKmipRouter = async (server: FastifyZodProvider) => {
clientId: req.params.id,
serialNumber: certificate.serialNumber,
ttl: req.body.ttl,
- keyAlgorithm: req.body.keyAlgorithm,
- isFromCsr: Boolean(req.body.csr)
+ keyAlgorithm: req.body.keyAlgorithm
}
}
});
diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.ts
index eb0d583bbe..2179d4b357 100644
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@ -5005,9 +5005,8 @@ interface CreateKmipClientCertificateEvent {
metadata: {
clientId: string;
ttl: string;
- keyAlgorithm?: string;
+ keyAlgorithm: string;
serialNumber: string;
- isFromCsr: boolean;
};
}
diff --git a/backend/src/ee/services/kmip/kmip-service.ts b/backend/src/ee/services/kmip/kmip-service.ts
index 58a1d8905c..43a439fe2f 100644
--- a/backend/src/ee/services/kmip/kmip-service.ts
+++ b/backend/src/ee/services/kmip/kmip-service.ts
@@ -11,12 +11,9 @@ import { isFQDN } from "@app/lib/validator/validate-url";
import { constructPemChainFromCerts } from "@app/services/certificate/certificate-fns";
import { CertExtendedKeyUsage, CertKeyAlgorithm, CertKeyUsage } from "@app/services/certificate/certificate-types";
import {
- createDistinguishedName,
createSerialNumber,
- extractDnParts,
keyAlgorithmToAlgCfg
} from "@app/services/certificate-authority/certificate-authority-fns";
-import { extractAlgorithmsFromCSR } from "@app/services/certificate-common/certificate-csr-utils";
import { TKmsServiceFactory } from "@app/services/kms/kms-service";
import { KmsDataKey } from "@app/services/kms/kms-types";
@@ -432,8 +429,7 @@ export const kmipServiceFactory = ({
actorAuthMethod,
ttl,
keyAlgorithm,
- clientId,
- csr
+ clientId
}: TCreateKmipClientCertificateDTO) => {
const kmipClient = await kmipClientDAL.findById(clientId);
@@ -486,6 +482,24 @@ export const kmipServiceFactory = ({
throw new BadRequestError({ message: "notAfter date is after CA certificate's notAfter date" });
}
+ const alg = keyAlgorithmToAlgCfg(keyAlgorithm);
+ const leafKeys = await crypto.nativeCrypto.subtle.generateKey(alg, true, ["sign", "verify"]);
+
+ const extensions: x509.Extension[] = [
+ new x509.BasicConstraintsExtension(false),
+ await x509.AuthorityKeyIdentifierExtension.create(caCertObj, false),
+ await x509.SubjectKeyIdentifierExtension.create(leafKeys.publicKey),
+ new x509.CertificatePolicyExtension(["2.5.29.32.0"]), // anyPolicy
+ new x509.KeyUsagesExtension(
+ // eslint-disable-next-line no-bitwise
+ x509.KeyUsageFlags[CertKeyUsage.DIGITAL_SIGNATURE] |
+ x509.KeyUsageFlags[CertKeyUsage.KEY_ENCIPHERMENT] |
+ x509.KeyUsageFlags[CertKeyUsage.KEY_AGREEMENT],
+ true
+ ),
+ new x509.ExtendedKeyUsageExtension([x509.ExtendedKeyUsage[CertExtendedKeyUsage.CLIENT_AUTH]], true)
+ ];
+
const caAlg = keyAlgorithmToAlgCfg(orgKmipCAs.config.caKeyAlgorithm as CertKeyAlgorithm);
const caSkObj = crypto.nativeCrypto.createPrivateKey({
@@ -503,113 +517,26 @@ export const kmipServiceFactory = ({
);
const serialNumber = createSerialNumber();
- let leafCert: x509.X509Certificate;
- let effectiveKeyAlgorithm: CertKeyAlgorithm;
- let privateKeyPem: string | undefined;
-
- if (csr) {
- // CSR mode - sign the provided CSR
- const csrObj = new x509.Pkcs10CertificateRequest(csr);
-
- // Validate CSR signature
- const isValid = await csrObj.verify();
- if (!isValid) {
- throw new BadRequestError({ message: "Invalid CSR signature" });
- }
-
- // Extract key algorithm from CSR
- const { keyAlgorithm: csrKeyAlgorithm } = extractAlgorithmsFromCSR(csr);
- effectiveKeyAlgorithm = csrKeyAlgorithm;
-
- // Extract additional subject fields from CSR (O, L, ST, C) and build DN with proper escaping
- const dn = extractDnParts(csrObj.subjectName);
- const subject = createDistinguishedName({
- commonName: clientId,
- ou: kmipClient.projectId,
- organization: dn.organization,
- locality: dn.locality,
- province: dn.province,
- country: dn.country
- });
-
- const extensions: x509.Extension[] = [
- new x509.BasicConstraintsExtension(false),
- await x509.AuthorityKeyIdentifierExtension.create(caCertObj, false),
- await x509.SubjectKeyIdentifierExtension.create(csrObj.publicKey),
- new x509.CertificatePolicyExtension(["2.5.29.32.0"]), // anyPolicy
- new x509.KeyUsagesExtension(
- // eslint-disable-next-line no-bitwise
- x509.KeyUsageFlags[CertKeyUsage.DIGITAL_SIGNATURE] |
- x509.KeyUsageFlags[CertKeyUsage.KEY_ENCIPHERMENT] |
- x509.KeyUsageFlags[CertKeyUsage.KEY_AGREEMENT],
- true
- ),
- new x509.ExtendedKeyUsageExtension([x509.ExtendedKeyUsage[CertExtendedKeyUsage.CLIENT_AUTH]], true)
- ];
-
- leafCert = await x509.X509CertificateGenerator.create({
- serialNumber,
- subject,
- issuer: caCertObj.subject,
- notBefore: notBeforeDate,
- notAfter: notAfterDate,
- signingKey: caPrivateKey,
- publicKey: csrObj.publicKey,
- signingAlgorithm: caAlg,
- extensions
- });
- } else {
- // Managed mode - server generates key pair (existing behavior)
- if (!keyAlgorithm) {
- throw new BadRequestError({ message: "keyAlgorithm is required when not providing a CSR" });
- }
- effectiveKeyAlgorithm = keyAlgorithm;
-
- const alg = keyAlgorithmToAlgCfg(keyAlgorithm);
- const leafKeys = await crypto.nativeCrypto.subtle.generateKey(alg, true, ["sign", "verify"]);
-
- const skLeafObj = crypto.nativeCrypto.KeyObject.from(leafKeys.privateKey);
- privateKeyPem = skLeafObj.export({ format: "pem", type: "pkcs8" }) as string;
-
- const subject = createDistinguishedName({
- commonName: clientId,
- ou: kmipClient.projectId
- });
+ const leafCert = await x509.X509CertificateGenerator.create({
+ serialNumber,
+ subject: `OU=${kmipClient.projectId},CN=${clientId}`,
+ issuer: caCertObj.subject,
+ notBefore: notBeforeDate,
+ notAfter: notAfterDate,
+ signingKey: caPrivateKey,
+ publicKey: leafKeys.publicKey,
+ signingAlgorithm: alg,
+ extensions
+ });
- const extensions: x509.Extension[] = [
- new x509.BasicConstraintsExtension(false),
- await x509.AuthorityKeyIdentifierExtension.create(caCertObj, false),
- await x509.SubjectKeyIdentifierExtension.create(leafKeys.publicKey),
- new x509.CertificatePolicyExtension(["2.5.29.32.0"]), // anyPolicy
- new x509.KeyUsagesExtension(
- // eslint-disable-next-line no-bitwise
- x509.KeyUsageFlags[CertKeyUsage.DIGITAL_SIGNATURE] |
- x509.KeyUsageFlags[CertKeyUsage.KEY_ENCIPHERMENT] |
- x509.KeyUsageFlags[CertKeyUsage.KEY_AGREEMENT],
- true
- ),
- new x509.ExtendedKeyUsageExtension([x509.ExtendedKeyUsage[CertExtendedKeyUsage.CLIENT_AUTH]], true)
- ];
-
- leafCert = await x509.X509CertificateGenerator.create({
- serialNumber,
- subject,
- issuer: caCertObj.subject,
- notBefore: notBeforeDate,
- notAfter: notAfterDate,
- signingKey: caPrivateKey,
- publicKey: leafKeys.publicKey,
- signingAlgorithm: alg,
- extensions
- });
- }
+ const skLeafObj = crypto.nativeCrypto.KeyObject.from(leafKeys.privateKey);
const rootCaCert = new x509.X509Certificate(orgKmipCAs.rootCaCertificate);
const serverIntermediateCaCert = new x509.X509Certificate(orgKmipCAs.serverIntermediateCaCertificate);
await kmipClientCertificateDAL.create({
kmipClientId: clientId,
- keyAlgorithm: effectiveKeyAlgorithm,
+ keyAlgorithm,
issuedAt: notBeforeDate,
expiration: notAfterDate,
serialNumber
@@ -617,10 +544,10 @@ export const kmipServiceFactory = ({
return {
serialNumber,
+ privateKey: skLeafObj.export({ format: "pem", type: "pkcs8" }) as string,
certificate: leafCert.toString("pem"),
certificateChain: constructPemChainFromCerts([serverIntermediateCaCert, rootCaCert]),
- projectId: kmipClient.projectId,
- ...(privateKeyPem && { privateKey: privateKeyPem })
+ projectId: kmipClient.projectId
};
};
diff --git a/backend/src/ee/services/kmip/kmip-types.ts b/backend/src/ee/services/kmip/kmip-types.ts
index a2496e54cc..b6ef70a221 100644
--- a/backend/src/ee/services/kmip/kmip-types.ts
+++ b/backend/src/ee/services/kmip/kmip-types.ts
@@ -6,9 +6,8 @@ import { KmipPermission } from "./kmip-enum";
export type TCreateKmipClientCertificateDTO = {
clientId: string;
- keyAlgorithm?: CertKeyAlgorithm;
+ keyAlgorithm: CertKeyAlgorithm;
ttl: string;
- csr?: string;
} & Omit<TProjectPermission, "projectId">;
export type TCreateKmipClientDTO = {
diff --git a/docs/docs.json b/docs/docs.json
index 32c9e51cb4..00cdf252af 100644
--- a/docs/docs.json
+++ b/docs/docs.json
@@ -915,13 +915,7 @@
"documentation/platform/kms/overview",
"documentation/platform/kms/hsm-integration",
"documentation/platform/kms/kubernetes-encryption",
- {
- "group": "KMIP Integration",
- "pages": [
- "documentation/platform/kms/kmip",
- "documentation/platform/kms/kmip-dell-poweredge"
- ]
- },
+ "documentation/platform/kms/kmip",
"documentation/platform/kms/sigstore-cosign"
]
}
diff --git a/docs/documentation/platform/kms/kmip-dell-poweredge.mdx b/docs/documentation/platform/kms/kmip-dell-poweredge.mdx
deleted file mode 100644
index 50e65f2ced..0000000000
--- a/docs/documentation/platform/kms/kmip-dell-poweredge.mdx
+++ /dev/null
@@ -1,64 +0,0 @@
----
-title: "Dell PowerEdge SEKM"
-description: "Integrate Infisical KMIP with Dell PowerEdge servers using Secure Enterprise Key Management (SEKM) for Self-Encrypting Drives."
----
-
-This guide walks you through setting up Secure Enterprise Key Management (SEKM) on Dell PowerEdge servers with iDRAC to encrypt Self-Encrypting Drives (SEDs) using Infisical as your key management server.
-
-## Prerequisites
-
-- Infisical KMIP server deployed and running (see [KMIP Integration](/documentation/platform/kms/kmip))
-- Dell PowerEdge server with iDRAC Enterprise license
-- SEKM license installed on iDRAC
-- Network connectivity between iDRAC and KMIP server on port 5696
-
-## Integration Steps
-
-<Steps>
- <Step title="Create a KMIP Client in Infisical">
- In your KMS project, navigate to **KMIP** and create a KMIP client for the iDRAC.
- </Step>
-
- <Step title="Configure SEKM on iDRAC">
- 1. Log into the iDRAC web interface
- 2. Navigate to **iDRAC Settings > Services**
- 3. Expand **iDRAC Key Management** and select **SEKM**
- 4. Enter the KMIP server address and port (default: 5696)
- 5. Click **Next**
- </Step>
-
- <Step title="Generate Certificate Request on iDRAC">
- When iDRAC prompts you to generate a certificate request, you'll need to enter subject values. You can find the required values in Infisical by clicking **Generate Certificate** on your KMIP client and selecting the **CSR** request method - the modal will display the exact **Client ID** and **Project ID** to use.
-
- 1. Click **Generate CSR** on iDRAC
- 2. Enter the certificate information:
- - **Common Name (CN)**: Enter the **Client ID** shown in Infisical
- - **Organizational Unit (OU)**: Enter the **Project ID** shown in Infisical
- - Fill in other fields as needed (Organization, Country, etc.)
- 3. Click **Generate** and download the certificate request file
- </Step>
-
- <Step title="Sign the Certificate in Infisical">
- 1. In the Infisical modal, paste the certificate request content from iDRAC
- 2. Set the certificate validity period (e.g., "1y" for one year)
- 3. Click **Sign Certificate**
- 4. Download the signed certificate and certificate chain
- </Step>
-
- <Step title="Upload Certificate to iDRAC">
- 1. In iDRAC, upload the signed client certificate
- 2. Upload the certificate chain as the KMS CA certificate
- 3. Click **Test Network Connection** to verify connectivity
- 4. Complete the SEKM configuration
- </Step>
-
- <Step title="Enable Encryption on Storage Controller">
- Once SEKM is configured, you can enable encryption on your storage controller (PERC, HBA, or NVMe) through iDRAC.
- </Step>
-</Steps>
-
-## Troubleshooting
-
-- **Certificate validation fails**: Make sure you used the correct Client ID and Project ID when generating the certificate request on iDRAC.
-- **Connection timeout**: Verify network connectivity and that firewall rules allow traffic on port 5696.
-- **Authentication errors**: Ensure you uploaded both the signed certificate and the certificate chain to iDRAC.
diff --git a/docs/documentation/platform/kms/kmip.mdx b/docs/documentation/platform/kms/kmip.mdx
index ce5f5e1b9e..a6c76a1e52 100644
--- a/docs/documentation/platform/kms/kmip.mdx
+++ b/docs/documentation/platform/kms/kmip.mdx
@@ -1,5 +1,5 @@
---
-title: "Overview"
+title: "KMIP Integration"
description: "Learn more about integrating with Infisical KMS using KMIP (Key Management Interoperability Protocol)."
---
@@ -147,11 +147,19 @@ Follow these steps in order to set up KMIP integration with Infisical:
<Step title="Generate Client Certificate">
Each KMIP client needs its own certificate for mTLS authentication.
- Click **Generate Certificate** for your newly created client. Select the request method:
- - **Managed**: Infisical generates the key pair and certificate for you. Provide the TTL and key algorithm.
- - **CSR**: Provide your own Certificate Signing Request if your device generates keys internally (e.g., Dell iDRAC). See the [Dell PowerEdge SEKM](/documentation/platform/kms/kmip-dell-poweredge) guide for details.
+ Click **Generate Certificate** for your newly created client.
+
+ ![KMIP generate client cert](/images/platform/kms/kmip/kmip-client-generate-cert.png)
+
+ Provide the desired TTL (time-to-live) and key algorithm, then click **Generate Client Certificate**.
+
+ ![KMIP client cert config](/images/platform/kms/kmip/kmip-client-cert-config-modal.png)
+
+ Download the generated client certificate, certificate chain, and private key.
+
+ ![KMIP client cert modal](/images/platform/kms/kmip/kmip-client-certificate-modal.png)
- Download the generated certificate and certificate chain (and private key if using Managed mode). Configure your KMIP-compatible applications or tools to use these credentials when connecting to the KMIP server.
+ Configure your KMIP-compatible applications or tools to use these credentials when connecting to the KMIP server. The client will now authenticate via mTLS and perform authorized key management operations through the KMIP server, which proxies requests to Infisical KMS.
</Step>
</Steps>
diff --git a/docs/images/platform/kms/kmip/kmip-client-cert-config-modal.png b/docs/images/platform/kms/kmip/kmip-client-cert-config-modal.png
new file mode 100644
index 0000000000..45eb8c830b
Binary files /dev/null and b/docs/images/platform/kms/kmip/kmip-client-cert-config-modal.png differ
diff --git a/docs/images/platform/kms/kmip/kmip-client-certificate-modal.png b/docs/images/platform/kms/kmip/kmip-client-certificate-modal.png
new file mode 100644
index 0000000000..d6f9fc2ad8
Binary files /dev/null and b/docs/images/platform/kms/kmip/kmip-client-certificate-modal.png differ
diff --git a/docs/images/platform/kms/kmip/kmip-client-generate-cert.png b/docs/images/platform/kms/kmip/kmip-client-generate-cert.png
new file mode 100644
index 0000000000..40b49f5707
Binary files /dev/null and b/docs/images/platform/kms/kmip/kmip-client-generate-cert.png differ
diff --git a/frontend/src/hooks/api/kmip/types.ts b/frontend/src/hooks/api/kmip/types.ts
index 9cee7942b4..1bdcda85a6 100644
--- a/frontend/src/hooks/api/kmip/types.ts
+++ b/frontend/src/hooks/api/kmip/types.ts
@@ -37,17 +37,16 @@ export type TProjectKmipClientList = {
};
export type TGenerateKmipClientCertificate = {
- keyAlgorithm?: CertKeyAlgorithm;
+ keyAlgorithm: CertKeyAlgorithm;
ttl: string;
clientId: string;
- csr?: string;
};
export type KmipClientCertificate = {
serialNumber: string;
certificate: string;
certificateChain: string;
- privateKey?: string;
+ privateKey: string;
};
export type TDeleteKmipClient = KeyRef & ProjectRef;
diff --git a/frontend/src/pages/kms/KmipPage/components/CreateKmipClientCertificateModal.tsx b/frontend/src/pages/kms/KmipPage/components/CreateKmipClientCertificateModal.tsx
index 91523757fc..6821773662 100644
--- a/frontend/src/pages/kms/KmipPage/components/CreateKmipClientCertificateModal.tsx
+++ b/frontend/src/pages/kms/KmipPage/components/CreateKmipClientCertificateModal.tsx
@@ -1,6 +1,4 @@
import { Controller, useForm } from "react-hook-form";
-import { faCopy, faInfoCircle, faQuestionCircle } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod";
@@ -8,43 +6,23 @@ import { createNotification } from "@app/components/notifications";
import {
Button,
FormControl,
- FormLabel,
- IconButton,
Input,
Modal,
ModalClose,
ModalContent,
Select,
- SelectItem,
- TextArea,
- Tooltip
+ SelectItem
} from "@app/components/v2";
import { certKeyAlgorithms, isPqcAlgorithm } from "@app/hooks/api/certificates/constants";
import { CertKeyAlgorithm } from "@app/hooks/api/certificates/enums";
import { useGenerateKmipClientCertificate } from "@app/hooks/api/kmip";
import { KmipClientCertificate, TKmipClient } from "@app/hooks/api/kmip/types";
-enum RequestMethod {
- MANAGED = "managed",
- CSR = "csr"
-}
-
-const baseSchema = z.object({
- ttl: z.string().min(1, "TTL is required")
-});
-
-const csrSchema = baseSchema.extend({
- requestMethod: z.literal(RequestMethod.CSR),
- csr: z.string().min(1, "CSR is required")
-});
-
-const managedSchema = baseSchema.extend({
- requestMethod: z.literal(RequestMethod.MANAGED),
- keyAlgorithm: z.nativeEnum(CertKeyAlgorithm)
+const formSchema = z.object({
+ keyAlgorithm: z.nativeEnum(CertKeyAlgorithm),
+ ttl: z.string()
});
-const formSchema = z.discriminatedUnion("requestMethod", [csrSchema, managedSchema]);
-
export type FormData = z.infer<typeof formSchema>;
type Props = {
@@ -68,223 +46,69 @@ const KmipClientCertificateForm = ({
const {
control,
handleSubmit,
- watch,
formState: { isSubmitting }
} = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: {
- requestMethod: RequestMethod.MANAGED,
- keyAlgorithm: CertKeyAlgorithm.RSA_2048,
- ttl: ""
- }
+ resolver: zodResolver(formSchema)
});
- const requestMethod = watch("requestMethod");
-
const handleKmipClientSubmit = async (payload: FormData) => {
if (!kmipClient) {
return;
}
- try {
- const certificate = await createKmipClientCertificate({
- ttl: payload.ttl,
- clientId: kmipClient.id,
- ...(payload.requestMethod === RequestMethod.CSR
- ? { csr: payload.csr }
- : { keyAlgorithm: payload.keyAlgorithm })
- });
-
- createNotification({
- text: `Successfully ${payload.requestMethod === RequestMethod.CSR ? "signed" : "generated"} KMIP client certificate`,
- type: "success"
- });
-
- displayNewClientCertificate(certificate);
- onComplete();
- } catch (error) {
- createNotification({
- text: `Failed to create certificate: ${(error as Error)?.message || "Unknown error"}`,
- type: "error"
- });
- }
- };
+ const certificate = await createKmipClientCertificate({
+ ...payload,
+ clientId: kmipClient?.id
+ });
- const handleCopyToClipboard = (text: string, label: string) => {
- navigator.clipboard.writeText(text);
createNotification({
- text: `${label} copied to clipboard`,
+ text: "Successfully created KMIP client certificate",
type: "success"
});
+
+ displayNewClientCertificate(certificate);
+ onComplete();
};
return (
<form onSubmit={handleSubmit(handleKmipClientSubmit)}>
<Controller
control={control}
- name="requestMethod"
- render={({ field: { onChange, value } }) => (
+ name="ttl"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl label="TTL" isError={Boolean(error)} errorText={error?.message} isRequired>
+ <Input {...field} placeholder="2 days, 1d, 2h, 1y, ..." />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ name="keyAlgorithm"
+ defaultValue={CertKeyAlgorithm.RSA_2048}
+ render={({ field: { onChange, ...field }, fieldState: { error } }) => (
<FormControl
- label={
- <FormLabel
- label="Request Method"
- icon={
- <Tooltip
- content={
- <div className="space-y-2">
- <p>
- <strong>Managed:</strong> Infisical generates and manages the private key
- for you.
- </p>
- <p>
- <strong>CSR:</strong> Provide your own Certificate Signing Request. Use
- this when your device (e.g., Dell iDRAC) generates its own private key.
- </p>
- </div>
- }
- >
- <FontAwesomeIcon icon={faQuestionCircle} size="sm" />
- </Tooltip>
- }
- />
- }
+ label="Key Algorithm"
+ errorText={error?.message}
+ isError={Boolean(error)}
+ helperText="This defines the key algorithm to use for signing the client certificate."
>
<Select
- value={value}
- onValueChange={(val) => onChange(val as RequestMethod)}
+ defaultValue={field.value}
+ {...field}
+ onValueChange={(e) => onChange(e)}
className="w-full"
>
- <SelectItem value={RequestMethod.MANAGED}>Managed</SelectItem>
- <SelectItem value={RequestMethod.CSR}>Certificate Signing Request (CSR)</SelectItem>
+ {certKeyAlgorithms
+ .filter(({ value }) => !isPqcAlgorithm(value))
+ .map(({ label, value }) => (
+ <SelectItem value={String(value || "")} key={label}>
+ {label}
+ </SelectItem>
+ ))}
</Select>
</FormControl>
)}
/>
-
- <Controller
- control={control}
- name="ttl"
- render={({ field, fieldState: { error } }) => (
- <FormControl label="TTL" isError={Boolean(error)} errorText={error?.message} isRequired>
- <Input {...field} placeholder="2 days, 1d, 2h, 1y, ..." />
- </FormControl>
- )}
- />
-
- {requestMethod === RequestMethod.MANAGED && (
- <Controller
- control={control}
- name="keyAlgorithm"
- defaultValue={CertKeyAlgorithm.RSA_2048}
- render={({ field: { onChange, ...field }, fieldState: { error } }) => (
- <FormControl
- label="Key Algorithm"
- errorText={error?.message}
- isError={Boolean(error)}
- helperText="This defines the key algorithm to use for signing the client certificate."
- >
- <Select
- defaultValue={field.value}
- {...field}
- onValueChange={(e) => onChange(e)}
- className="w-full"
- >
- {certKeyAlgorithms
- .filter(({ value }) => !isPqcAlgorithm(value))
- .map(({ label, value }) => (
- <SelectItem value={String(value || "")} key={label}>
- {label}
- </SelectItem>
- ))}
- </Select>
- </FormControl>
- )}
- />
- )}
-
- {requestMethod === RequestMethod.CSR && (
- <>
- <Controller
- control={control}
- name="csr"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Certificate Signing Request (CSR)"
- isRequired
- errorText={error?.message}
- isError={Boolean(error)}
- >
- <TextArea
- {...field}
- spellCheck={false}
- placeholder={
- "-----BEGIN CERTIFICATE REQUEST-----\n" +
- "MIIByDCCAU4CAQAwfjELMAkGA1UEBhMCVVMx...\n" +
- "-----END CERTIFICATE REQUEST-----"
- }
- rows={8}
- className="w-full font-mono text-xs"
- />
- </FormControl>
- )}
- />
-
- {kmipClient && (
- <div className="mt-4 rounded-md border border-mineshaft-600 bg-mineshaft-700 p-4">
- <div className="mb-3 flex items-center text-sm font-medium text-mineshaft-200">
- <FontAwesomeIcon icon={faInfoCircle} className="mr-2" />
- Certificate Subject Values
- </div>
- <p className="mb-3 text-xs text-mineshaft-300">
- The signed certificate will use these fixed values for CN and OU. If your device
- requires you to specify subject values when generating the CSR, use the values
- below.
- </p>
- <div className="space-y-2">
- <div className="flex items-center justify-between rounded bg-mineshaft-600 px-3 py-2">
- <div>
- <div className="text-xs text-mineshaft-400">
- CN (Common Name) = KMIP Client ID
- </div>
- <div className="font-mono text-sm text-mineshaft-100">{kmipClient.id}</div>
- </div>
- <IconButton
- ariaLabel="Copy Client ID"
- variant="plain"
- size="sm"
- onClick={() => handleCopyToClipboard(kmipClient.id, "Client ID")}
- >
- <FontAwesomeIcon icon={faCopy} />
- </IconButton>
- </div>
- <div className="flex items-center justify-between rounded bg-mineshaft-600 px-3 py-2">
- <div>
- <div className="text-xs text-mineshaft-400">
- OU (Organizational Unit) = Project ID
- </div>
- <div className="font-mono text-sm text-mineshaft-100">
- {kmipClient.projectId}
- </div>
- </div>
- <IconButton
- ariaLabel="Copy Project ID"
- variant="plain"
- size="sm"
- onClick={() => handleCopyToClipboard(kmipClient.projectId, "Project ID")}
- >
- <FontAwesomeIcon icon={faCopy} />
- </IconButton>
- </div>
- </div>
- <p className="mt-3 text-xs text-mineshaft-400">
- Note: Any O (Organization), L (Locality), ST (State), or C (Country) values in your
- CSR will be included in the certificate.
- </p>
- </div>
- )}
- </>
- )}
-
<div className="mt-8 flex items-center">
<Button
className="mr-4"
@@ -293,7 +117,7 @@ const KmipClientCertificateForm = ({
isLoading={isSubmitting}
isDisabled={isSubmitting}
>
- {requestMethod === RequestMethod.CSR ? "Sign Certificate" : "Generate Certificate"}
+ Generate Client Certificate
</Button>
<ModalClose asChild>
<Button colorSchema="secondary" variant="plain">
@@ -313,7 +137,7 @@ export const CreateKmipClientCertificateModal = ({
}: Props) => {
return (
<Modal isOpen={isOpen} onOpenChange={onOpenChange}>
- <ModalContent title="KMIP client certificate">
+ <ModalContent title="Generate KMIP client certificate">
<KmipClientCertificateForm
onComplete={() => onOpenChange(false)}
displayNewClientCertificate={displayNewClientCertificate}