Skip to content

A 100% native C# implementation of TweetNaCl for .NET

License

Notifications You must be signed in to change notification settings

drr00t/tweetnacl-cs

Repository files navigation

#TweetNaCl-cs

Branch Build Code Cover
master .Net Build status
Mono Build Status
Coveralls Coverage Status

About Project

A C# port of original TweetNaCl C language implementation version 20140427.

⚠️ The library is not stable yet and API will change and was not independently reviewed. If you can help reviewing it, please [contact me](mailto:adribeiro (at) gmail.com).

##Documentation

Public-key authenticated encryption (box)

Implements curve25519-xsalsa20-poly1305.

Byte[] CryptoBoxKeypair(Byte[] secretKey)

The CryptoBoxKeypair function randomly generates a secretKey and a corresponding public key. The secretKey array must have size equal to crypto_box_SECRETKEYBYTES

Byte[] CryptoBox(Byte[] message, Byte[] nonce, Byte[] publicKey, Byte[] secretKey)

The function encrypts and authenticates a message using the nonce, receiver´s publicKey and sender´s secretKey.

Byte[] CryptoBoxOpen(Byte[] cipheredMessage, Byte[] nonce, Byte[] publicKey, Byte[] secretKey)

The function verifies and decrypts a cipherMessage using the receiver's secretKey, the sender's publicKey, and a nonce.

Byte[] CryptoBoxBeforenm(Byte[] publicKey, Byte[] secretKey)

Applications that send several messages to the same receiver can gain speed by splitting CryptoBox into two steps, CryptoBoxBeforenm and CryptoBoxAfternm.

Byte[] CryptoBoxAfternm(Byte[] message, Byte[] nonce, Byte[] k)

Byte[] CryptoBoxOpenAfternm(Byte[] cipheredMessage, Byte[] nonce, Byte[] k)

Byte[] CryptoSignKeypair(Byte[] secretKey)

Byte[] CryptoSign(Byte[] message, Byte[] secretKey)

Byte[] CryptoSignOpen(Byte[] signedMessage, Byte[] publicKey)

Byte[] CryptoScalarmult(Byte[] n, Byte[] p)

Scalar multiplication is a curve25519 implementation.

Byte[] CryptoScalarmultBase(Byte[] n)

The CryptoScalarmultBase function computes the scalar product of a standard group element and an integer n

##Third-party libraries

##Who is using

##License This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.