Skip to content

Commit

Permalink
Remove newlines from base64 encoded credential
Browse files Browse the repository at this point in the history
Summary: Some base64 implementations add a new line for compatibility reasons, follys base 64 decode barfs if you do this, so just remove it ourselves

Reviewed By: knekritz

Differential Revision: D61044045

fbshipit-source-id: d8ff3eb5fb885406df32c89cea1c478a30b98dce
  • Loading branch information
Ajanthan Asogamoorthy authored and facebook-github-bot committed Aug 12, 2024
1 parent 94778cb commit d4cd807
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fizz/extensions/delegatedcred/Serialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,11 @@ std::unique_ptr<SelfDelegatedCredential> loadDCFromPEM(
}
folly::Optional<DelegatedCredential> cred;
try {
auto credData = folly::base64Decode(combinedPemData.substr(
auto data = combinedPemData.substr(
credDataPtr + dcHeader.size(),
credDataEndPtr - credDataPtr - dcHeader.size() - 1));

credDataEndPtr - credDataPtr - dcHeader.size() - 1);
data.erase(remove_if(data.begin(), data.end(), ::isspace), data.end());
auto credData = folly::base64Decode(data);
std::vector<Extension> credVec;
credVec.emplace_back(Extension{
ExtensionType::delegated_credential,
Expand Down

0 comments on commit d4cd807

Please sign in to comment.