diff options
author | Kelly Washington <kelly@lindenlab.com> | 2007-03-05 22:25:49 +0000 |
---|---|---|
committer | Kelly Washington <kelly@lindenlab.com> | 2007-03-05 22:25:49 +0000 |
commit | 26029868758949697c2cf7c4a21a88eea3c2a7d5 (patch) | |
tree | 1861c3ccf96e16184941a78f58d4952ebecb6d5a /indra/llmessage | |
parent | 1d18eb043ab71998bded6931e181e53cbb9bf386 (diff) |
merge -r58599:58732 branches/im-email-base32 to release
Diffstat (limited to 'indra/llmessage')
-rw-r--r-- | indra/llmessage/llmail.cpp | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/indra/llmessage/llmail.cpp b/indra/llmessage/llmail.cpp index 1e0eb7fe3a..dd878e1679 100644 --- a/indra/llmessage/llmail.cpp +++ b/indra/llmessage/llmail.cpp @@ -25,7 +25,7 @@ #include "apr-1/apr_network_io.h" #include "llapr.h" -#include "llbase64.h" // IM-to-email address +#include "llbase32.h" // IM-to-email address #include "llblowfishcipher.h" #include "llerror.h" #include "llhost.h" @@ -326,30 +326,10 @@ std::string LLMail::encryptIMEmailAddress(const LLUUID& from_agent_id, U8* encrypted = new U8[encrypted_size]; cipher.encrypt(&data[0], data_size, encrypted, encrypted_size); - // Base64 encoded and replace the pieces of base64 that are less compatible - // with e-mail local-parts. - // See RFC-4648 "Base 64 Encoding with URL and Filename Safe Alphabet" - std::string address = LLBase64::encode(encrypted, encrypted_size); - LLString::replaceChar(address, '+', '-'); - LLString::replaceChar(address, '/', '_'); + std::string address = LLBase32::encode(encrypted, encrypted_size); - // Strip padding = signs, see RFC - size_t extra_bytes = encrypted_size % 3; - size_t padding_size = 0; - if (extra_bytes == 0) - { - padding_size = 0; - } - else if (extra_bytes == 1) - { - padding_size = 2; - } - else if (extra_bytes == 2) - { - padding_size = 1; - } - - address.resize(address.size() - padding_size); + // Make it more pretty for humans. + LLString::toLower(address); delete [] encrypted; |