Skip to content

Commit 73c2f16

Browse files
committed
v2.0.6(126)
fix bug login Filen.io with non-ASCII password
1 parent 3eb174d commit 73c2f16

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

CryptCloudViewer/CryptCloudViewer.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@
325325
CLANG_ENABLE_MODULES = YES;
326326
CODE_SIGN_ENTITLEMENTS = CryptCloudViewer/CryptCloudViewer.entitlements;
327327
CODE_SIGN_STYLE = Automatic;
328-
CURRENT_PROJECT_VERSION = 124;
328+
CURRENT_PROJECT_VERSION = 126;
329329
DEAD_CODE_STRIPPING = YES;
330330
DEVELOPMENT_TEAM = 7A9X38B4YU;
331331
ENABLE_APP_SANDBOX = YES;
@@ -354,7 +354,7 @@
354354
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
355355
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
356356
MACOSX_DEPLOYMENT_TARGET = 26.0;
357-
MARKETING_VERSION = 2.0.5;
357+
MARKETING_VERSION = 2.0.6;
358358
PRODUCT_BUNDLE_IDENTIFIER = info.lithium03.ccViewer;
359359
PRODUCT_NAME = "$(TARGET_NAME)";
360360
REGISTER_APP_GROUPS = YES;
@@ -384,7 +384,7 @@
384384
CLANG_ENABLE_MODULES = YES;
385385
CODE_SIGN_ENTITLEMENTS = CryptCloudViewer/CryptCloudViewer.entitlements;
386386
CODE_SIGN_STYLE = Automatic;
387-
CURRENT_PROJECT_VERSION = 124;
387+
CURRENT_PROJECT_VERSION = 126;
388388
DEAD_CODE_STRIPPING = YES;
389389
DEVELOPMENT_TEAM = 7A9X38B4YU;
390390
ENABLE_APP_SANDBOX = YES;
@@ -413,7 +413,7 @@
413413
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
414414
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
415415
MACOSX_DEPLOYMENT_TARGET = 26.0;
416-
MARKETING_VERSION = 2.0.5;
416+
MARKETING_VERSION = 2.0.6;
417417
PRODUCT_BUNDLE_IDENTIFIER = info.lithium03.ccViewer;
418418
PRODUCT_NAME = "$(TARGET_NAME)";
419419
REGISTER_APP_GROUPS = YES;

RemoteCloud/RemoteCloud/Storages/FilenStorage.swift

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -205,21 +205,24 @@ public class FilenStorage: NetworkStorage, URLSessionDataDelegate {
205205
}
206206

207207
func pbkdf2(password: String, salt: Data, iterations: UInt32) -> Data {
208+
let passwordUtf8 = password.data(using: .utf8)!
208209
let saltBuffer = [UInt8](salt)
209210
let hashedLen = Int(CC_SHA512_DIGEST_LENGTH)
210211
var hashed = Data(count: hashedLen)
211212

212213
let result = hashed.withUnsafeMutableBytes { (body: UnsafeMutableRawBufferPointer) -> Int32 in
213-
if let baseAddress = body.baseAddress, body.count > 0 {
214-
let data = baseAddress.assumingMemoryBound(to: UInt8.self)
215-
return CCKeyDerivationPBKDF(CCPBKDFAlgorithm(kCCPBKDF2),
216-
password, password.count,
217-
saltBuffer, saltBuffer.count,
218-
CCPseudoRandomAlgorithm(kCCPRFHmacAlgSHA512),
219-
iterations,
220-
data, hashedLen)
214+
return passwordUtf8.withUnsafeBytes { pass in
215+
if let baseAddress = body.baseAddress, body.count > 0 {
216+
let data = baseAddress.assumingMemoryBound(to: UInt8.self)
217+
return CCKeyDerivationPBKDF(CCPBKDFAlgorithm(kCCPBKDF2),
218+
pass.baseAddress!, passwordUtf8.count,
219+
saltBuffer, saltBuffer.count,
220+
CCPseudoRandomAlgorithm(kCCPRFHmacAlgSHA512),
221+
iterations,
222+
data, hashedLen)
223+
}
224+
return Int32(kCCMemoryFailure)
221225
}
222-
return Int32(kCCMemoryFailure)
223226
}
224227

225228
guard result == kCCSuccess else { fatalError("pbkdf2 error") }

0 commit comments

Comments
 (0)