Implement encoding for wrapped keys.