{"id":15395524,"url":"https://github.com/stef/cr3","last_synced_at":"2026-01-07T16:03:00.419Z","repository":{"id":27746536,"uuid":"31234449","full_name":"stef/cr3","owner":"stef","description":"simple pipe using crazy/crappy crypto for encryption and signing","archived":false,"fork":false,"pushed_at":"2015-03-05T00:56:42.000Z","size":396,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-02T02:11:12.641Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stef.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-23T22:55:58.000Z","updated_at":"2023-09-08T16:54:58.000Z","dependencies_parsed_at":"2022-08-20T11:40:51.710Z","dependency_job_id":null,"html_url":"https://github.com/stef/cr3","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stef%2Fcr3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stef%2Fcr3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stef%2Fcr3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stef%2Fcr3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stef","download_url":"https://codeload.github.com/stef/cr3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245944062,"owners_count":20697948,"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","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-10-01T15:28:41.383Z","updated_at":"2026-01-07T16:02:55.385Z","avatar_url":"https://github.com/stef.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"cr^3 - crazy-crappy-crypto\n\nimplements two simple pipes using:\n - rsa and keccak-based spongewrap authenticated encryption\n - highly experimental post-quantum signatures based on keccak and\n   sphincs256\n\n(C) 2015 by stf, \u003cs@ctrlc.hu\u003e, GPLv3\n\nwhy crazy-crappy-crypto? it's crazy because it uses unsanctioned,\nexperimental and unconventional crypto implementations, some of which\nare so fresh, that it's not even a month that the paper has last been\nedited on which some of this is based. None of these tools should not\nfind wide adoption within at least the next 5-10 years. The selection\nof the algorithms is conservative in the way, that besides fresh algos\nthe rest is selected either on maturity or has at least been\nconsidered in a crypto contest in the final round. Crappy is the way\nsome of this is implemented, the crypto algorithms are simply ripped\nout from other projects, like the supercop benchmarking\nsuite. Although some have been verified to provide the expected test\nvectors, otherwise not much effort has been done to verify the\nresistance against various attacks on any of these implementations. so\nanyone to use this crap must be crazy, hence the name.\n\nWARNING - these tools should only be used by people who want to break\nthese tools and publish their results. Any damages, liabilites, etc\nare waived. DO NOT use these for anything else but breaking them. It is\ncrazy and irresponsible to use these tools for anything serious. You\nhave been warned.\n\nCOD - the authenticated encrypted asymmetric pipe.\n\nuseful at least in the following use-case: you have some receiving\ndevice on which plaintext data arrives, which you want to encrypt\nbefore it is forwarded in a hostile environment to the final recipient\nholding a private key in a safe location. In this one-way setting the\nrecipient is never talking to the host doing the encryption. The main\nthreat this tool counters is the seizure of the data after reception\non the receiving device until safe delivery to the final destination.\nCombine it in-depth with other defenses.\n\nExample: take photos in a hostile environment, encrypt the the photos\nand be unable to recover them until arrival in the save location with\nthe the private key. (note, this does not protect against forensic\nattacks against the storage device - maybe copying the encrypted and\ndestroying the original device with plaintext residue is the only and\nexpensive way)\n\ncrypto: a random 32 byte message key is encrypted with the public\nkey of the recipient in oaep padded RSA, then this message key is\nfed into SpongeWrap, which is then used to authenticated encrypt the\nmessage.\n\noutput format:\n   2 bytes - the length of the RSA encrypted message key in network\n             byte order\n   n  bytes - the RSA encrypted message key\n   m  bytes - the encrypted message (usually as big as your RSA key)\n   16 bytes - the \"MAC\"\n\nmessage overhead is 530 bytes with a 4096 RSA key.\n\nInstall\ndepends: openssl seccomp\n\n`make install`\n\nIf you don't want to support encrypted private keys, set\n\n`make install WITHOUT_PASSWORDS=y`\n\nif you do not have/want seccomp-based sandboxing:\n\n`make install WITHOUT_SECCOMP=y`\n\ncreate keys using openssl:\n$ openssl genrsa -out my.key 4096\n$ openssl rsa -in my.key -pubout \u003e\u003e my.pub\n\ndeploy my.pub on the encrypting host, secure my.key in a safe\nlocation for decryption.\n\ntest with: `make test` or something similar:\n\n$ for i in {0..42} {8170..8210} 1000000; do\n      echo -ne \"\\r$i   \"\n      dd if=/dev/zero bs=$i count=1 2\u003e/dev/null |\n           ./cod e my.pub |\n           ./cod d my.key \u003e/dev/null ||\n           break\n  done\n\nor test with:\n\n$ ./cod e mx.pub \u003ccod.c | ./cod d mx.key | md5sum; md5sum cod.c\n\nif the secret key is encrypted, then supply the password as value in\nthe COD_PASSWORD environment variable to the decrypt operation:\n\n$ ./cod e mx.pub \u003ccod.c | \\\n      COD_PASSWORD=\"mysecretpassword\" ./cod d mx.key | \\\n      md5sum; md5sum cod.c\n\nif you supply a password, you should make sure that 1/ you have no\nshell history or 2/ you have it well protected.\n\n-------------------------------------------------------------------------\n\nsphincs - post-quantum signature pipe\n\nWARNING: this is very experimental and unsanctioned stuff, don't use\nit for anything non-nefarious.\n\nuseful in any crypto graphic siging-scenario where 41kB signatures are\nacceptable.\n\nExample: the source code of cr3 is signed with sphincs.\nyou can verify it by running:\n\n$ cat cr3-${cr3version}.txz cr3-${cr3version}.txz.sig | sphincs v c3maint.pub \u003e/dev/null\n\nyou can find the c3maint.pub key in this source archive, and you can\nget the signature for v0.3.1 from:\n   https://www.ctrlc.hu/~stef/cr3-0.3.1.tar.gz.sig\n\ntry it like this:\n\n$ { curl -Lqs 'https://github.com/stef/cr3/archive/v0.3.1.tar.gz' |\n        tee cr3-0.3.1.tar.gz # save a copy of the archive\n    curl -qs 'https://www.ctrlc.hu/~stef/cr3-0.3.1.tar.gz.sig' } |\n    ./sphincs v ./c3maint.pub \u003e/dev/null ||\n        rm cr3-0.3.1.tar.gz # remove archive if signature fails\n\nCrypto: the incoming message is hashed with keccak512 and this hash sum\nis signed with sphincs256.\n\nOutput format: the pipe copies the incoming stream verbatim to\nstandard output with the sphincs256 signature appended. The signature\nsize is currently: 41000 bytes.\n\nInstall\ndepends: seccomp\n\n`make install`\n\nif you do not have/want seccomp-based sandboxing:\n\n`make install WITHOUT_SECCOMP=y`\n\ncreate keys:\n$ ./sphincs g /tmp/mykey\n\npublish /tmp/mykey.pub among your verifiers, secure /tmp/mykey.key in\na safe location for signing.\n\ntest with: `make test` or something similar:\n\n$ echo 'It works' | ./sphincs s /tmp/mykey.pub | ./sphincs v /tmp/mykey.key\n\n---------------------------------------------------------------------------\n\nSandboxing\n\nThese tools all come with seccomp-based sandboxes, although they have\nnot been exposed to many systems, so it might happen that the sandbox\nkills your process. In this case recompile the tools using\n\n    $ make WITHOUT_SECCOMP=y\n\nrun them with uninteresting data through:\n\n    $ strace -fo /tmp/misbehavingsandbox \u003ccommand....\u003e\n\nand 1/ fix it yourself and send a patch, or 2/ send me the file\n/tmp/misbehavingsandbox. Thanks in any case, and sorry for the\ninconvenience. In the mean time you can use the tools without\nsandboxing by using `make WITHOUT_SECCOMP=y` to recompile.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstef%2Fcr3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstef%2Fcr3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstef%2Fcr3/lists"}