Reshuffle docs on NetworkRegistrationHelper (#1429)

Reshuffle docs on NetworkRegistrationHelper, and in particular note that it can cause the whole
process to exit.
This commit is contained in:
Ross Nicoll 2017-09-06 09:25:45 +01:00 committed by GitHub
parent 579abda044
commit fe17d26bb0

View File

@ -19,11 +19,8 @@ import java.security.cert.Certificate
import kotlin.system.exitProcess
/**
* This checks the config.certificatesDirectory field for certificates required to connect to a Corda network.
* If the certificates are not found, a [org.bouncycastle.pkcs.PKCS10CertificationRequest] will be submitted to
* Corda network permissioning server using [NetworkRegistrationService]. This process will enter a polling loop until
* the request has been approved, and then the certificate chain will be downloaded and stored in [KeyStore] reside in
* the certificates directory.
* Helper for managing the node registration process, which checks for any existing certificates and requests them if
* needed.
*/
class NetworkRegistrationHelper(val config: NodeConfiguration, val certService: NetworkRegistrationService) {
companion object {
@ -36,6 +33,17 @@ class NetworkRegistrationHelper(val config: NodeConfiguration, val certService:
// TODO: Use different password for private key.
private val privateKeyPassword = config.keyStorePassword
/**
* Ensure the initial keystore for a node is set up; note that this function may cause the process to exit under
* some circumstances.
*
* This checks the "config.certificatesDirectory" field for certificates required to connect to a Corda network.
* If the certificates are not found, a PKCS #10 certification request will be submitted to the
* Corda network permissioning server via [NetworkRegistrationService]. This process will enter a polling loop until
* the request has been approved, and then the certificate chain will be downloaded and stored in [KeyStore] reside in
* the certificates directory.
*/
// TODO: Stop killing the calling process from within a called function.
fun buildKeystore() {
validateX500Name(config.myLegalName)
config.certificatesDirectory.createDirectories()