{"id":22747217,"url":"https://github.com/one-com/dkimcrypt","last_synced_at":"2025-10-12T09:37:28.961Z","repository":{"id":57602945,"uuid":"94886536","full_name":"One-com/dkimcrypt","owner":"One-com","description":"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","archived":false,"fork":false,"pushed_at":"2017-06-20T12:00:44.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":3,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-09-11T22:35:03.555Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/One-com.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-20T11:59:46.000Z","updated_at":"2017-06-20T12:00:47.000Z","dependencies_parsed_at":"2022-09-12T21:41:10.876Z","dependency_job_id":null,"html_url":"https://github.com/One-com/dkimcrypt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/One-com/dkimcrypt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/One-com%2Fdkimcrypt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/One-com%2Fdkimcrypt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/One-com%2Fdkimcrypt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/One-com%2Fdkimcrypt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/One-com","download_url":"https://codeload.github.com/One-com/dkimcrypt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/One-com%2Fdkimcrypt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010938,"owners_count":26084837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-11T03:13:44.794Z","updated_at":"2025-10-12T09:37:28.946Z","avatar_url":"https://github.com/One-com.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n# dkimcrypt\n`import \"gitlab.one.com/go/dkimcrypt\"`\n\n* [Overview](#pkg-overview)\n* [Index](#pkg-index)\n* [Subdirectories](#pkg-subdirectories)\n\n## \u003ca name=\"pkg-overview\"\u003eOverview\u003c/a\u003e\nPackage dkimcrypt provides convenient functions for en- or decrypting, as\nwell as signing and verifying data using a combination of local private key\nfiles and public keys present in DKIM DNS TXT records\n\n\n\n\n## \u003ca name=\"pkg-index\"\u003eIndex\u003c/a\u003e\n* [func Decrypt(selector, privkeypath string, in, key, mac []byte) (out []byte, err error)](#Decrypt)\n* [func DecryptSingle(selector, privkeypath string, in []byte) (out []byte, err error)](#DecryptSingle)\n* [func Encrypt(selector, domain string, in []byte) (out, key, mac []byte, err error)](#Encrypt)\n* [func EncryptSingle(selector, domain string, in []byte) (out []byte, err error)](#EncryptSingle)\n* [func GetPrivateKey(filename string) (*rsa.PrivateKey, error)](#GetPrivateKey)\n* [func GetPublicKey(selector, domain string) (*rsa.PublicKey, error)](#GetPublicKey)\n* [func Sign(message []byte, privkeypath string) (out []byte, err error)](#Sign)\n* [func Verify(message, signature []byte, selector, domain string) (err error)](#Verify)\n\n\n#### \u003ca name=\"pkg-files\"\u003ePackage files\u003c/a\u003e\n[crypt_decrypt.go](/src/dkimcrypt/crypt_decrypt.go) [privkey.go](/src/dkimcrypt/privkey.go) [pubkey.go](/src/dkimcrypt/pubkey.go) [sign_verify.go](/src/dkimcrypt/sign_verify.go) \n\n\n## \u003ca name=\"Decrypt\"\u003efunc\u003c/a\u003e [Decrypt](/../blob/master/crypt_decrypt.go?s=3094:3181#L116)\n``` go\nfunc Decrypt(selector, privkeypath string, in, key, mac []byte) (out []byte, err error)\n```\nDecrypt will decrypt the data in 'in' and return it in 'out', given the path to a PEM-encoded\nprivate key file, an RSA-encrypted key, a message authentication code hash,\nand a selector, which must be the same used for encryption\n\n\n\n## \u003ca name=\"DecryptSingle\"\u003efunc\u003c/a\u003e [DecryptSingle](/../blob/master/crypt_decrypt.go?s=2074:2157#L87)\n``` go\nfunc DecryptSingle(selector, privkeypath string, in []byte) (out []byte, err error)\n```\nDecryptSingle is a wrapper around Decrypt, which will decrypt a byte slice\nencrypted by EncryptSingle\n\n\n\n## \u003ca name=\"Encrypt\"\u003efunc\u003c/a\u003e [Encrypt](/../blob/master/crypt_decrypt.go?s=3911:3993#L145)\n``` go\nfunc Encrypt(selector, domain string, in []byte) (out, key, mac []byte, err error)\n```\nEncrypt will AES-encrypt the data given in 'in', and return the encrypted\nversion in 'out', as well as a key, which is RSA-encrypted using the public\nkey it finds in the DKIM-like TXT record at [selector]._domainkey.[domain],\nand a message authentication code hash.  Use the same selector in 'Decrypt'\n\n\n\n## \u003ca name=\"EncryptSingle\"\u003efunc\u003c/a\u003e [EncryptSingle](/../blob/master/crypt_decrypt.go?s=2596:2674#L102)\n``` go\nfunc EncryptSingle(selector, domain string, in []byte) (out []byte, err error)\n```\nEncryptSingle is a wrapper around Encrypt, which will encrypt a byte slice\nand return a single byte slice representing a key, a verification hash and\nthe ecrypted data, useful for sending over a network. Decrypt using\nDecryptSingle\n\n\n\n## \u003ca name=\"GetPrivateKey\"\u003efunc\u003c/a\u003e [GetPrivateKey](/../blob/master/privkey.go?s=1166:1226#L38)\n``` go\nfunc GetPrivateKey(filename string) (*rsa.PrivateKey, error)\n```\nGetPrivateKey loads a private key from the given filename and returns it.\n\n\n\n## \u003ca name=\"GetPublicKey\"\u003efunc\u003c/a\u003e [GetPublicKey](/../blob/master/pubkey.go?s=3642:3708#L137)\n``` go\nfunc GetPublicKey(selector, domain string) (*rsa.PublicKey, error)\n```\nGetPublicKey will look up a public key for a domain with selector, and\nreturn it. If no key is found, an error is returned.\n\n\n\n## \u003ca name=\"Sign\"\u003efunc\u003c/a\u003e [Sign](/../blob/master/sign_verify.go?s=207:276#L3)\n``` go\nfunc Sign(message []byte, privkeypath string) (out []byte, err error)\n```\nSign will return the signature of the message in 'message' using the private\nkey in the file at 'privkeypath'.\n\n\n\n## \u003ca name=\"Verify\"\u003efunc\u003c/a\u003e [Verify](/../blob/master/sign_verify.go?s=836:911#L31)\n``` go\nfunc Verify(message, signature []byte, selector, domain string) (err error)\n```\nVerify a signature given the signature, the message it signed and the\nselector and domain that signed it. If err is nil, then the signature is\ngood.\n\n\n\n\n\n\n\n\n- - -\nGenerated by [godoc2md](http://godoc.org/github.com/davecheney/godoc2md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fone-com%2Fdkimcrypt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fone-com%2Fdkimcrypt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fone-com%2Fdkimcrypt/lists"}