Skip to content

Latest commit

History

35 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

dkimcrypt

import "gitlab.one.com/go/dkimcrypt"

Package dkimcrypt provides convenient functions for en- or decrypting, as well as signing and verifying data using a combination of local private key files and public keys present in DKIM DNS TXT records

crypt_decrypt.goprivkey.gopubkey.gosign_verify.go

funcDecrypt(selector, privkeypathstring, in, key, mac []byte) (out []byte, errerror)

Decrypt will decrypt the data in 'in' and return it in 'out', given the path to a PEM-encoded private key file, an RSA-encrypted key, a message authentication code hash, and a selector, which must be the same used for encryption

funcDecryptSingle(selector, privkeypathstring, in []byte) (out []byte, errerror)

DecryptSingle is a wrapper around Decrypt, which will decrypt a byte slice encrypted by EncryptSingle

funcEncrypt(selector, domainstring, in []byte) (out, key, mac []byte, errerror)

Encrypt will AES-encrypt the data given in 'in', and return the encrypted version in 'out', as well as a key, which is RSA-encrypted using the public key it finds in the DKIM-like TXT record at [selector]._domainkey.[domain], and a message authentication code hash. Use the same selector in 'Decrypt'

funcEncryptSingle(selector, domainstring, in []byte) (out []byte, errerror)

EncryptSingle is a wrapper around Encrypt, which will encrypt a byte slice and return a single byte slice representing a key, a verification hash and the ecrypted data, useful for sending over a network. Decrypt using DecryptSingle

funcGetPrivateKey(filenamestring) (*rsa.PrivateKey, error)

GetPrivateKey loads a private key from the given filename and returns it.

funcGetPublicKey(selector, domainstring) (*rsa.PublicKey, error)

GetPublicKey will look up a public key for a domain with selector, and return it. If no key is found, an error is returned.

funcSign(message []byte, privkeypathstring) (out []byte, errerror)

Sign will return the signature of the message in 'message' using the private key in the file at 'privkeypath'.

funcVerify(message, signature []byte, selector, domainstring) (errerror)

Verify a signature given the signature, the message it signed and the selector and domain that signed it. If err is nil, then the signature is good.


Generated by godoc2md

About

dkimcrypt provides convenient functions for en- or decrypting, as well as signing and verifying data using a combination of local private key files and public keys present in DKIM DNS TXT records

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages