I think we need do Base64 for each name in the key, and use as delimiter a char which doesn't exist in base64 output charset. In this case, you should not expect that for any valid input key the output will be invalid. So, when you fail on a key, you are 100% sure that it is invalid key. And valid data doesn't exist, which could break your key.