net.corda.core.node.services

## Interface KeyManagementService

- All Known Implementing Classes:
    E2ETestKeyManagementService, PersistentKeyManagementService

      public KeyManagementService

  The KMS is responsible for storing and using private keys to sign things. An implementation of this may, for example, call out to a hardware security module that enforces various auditing and frequency-of-use requirements.

  The current interface is obviously not usable for those use cases: this is just where we'd put a real signing interface if/when one is developed.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `KeyManagementService.DefaultImpls` The KMS is responsible for storing and using private keys to sign things. An implementation of this may, for example, call out to a hardware security module that enforces various auditing and frequency-of-use requirements.

  - ### Method Summary

    All Methods Instance Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.security.KeyPair` | `freshKey()` Generates a new random key and adds it to the exposed map.
    `java.util.Map<java.security.PublicKey,java.security.PrivateKey>` | `getKeys()` Returns a snapshot of the current pubkey->privkey mapping.
    `java.security.KeyPair` | `toKeyPair(java.security.PublicKey publicKey)`
    `java.security.KeyPair` | `toKeyPair(java.lang.Iterable<? extends java.security.PublicKey> publicKeys)` Returns the first KeyPair matching any of the publicKeys
    `java.security.PrivateKey` | `toPrivate(java.security.PublicKey publicKey)`

- - ### Method Detail

    - #### getKeys

          java.util.Map<java.security.PublicKey,java.security.PrivateKey> getKeys()

      Returns a snapshot of the current pubkey->privkey mapping.

    - #### toPrivate

          java.security.PrivateKey toPrivate(java.security.PublicKey publicKey)

    - #### toKeyPair

          java.security.KeyPair toKeyPair(java.security.PublicKey publicKey)

    - #### toKeyPair

          java.security.KeyPair toKeyPair(java.lang.Iterable<? extends java.security.PublicKey> publicKeys)

      Returns the first KeyPair matching any of the publicKeys

      See Also:
        KeyPair

    - #### freshKey

          java.security.KeyPair freshKey()

      Generates a new random key and adds it to the exposed map.