/* * Copyright (c) 2010 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #include #include #include #include namespace Swift { AuthChallengeSerializer::AuthChallengeSerializer() { } SafeByteArray AuthChallengeSerializer::serialize(boost::shared_ptr element) const { boost::shared_ptr authChallenge(boost::dynamic_pointer_cast(element)); std::string value; boost::optional > message = authChallenge->getValue(); if (message) { if ((*message).empty()) { value = "="; } else { value = Base64::encode(ByteArray(*message)); } } return createSafeByteArray("" + value + ""); } }