Updated to follow the new API.
Fixed a cert in metadata handling problem
Added a test where the public key is in the metadata