serialize and deserialize priv + keychain