mirror of
https://github.com/Finb/Bark.git
synced 2025-12-08 21:36:01 +00:00
GCM 还没准备好示例代码,暂时禁用
This commit is contained in:
parent
ab61dda125
commit
116d8cf970
@ -135,7 +135,7 @@ class CryptoSettingViewModel: ViewModel, ViewModelType {
|
||||
return Output(
|
||||
initial: Driver.just((
|
||||
algorithmList: [Algorithm.aes128, Algorithm.aes192, Algorithm.aes256],
|
||||
modeList: ["CBC", "ECB", "GCM"],
|
||||
modeList: ["CBC", "ECB", /* "GCM" */], // GCM 还没准备好示例代码,暂时禁用
|
||||
paddingList: ["pkcs7"],
|
||||
initialFields: dependencies.settingFieldRelay.value
|
||||
)),
|
||||
|
||||
@ -67,13 +67,10 @@ struct AESCryptoModel {
|
||||
|
||||
var iv = ""
|
||||
if ["CBC", "GCM"].contains(cryptoFields.mode) {
|
||||
var expectIVLength = 0
|
||||
if cryptoFields.mode == "CBC" {
|
||||
expectIVLength = 16
|
||||
}
|
||||
else if cryptoFields.mode == "GCM" {
|
||||
expectIVLength = 12
|
||||
}
|
||||
let expectIVLength = [
|
||||
"CBC": 16,
|
||||
"GCM": 12
|
||||
][cryptoFields.mode] ?? 0
|
||||
|
||||
if let ivField = cryptoFields.iv, ivField.count == expectIVLength {
|
||||
iv = ivField
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user