INNER CODE UNIT · Swift

open

jedisct1/swift-sodium · Sources/Sodium/Box.swift:344

    func open(authenticatedCipherText: Bytes, beforenm: Beforenm, nonce: Nonce) -> Bytes? {
        guard nonce.count == NonceBytes,
              authenticatedCipherText.count >= MacBytes,
              beforenm.count == BeforenmBytes
        else { return nil }

        var message = Bytes(count: authenticatedCipherText.count - MacBytes)

        guard crypto_box_open_easy_afternm(
            &message,
            authenticatedCipherText, UInt64(authenticatedCipherText.count),
            nonce,
            beforenm
        ).exitCode == .SUCCESS else { return nil }

        return message
    }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…