Signal-Android/src/org/thoughtcrime/securesms/mms/TextTransport.java

47 lines
1.4 KiB
Java
Raw Normal View History

2011-12-20 10:20:44 -08:00
/**
* Copyright (C) 2011 Whisper Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.thoughtcrime.securesms.mms;
import java.io.IOException;
import org.whispersystems.textsecure.crypto.TransportDetails;
2013-07-09 19:48:33 -07:00
import org.whispersystems.textsecure.util.Base64;
2011-12-20 10:20:44 -08:00
public class TextTransport implements TransportDetails {
@Override
public byte[] getDecodedMessage(byte[] encodedMessageBytes) throws IOException {
2011-12-20 10:20:44 -08:00
return Base64.decode(encodedMessageBytes);
}
@Override
public byte[] getEncodedMessage(byte[] messageWithMac) {
2011-12-20 10:20:44 -08:00
return Base64.encodeBytes(messageWithMac).getBytes();
}
@Override
2011-12-20 10:20:44 -08:00
public byte[] getPaddedMessageBody(byte[] messageBody) {
return messageBody;
}
@Override
public byte[] getStrippedPaddingMessageBody(byte[] messageWithPadding) {
2011-12-20 10:20:44 -08:00
return messageWithPadding;
}
}