IdentityService.registerKey - corda

corda / net.corda.core.node.services / IdentityService / registerKey

# registerKey

`abstract fun registerKey(publicKey: PublicKey, party: Party, externalId: UUID? = null): Unit`

Registers a mapping in the database between the provided PublicKey and Party if one does not already exist. If an entry exists for the supplied PublicKey but the associated Party does not match the one supplied to the method then a warning will be logged and the operation will not be carried out as a key can only ever be registered to one Party.

This method also optionally adds a mapping from PublicKey to external ID if one is provided. Lastly, the PublicKey is also stored (as well as the PublicKey hash).

### Parameters

`publicKey` - The public publicKey that will be registered to the supplied Party

`party` - The party that the supplied public publicKey will be registered to

`externalId` - The UUID that the supplied public key can be optionally registered to

### Exceptions

`IllegalArgumentException` - if the public publicKey is already registered to a party that does not match the supplied party