Sfoglia il codice sorgente

Ignore unknown character for base64 decoding

Marcin Krzyzanowski 2 anni fa
parent
commit
6fec996043
2 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 1 1
      README.md
  2. 1 1
      Sources/CryptoSwift/Foundation/Array+Foundation.swift

+ 1 - 1
README.md

@@ -564,7 +564,7 @@ let alicesPublicKeyData = try alicesPrivateKey.publicKeyDER()
     
 // Bob receives the raw external representation of Alices public key and imports it
 // Use DER encoded format. Use openssl to convert between PEM and DER formats if needed,
-// eg.: openssl rsa -in <file_with_key> -inform PEM -out <new_der_key_file> -outform DER
+// eg.: `openssl rsa -in <file_with_key> -inform PEM -out <new_der_key_file> -outform DER`
 let bobsImportOfAlicesPublicKey = try RSA(rawRepresentation: Data(alicesPublicKeyData))
     
 // Bob can now encrypt a message for Alice using her public key

+ 1 - 1
Sources/CryptoSwift/Foundation/Array+Foundation.swift

@@ -23,7 +23,7 @@ public extension Array where Element == UInt8 {
   init(base64: String) {
     self.init()
 
-    guard let decodedData = Data(base64Encoded: base64) else {
+    guard let decodedData = Data(base64Encoded: base64, options: .ignoreUnknownCharacters) else {
       return
     }