🔑 Batteries-Included High-Level API for Application Programmers

If you have ever tried to implement basic cryptographic operations and yet you are a developer rather than a cryptography professional, things can become overwhelming very quickly. What algorithm(s) to use, what is safe enough, what is not safe, which implementation, padding, what type of key, encoding, and how many bits should the key size be? Rings a bell?

Having encountered these questions repeatedly, we decided to distill a high-level library with the most common cryptographic operations used ubiquitously today. We pursued creating a developer-friendly implementation like what pyca/cryptography offers in the python ecosystem, following best practices and recommendations from a wide array of literature. Enter schmuio/cryptography:

Key points:

Symmetric Encryption:

package yourpackage  import (
    "github.com/schmuio/cryptography"
)

yourKey, err := cryptography.Key256b()
// handle potential error ...

ciphertext, err := cryptography.EncryptAesGcm("some-important-plaintext", yourKey)
// handle potential error ...

plaintext, err := cryptography.DecryptAesGcm(ciphertext, yourKey)
// handle potential error ...

Asymmetric Encryption:

package yourpackage

import (
    "github.com/schmuio/cryptography"
)

privateKey, publicKey, err := cryptography.RsaKeyPairPem()
// handle potential error ...

ciphertext, err := cryptography.EncryptRsa("some-important-plaintext", publicKey)
// handle potential error ...

plaintext, err := cryptography.DecryptRsa(ciphertext, privateKey)
// handle potential error ...

Digital Signatures:

package yourpackage

import (
    "github.com/schmuio/cryptography"
)
privateKey, publicKey, err := cryptography.RsaKeyPairPem()
// handle potential error ...

signature, err := cryptography.SignRsaPss("some-very-important-message", privateKeyPem)
// handle potential error ...

err = cryptography.VerifyEcdsa("some-very-important-message", signature, publicKey)
// handle potential error ...

Thank you for reading. If you have found this useful, please give us a star on GitHub, request a feature, or share a recommendation.