overexchange
overexchange

Reputation: 1

How to store certificates in MongoDB

Below is the collection, where each document suppose to store certificate and public key in document:

[
   {
      "name" : "cluster-1-in-gcp",
      "kubernetes-version": "1.16",
      "server": "https://192.168.10.190:6443",
      "user": "kubernetes-admin-1",
      "client-certificate": "sadfhdsjfkhsdjfklhsdjfkassdfsd",
      "client-key": "sahgjkshfgjkdf"      
   },
   {
      "name" : "cluster-1-in-aws",
      "kubernetes-version": "1.17",
      "server": "https://192.168.11.191:6443",
      "user": "kubernetes-admin-2",
      "client-certificate": "ssssshdsjfkhsdjfklhsdjfkassdfsd",
      "client-key": "pppppsahgjkshfgjkdf"
   },
   {
      "name" : "cluster-1-in-aks",
      "kubernetes-version": "1.18",
      "server": "https://192.168.11.192:6443",
      "user": "kubernetes-admin-3",
      "client-certificate": "oooossssshdsjfkhsdjfklhsdjfkassdfsd",
      "client-key": "tttttpppppsahgjkshfgjkdf"      
   },
]

What should be the schema of document?

Upvotes: 0

Views: 634

Answers (1)

John Hanley
John Hanley

Reputation: 81424

What are the format of the certificate and private keys?

If they are PEM, then store them as strings.

If they are DER, then store them as binary data (binData).

Upvotes: 1

Related Questions