KeyManagementService.freshKeyAndCert - corda

corda / net.corda.core.node.services / KeyManagementService / freshKeyAndCert

# freshKeyAndCert

`@Suspendable abstract fun freshKeyAndCert(identity: PartyAndCertificate, revocationEnabled: Boolean): PartyAndCertificate`

Generates a new random KeyPair, adds it to the internal key storage, then generates a corresponding X509Certificate and adds it to the identity service. Associates the public key to an external ID. Returns the public part of the pair.

### Parameters

`identity` - identity to generate a key and certificate for. Must be an identity this node has CA privileges for.

`revocationEnabled` - whether to check revocation status of certificates in the certificate path.

Return
X.509 certificate and path to the trust root.

`@Suspendable abstract fun freshKeyAndCert(identity: PartyAndCertificate, revocationEnabled: Boolean, externalId: UUID): PartyAndCertificate`

Generates a new random KeyPair, adds it to the internal key storage, then generates a corresponding X509Certificate and adds it to the identity service.

### Parameters

`identity` - identity to generate a key and certificate for. Must be an identity this node has CA privileges for.

`revocationEnabled` - whether to check revocation status of certificates in the certificate path.

`externalId` - ID to associate the newly created PublicKey with.

Return
X.509 certificate and path to the trust root.