Add support for setting an optional last name in profiles.

This commit is contained in:
Alex Hart
2019-12-20 16:12:22 -04:00
committed by Greyson Parrelli
parent f2b9bf0b8c
commit 3907ec8b51
57 changed files with 1641 additions and 1847 deletions

View File

@@ -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;

View File

@@ -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 {