فهرست منبع

Make .detached default mode for GCM since combined is still broken

Marcin Krzyzanowski 7 سال پیش
والد
کامیت
31fc98c31f
1فایلهای تغییر یافته به همراه4 افزوده شده و 4 حذف شده
  1. 4 4
      Sources/CryptoSwift/BlockMode/GCM.swift

+ 4 - 4
Sources/CryptoSwift/BlockMode/GCM.swift

@@ -20,10 +20,10 @@
 
 public final class GCM: BlockMode {
     public enum Mode {
+        /// Some applications may need to store the authentication tag and the encrypted message at different locations.
+        case detached
         /// In combined mode, the authentication tag is directly appended to the encrypted message. This is usually what you want.
         case combined
-        /// Some applications may need to store the authentication tag and the encrypted message at different locations
-        case detached
     }
 
     public let options: BlockModeOptions = [.initializationVectorRequired, .useEncryptToDecrypt]
@@ -45,14 +45,14 @@ public final class GCM: BlockMode {
     public var authenticationTag: Array<UInt8>?
 
     // encrypt
-    public init(iv: Array<UInt8>, additionalAuthenticatedData: Array<UInt8>? = nil, mode: Mode = .combined) {
+    public init(iv: Array<UInt8>, additionalAuthenticatedData: Array<UInt8>? = nil, mode: Mode = .detached) {
         self.iv = iv
         self.additionalAuthenticatedData = additionalAuthenticatedData
         self.mode = mode
     }
 
     // decrypt
-    public convenience init(iv: Array<UInt8>, authenticationTag: Array<UInt8>, additionalAuthenticatedData: Array<UInt8>? = nil, mode: Mode = .combined) {
+    public convenience init(iv: Array<UInt8>, authenticationTag: Array<UInt8>, additionalAuthenticatedData: Array<UInt8>? = nil, mode: Mode = .detached) {
         self.init(iv: iv, additionalAuthenticatedData: additionalAuthenticatedData, mode: mode)
         self.authenticationTag = authenticationTag
     }