findBestJweProcessorAndMerge

Looks up the existing BaseJweProcessor for the algorithm and key ID in key's identifier, then merges key with that existing processor.

When the existing processor is also an EncryptionKey, the merge is performed at the key level, producing an EncryptionKey.EncryptionKeyPair. Otherwise the generic processor combining mechanism is used.

Return

a BaseJweProcessor incorporating the new key, merged with any previously registered key

Parameters

key

the encryption key whose algorithm and key ID are used to locate an existing processor

Throws

if an encryption key of the same type is already registered for the same algorithm and key ID