Fix bug #340
(refs #340)Add public key validation