refactory prv/pub-key checks
Merge pull request #254 from LipuFei/fix-pkey-checks

refactory prv/pub-key checks