corda / / IdentityService / 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).


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


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