tuweni / org.apache.tuweni.net.tls / TLS / createSelfSignedCertificateIfMissing

createSelfSignedCertificateIfMissing

static fun createSelfSignedCertificateIfMissing(key: Path!, certificate: Path!): Boolean (source)

Create a self-signed certificate, if it is not already present.

If both the key or the certificate file are missing, they will be re-created as a self-signed certificate.

Parameters

key - Path!: The key path.

certificate - Path!: The certificate path.

Exceptions

IOException - If an IO error occurs creating the certificate.

Return
Boolean: true if a self-signed certificate was created.

static fun createSelfSignedCertificateIfMissing(key: Path!, certificate: Path!, commonName: String!): Boolean (source)

Create a self-signed certificate, if it is not already present.

If both the key or the certificate file are missing, they will be re-created as a self-signed certificate.

Parameters

key - Path!: The key path.

certificate - Path!: The certificate path.

commonName - String!: the name to use for the CN attribute of the certificate. If null or empty, a random value is used.

Exceptions

IOException - If an IO error occurs creating the certificate.

Return
Boolean: true if a self-signed certificate was created.