All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cryptography.Cryptography.kt Maven / Gradle / Ivy

package nl.sanderdijkhuis.noise.cryptography

import nl.sanderdijkhuis.noise.data.Data

/** Provide the specified algorithm implementations. */
interface Cryptography {

    /** X25519 from [RFC 7748](https://www.rfc-editor.org/rfc/rfc7748) */
    fun agree(privateKey: PrivateKey, publicKey: PublicKey): SharedSecret

    /** ChaCha20-Poly1305 encryption from [RFC 8439](https://www.rfc-editor.org/rfc/rfc8439.html) */
    fun encrypt(key: CipherKey, nonce: Nonce, associatedData: AssociatedData, plaintext: Plaintext): Ciphertext

    /** ChaCha20-Poly1305 decryption from [RFC 8439](https://www.rfc-editor.org/rfc/rfc8439.html) */
    fun decrypt(key: CipherKey, nonce: Nonce, associatedData: AssociatedData, ciphertext: Ciphertext): Plaintext?

    /** SHA-256 from [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf) */
    fun hash(data: Data): Digest
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy