From fc236266f7931cde83c5c136a0a4e0246ab018e0 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Sat, 8 Oct 2016 22:21:24 +0200 Subject: Add envelope application using the crypto lib --- envelope/Makefile | 30 +++++++++++++++++ envelope/envelope | Bin 0 -> 116616 bytes envelope/main.cpp | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 127 insertions(+) create mode 100644 envelope/Makefile create mode 100755 envelope/envelope create mode 100644 envelope/main.cpp (limited to 'envelope') diff --git a/envelope/Makefile b/envelope/Makefile new file mode 100644 index 0000000..06b0419 --- /dev/null +++ b/envelope/Makefile @@ -0,0 +1,30 @@ +CXX = g++ +CXXFLAGS = -Wall -Wextra -std=c++0x -fwrapv +LDFLAGS = +ifneq ($(DEBUG),) + CXXFLAGS += -g +else + CXXFLAGS += -O2 +endif +ifeq ($(shell uname),Linux) + LDFLAGS += -lbsd +endif + +BIN = envelope + + +.PHONY: all clean remake + +all: $(BIN) + +clean: + rm -rf $(BIN) *.o *.dSYM + +remake: clean all + + +$(BIN): $(patsubst %.cpp,%.o,$(wildcard *.cpp)) ../cryptolib.a + $(CXX) -o $@ $^ $(LDFLAGS) + +%.o: %.cpp $(wildcard *.h) + $(CXX) $(CXXFLAGS) -c -o $@ $< diff --git a/envelope/envelope b/envelope/envelope new file mode 100755 index 0000000..50b479f Binary files /dev/null and b/envelope/envelope differ diff --git a/envelope/main.cpp b/envelope/main.cpp new file mode 100644 index 0000000..49b41ff --- /dev/null +++ b/envelope/main.cpp @@ -0,0 +1,97 @@ +#include +#include +#include "../base64.h" +#include "../envelope.h" + +using namespace std; + +const char *progname="envelope"; + +void usage(){ + cerr<<"Usage: " < Generate a key with the given number of bits" < Encrypt text on standard input" < Decrypt text on standard input" < used for RSA key generation is the number of bits in the" <= 512"<8192){ + cerr<<"Key length too large, please specify length <= 8192"< keyset=RSA::genkeys(keylength); + cerr<<"Public key:"<