mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-15 20:42:00 +00:00
Add support for setting an optional last name in profiles.
This commit is contained in:
committed by
Greyson Parrelli
parent
f2b9bf0b8c
commit
3907ec8b51
@@ -19,7 +19,7 @@ import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
public class ProfileCipher {
|
||||
|
||||
public static final int NAME_PADDED_LENGTH = 26;
|
||||
public static final int NAME_PADDED_LENGTH = 53;
|
||||
|
||||
private final byte[] key;
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@ public class ProfileCipherTest extends TestCase {
|
||||
public void testEncryptDecrypt() throws InvalidCiphertextException {
|
||||
byte[] key = Util.getSecretBytes(32);
|
||||
ProfileCipher cipher = new ProfileCipher(key);
|
||||
byte[] name = cipher.encryptName("Clement Duval".getBytes(), 26);
|
||||
byte[] name = cipher.encryptName("Clement\0Duval".getBytes(), ProfileCipher.NAME_PADDED_LENGTH);
|
||||
byte[] plaintext = cipher.decryptName(name);
|
||||
assertEquals(new String(plaintext), "Clement Duval");
|
||||
assertEquals(new String(plaintext), "Clement\0Duval");
|
||||
}
|
||||
|
||||
public void testEmpty() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user