This because you need to encode the keys before saving them to a text file. What is returned by the SetRandomKeyPair contains non printable characters that are lost when using them as string.
You can use our Encoding library to accomplish that. Or you can use the BinaryToHex and HexToBinary methods from the Signer VB sample to accomplish the same. Remember to undo the encoding when your ready to use the keys again!