Skip to content

Commit 10ac448

Browse files
authored
Merge pull request #4051 from vpodzime/master-cf_keycrypt
cf keycrypt attempt #2+
2 parents 6d2ce00 + 1600c9c commit 10ac448

File tree

21 files changed

+1169
-5
lines changed

21 files changed

+1169
-5
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ stamp-h1
3535
/cf-check/Makefile
3636
/cf-execd/Makefile
3737
/cf-key/Makefile
38+
/cf-keycrypt/Makefile
3839
/cf-monitord/Makefile
3940
/cf-net/Makefile
4041
/cf-promises/Makefile
@@ -92,6 +93,8 @@ stamp-h1
9293
/cf-runagent/cf-runagent.exe
9394
/cf-net/cf-net
9495
/cf-net/cf-net.exe
96+
/cf-keycrypt/cf-keycrypt
97+
/cf-keycrypt/cf-keycrypt.exe
9598
/cf-serverd/cf-serverd
9699
/cf-serverd/cf-serverd.exe
97100
/cf-testd/cf-testd

Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ SUBDIRS = \
4343
cf-testd \
4444
cf-upgrade \
4545
cf-net \
46+
cf-keycrypt \
4647
misc \
4748
ext \
4849
examples \

cf-keycrypt/Makefile.am

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#
2+
# Copyright (C) CFEngine AS
3+
#
4+
# This file is part of CFEngine 3 - written and maintained by CFEngine AS.
5+
#
6+
# This program is free software; you can redistribute it and/or modify it
7+
# under the terms of the GNU General Public License as published by the
8+
# Free Software Foundation; version 3.
9+
#
10+
# This program is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with this program; if not, write to the Free Software
17+
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
18+
#
19+
# To the extent this program is licensed as part of the Enterprise
20+
# versions of CFEngine, the applicable Commercial Open Source License
21+
# (COSL) may apply to this file if you as a licensee so wish it. See
22+
# included file COSL.txt.
23+
#
24+
noinst_LTLIBRARIES = libcf-keycrypt.la
25+
26+
AM_CPPFLAGS = -I$(srcdir)/../libpromises -I$(srcdir)/../libntech/libutils \
27+
-I$(srcdir)/../libcfnet \
28+
$(OPENSSL_CPPFLAGS) \
29+
$(PCRE_CPPFLAGS) \
30+
$(ENTERPRISE_CPPFLAGS)
31+
32+
AM_CFLAGS = @CFLAGS@ \
33+
$(OPENSSL_CFLAGS) \
34+
$(ENTERPRISE_CFLAGS)
35+
36+
libcf_keycrypt_la_LIBADD = ../libpromises/libpromises.la
37+
38+
libcf_keycrypt_la_SOURCES = cf-keycrypt.c
39+
40+
if !BUILTIN_EXTENSIONS
41+
bin_PROGRAMS = cf-keycrypt
42+
cf_keycrypt_LDADD = libcf-keycrypt.la
43+
cf_keycrypt_SOURCES =
44+
endif
45+
46+
CLEANFILES = *.gcno *.gcda
47+
48+
#
49+
# Some basic clean ups
50+
#
51+
MOSTLYCLEANFILES = *~ *.orig *.rej

cf-keycrypt/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# cf-keycrypt
2+
3+
*cf-keycrypt* is a utility for encrypting sensitive data for use on
4+
CFEngine-managed hosts. It is using the existing CFEngine key pairs for strong
5+
cryptography based on the combination of RSA and AES ciphers.
6+
7+
## File format
8+
9+
The file format used by *cf-keycrypt* has the following schema:
10+
11+
```
12+
------------
13+
| Headers |
14+
------------
15+
| AES IV |
16+
------------
17+
| AES key |
18+
------------
19+
| data |
20+
------------
21+
```
22+
23+
The header format is similar to HTTP headers -- colon-separated key-value pairs
24+
each on one line:
25+
26+
`Key: Value\n`
27+
28+
The header section is terminated by a blank line.
29+
30+
Supported headers are:
31+
32+
* `Version` (required) -- version of the file format to allow backwards
33+
compatibility
34+
35+
The AES initialization vector is 16 bytes long (256 bits) and serves the purpose
36+
of the seed for the CBC (Cipher Block Chain) mode of operation of the AES
37+
cipher.
38+
39+
The AES key is a randomly generated AES key encrypted by the specific RSA public
40+
key and is as long as the RSA public key, currently 256 bytes (2048 bits).
41+
42+
The future versions of *cf-keycrypt* are expected to support more headers,
43+
multiple keys (encryption for multiple hosts in a single file) and varying key
44+
sizes.

0 commit comments

Comments
 (0)