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(
|
return Output(
|
||||||
initial: Driver.just((
|
initial: Driver.just((
|
||||||
algorithmList: [Algorithm.aes128, Algorithm.aes192, Algorithm.aes256],
|
algorithmList: [Algorithm.aes128, Algorithm.aes192, Algorithm.aes256],
|
||||||
modeList: ["CBC", "ECB", "GCM"],
|
modeList: ["CBC", "ECB", /* "GCM" */], // GCM 还没准备好示例代码,暂时禁用
|
||||||
paddingList: ["pkcs7"],
|
paddingList: ["pkcs7"],
|
||||||
initialFields: dependencies.settingFieldRelay.value
|
initialFields: dependencies.settingFieldRelay.value
|
||||||
)),
|
)),
|
||||||
|
|||||||
@ -67,13 +67,10 @@ struct AESCryptoModel {
|
|||||||
|
|
||||||
var iv = ""
|
var iv = ""
|
||||||
if ["CBC", "GCM"].contains(cryptoFields.mode) {
|
if ["CBC", "GCM"].contains(cryptoFields.mode) {
|
||||||
var expectIVLength = 0
|
let expectIVLength = [
|
||||||
if cryptoFields.mode == "CBC" {
|
"CBC": 16,
|
||||||
expectIVLength = 16
|
"GCM": 12
|
||||||
}
|
][cryptoFields.mode] ?? 0
|
||||||
else if cryptoFields.mode == "GCM" {
|
|
||||||
expectIVLength = 12
|
|
||||||
}
|
|
||||||
|
|
||||||
if let ivField = cryptoFields.iv, ivField.count == expectIVLength {
|
if let ivField = cryptoFields.iv, ivField.count == expectIVLength {
|
||||||
iv = ivField
|
iv = ivField
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user