Search code examples
keystorecorda

How do you create a new keystore in Corda?


As per the title, in Corda, how do you create a new keystore as referenced here - https://docs.corda.net/permissioning.html


Solution

  • Take a look at the class X509KeyStore

    Passing a password into the constructor will create an empty keystore for you.

    Alternatively, the function fromFile in the same class can be used to create a keystore if one doesn't already exist.

    The test class X509NameConstraintsTest is a good place to see this in action along with the "Test save to keystore" test within CompositeKeyTests.kt.