Correctly serialize pubkeys for imported keys.