bakery: more intelligent prefix handling for PublicKeyRing

The previous string-prefix-based handling was seriously flawed.

ah, i should say "scheme" here