|
|
|
@ -68,7 +68,7 @@ const NSUInteger kSqliteHeaderLength = 32;
|
|
|
|
|
BOOL isUnencrypted = [unencryptedHeaderData
|
|
|
|
|
isEqualToData:[headerData subdataWithRange:NSMakeRange(0, unencryptedHeaderData.length)]];
|
|
|
|
|
if (isUnencrypted) {
|
|
|
|
|
DDLogVerbose(@"%@ Skipping database conversion; legacy database header already decrypted.", self.logTag);
|
|
|
|
|
DDLogVerbose(@"%@ doesDatabaseNeedToBeConverted; legacy database header already decrypted.", self.logTag);
|
|
|
|
|
return NO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -115,6 +115,8 @@ const NSUInteger kSqliteHeaderLength = 32;
|
|
|
|
|
OWSAssert(databasePassword.length > 0);
|
|
|
|
|
OWSAssert(saltBlock);
|
|
|
|
|
|
|
|
|
|
DDLogVerbose(@"%@ databasePassword: %@", self.logTag, databasePassword.hexadecimalString);
|
|
|
|
|
|
|
|
|
|
NSData *sqlCipherSaltData;
|
|
|
|
|
{
|
|
|
|
|
NSData *headerData = [self readFirstNBytesOfDatabaseFile:databaseFilePath byteCount:kSqliteHeaderLength];
|
|
|
|
@ -307,7 +309,8 @@ const NSUInteger kSqliteHeaderLength = 32;
|
|
|
|
|
|
|
|
|
|
const unsigned char *valueBytes = sqlite3_column_text(statement, 0);
|
|
|
|
|
int valueLength = sqlite3_column_bytes(statement, 0);
|
|
|
|
|
DDLogVerbose(@"%@ value: %d %d", self.logTag, valueLength, valueBytes != NULL);
|
|
|
|
|
OWSAssert(valueLength == kSqliteHeaderLength);
|
|
|
|
|
OWSAssert(valueBytes != NULL);
|
|
|
|
|
|
|
|
|
|
NSString *saltString =
|
|
|
|
|
[[NSString alloc] initWithBytes:valueBytes length:valueLength encoding:NSUTF8StringEncoding];
|
|
|
|
|