Managed certificate
Generating a managed certificate
- Typescript
- Python
- Java
- PHP
- Golang
import {
KeyClient,
KeyType,
ManagedCertificateParams,
SubjectCertificateParams,
} from '@bloock/sdk';
const keyClient = new KeyClient();
// Load a managed key
const _certificate = await keyClient.newManagedCertificate(
new ManagedCertificateParams(
KeyType.Rsa2048,
new SubjectCertificateParams('Bloock'),
2
)
);
from bloock.client.key import KeyClient
from bloock.entity.key.key_type import KeyType
from bloock.entity.key.managed_certificate_params import ManagedCertificateParams
from bloock.entity.key.subject_certificate_params import SubjectCertificateParams
if __name__ == "__main__":
key_client = KeyClient()
key_type = KeyType.Rsa2048
subject_params = SubjectCertificateParams(
"Common name",
"Organization",
"Organization Unit",
"Location",
"State",
"US"
)
params = ManagedCertificateParams(key_type, subject_params, 5)
managed_certificate = key_client.new_managed_certificate(params)
import com.bloock.sdk.client.KeyClient;
import com.bloock.sdk.entity.key.*;
public class NewManagedCertificate {
public static void main(String[] args) throws Exception {
KeyClient keyClient = new KeyClient();
// Load a managed key
ManagedCertificate key = keyClient.newManagedCertificate(new ManagedCertificateParams(
KeyType.Rsa2048,
new SubjectCertificateParams(
"BLOOCK",
"Organization",
"Organization Unit",
"Location",
"State",
"Country"),
12));
}
}
<?php
require "./vendor/autoload.php";
use Bloock\Client\KeyClient;
use Bloock\Entity\Key\KeyType;
use Bloock\Entity\Key\SubjectCertificateParams;
use Bloock\Entity\Key\ManagedCertificateParams;
$keyClient = new KeyClient();
$key = $keyClient->newManagedCertificate(new ManagedCertificateParams(KeyType::Rsa2048, new SubjectCertificateParams("Bloock"), 2));
package main
import (
"github.com/bloock/bloock-sdk-go/v2/client"
"github.com/bloock/bloock-sdk-go/v2/entity/key"
)
func main() {
keyClient := client.NewKeyClient()
_, _ = keyClient.NewManagedCertificate(key.ManagedCertificateParams{
KeyType: key.Rsa2048,
Subject: key.SubjectCertificateParams{
CommonName: "BLOOCK",
},
ExpirationMonths: 12,
})
}
Loading an existing managed certificate
- Typescript
- Python
- Java
- PHP
- Golang
import { KeyClient } from '@bloock/sdk';
const keyClient = new KeyClient();
// Load a managed certificate
const _certificate = await keyClient.loadManagedCertificate('certificate id');
from bloock.client.key import KeyClient
if __name__ == "__main__":
key_client = KeyClient()
local_certificate = key_client.load_managed_certificate("certificate id")
import com.bloock.sdk.client.KeyClient;
import com.bloock.sdk.entity.key.ManagedCertificate;
public class LoadManagedCertificate {
public static void main(String[] args) throws Exception {
KeyClient keyClient = new KeyClient();
// Load a managed certificate
ManagedCertificate key = keyClient.loadManagedCertificate("certificate id");
}
}
<?php
require "./vendor/autoload.php";
use Bloock\Client\KeyClient;
$keyClient = new KeyClient();
$local_certificate = $keyClient->loadManagedCertificate("certificate id");
package main
import "github.com/bloock/bloock-sdk-go/v2/client"
func main() {
keyClient := client.NewKeyClient()
// Load a managed key
_, _ = keyClient.LoadManagedCertificate("key id")
}