Issue #6 Help using RSA public/private keypairs to sign #6

This commit is contained in:
Arun M 2018-04-04 11:29:29 +05:30
parent 3ae6dfa2c5
commit dfaa507c0b
14 changed files with 107 additions and 985 deletions

View file

@ -1,16 +0,0 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.6
# Relative path conversion top directories.
set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/Users/amuralid/dev_test/cpp-jwt")
set(CMAKE_RELATIVE_PATH_TOP_BINARY "/Users/amuralid/dev_test/cpp-jwt")
# Force unix paths in dependencies.
set(CMAKE_FORCE_UNIX_PATHS 1)
# The C and CXX include file regular expressions for this directory.
set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$")
set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$")
set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})
set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN})

View file

@ -1 +0,0 @@
4

View file

@ -1,492 +0,0 @@
#IncludeRegexLine: ^[ ]*#[ ]*(include|import)[ ]*[<"]([^">]+)([">])
#IncludeRegexScan: ^.*$
#IncludeRegexComplain: ^$
#IncludeRegexTransform:
/Users/amuralid/dev_test/cpp-jwt/examples/simple_ex1.cc
iostream
-
jwt/jwt.hpp
/Users/amuralid/dev_test/cpp-jwt/examples/jwt/jwt.hpp
/usr/local/Cellar/openssl/1.0.2j/include/openssl/asn1.h
time.h
-
openssl/e_os2.h
-
openssl/bio.h
-
openssl/stack.h
-
openssl/safestack.h
-
openssl/symhacks.h
-
openssl/ossl_typ.h
-
openssl/bn.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/bio.h
openssl/e_os2.h
-
stdio.h
-
stdarg.h
-
openssl/crypto.h
-
stdint.h
-
inttypes.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/bn.h
limits.h
-
openssl/e_os2.h
-
stdio.h
-
openssl/ossl_typ.h
-
openssl/crypto.h
-
assert.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/buffer.h
openssl/ossl_typ.h
-
stddef.h
-
sys/types.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/crypto.h
stdlib.h
-
openssl/e_os2.h
-
stdio.h
-
openssl/stack.h
-
openssl/safestack.h
-
openssl/opensslv.h
-
openssl/ossl_typ.h
-
openssl/ebcdic.h
-
openssl/symhacks.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/dh.h
openssl/e_os2.h
-
openssl/bio.h
-
openssl/ossl_typ.h
-
openssl/bn.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/dsa.h
openssl/e_os2.h
-
openssl/bio.h
-
openssl/crypto.h
-
openssl/ossl_typ.h
-
openssl/bn.h
-
openssl/dh.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/e_os2.h
openssl/opensslconf.h
-
sys/socket.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/ebcdic.h
sys/types.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/ec.h
openssl/opensslconf.h
-
openssl/asn1.h
-
openssl/symhacks.h
-
openssl/bn.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/ecdh.h
openssl/opensslconf.h
-
openssl/ec.h
-
openssl/ossl_typ.h
-
openssl/bn.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/ecdsa.h
openssl/opensslconf.h
-
openssl/ec.h
-
openssl/ossl_typ.h
-
openssl/bn.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/evp.h
openssl/opensslconf.h
-
openssl/opensslconf.h
-
openssl/ossl_typ.h
-
openssl/symhacks.h
-
openssl/bio.h
-
openssl/objects.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/hmac.h
openssl/opensslconf.h
-
openssl/evp.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/lhash.h
openssl/e_os2.h
-
stdio.h
-
openssl/bio.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/obj_mac.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/objects.h
openssl/obj_mac.h
-
openssl/bio.h
-
openssl/asn1.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/opensslconf.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/opensslv.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/ossl_typ.h
openssl/e_os2.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/pem.h
openssl/e_os2.h
-
openssl/bio.h
-
openssl/stack.h
-
openssl/evp.h
-
openssl/x509.h
-
openssl/pem2.h
-
openssl/symhacks.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/pem2.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/pkcs7.h
openssl/asn1.h
-
openssl/bio.h
-
openssl/e_os2.h
-
openssl/symhacks.h
-
openssl/ossl_typ.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/rsa.h
openssl/asn1.h
-
openssl/bio.h
-
openssl/crypto.h
-
openssl/ossl_typ.h
-
openssl/bn.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/safestack.h
openssl/stack.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/sha.h
openssl/e_os2.h
-
stddef.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/stack.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/symhacks.h
openssl/e_os2.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/x509.h
openssl/e_os2.h
-
openssl/symhacks.h
-
openssl/buffer.h
-
openssl/evp.h
-
openssl/bio.h
-
openssl/stack.h
-
openssl/asn1.h
-
openssl/safestack.h
-
openssl/ec.h
-
openssl/ecdsa.h
-
openssl/ecdh.h
-
openssl/rsa.h
-
openssl/dsa.h
-
openssl/dh.h
-
openssl/sha.h
-
openssl/ossl_typ.h
-
openssl/x509_vfy.h
-
openssl/pkcs7.h
-
/usr/local/Cellar/openssl/1.0.2j/include/openssl/x509_vfy.h
openssl/x509.h
-
openssl/opensslconf.h
-
openssl/lhash.h
-
openssl/bio.h
-
openssl/crypto.h
-
openssl/symhacks.h
-
include/jwt/algorithm.hpp
cassert
-
system_error
-
openssl/bn.h
-
openssl/bio.h
-
openssl/pem.h
-
openssl/evp.h
-
openssl/hmac.h
-
openssl/ecdsa.h
-
openssl/buffer.h
-
jwt/exceptions.hpp
include/jwt/jwt/exceptions.hpp
jwt/string_view.hpp
include/jwt/jwt/string_view.hpp
jwt/error_codes.hpp
include/jwt/jwt/error_codes.hpp
jwt/impl/algorithm.ipp
include/jwt/jwt/impl/algorithm.ipp
include/jwt/base64.hpp
array
-
cassert
-
jwt/string_view.hpp
include/jwt/jwt/string_view.hpp
include/jwt/detail/meta.hpp
iterator
-
type_traits
-
jwt/string_view.hpp
include/jwt/detail/jwt/string_view.hpp
include/jwt/error_codes.hpp
system_error
-
jwt/impl/error_codes.ipp
include/jwt/jwt/impl/error_codes.ipp
include/jwt/exceptions.hpp
new
-
string
-
include/jwt/impl/algorithm.ipp
include/jwt/impl/error_codes.ipp
include/jwt/impl/jwt.ipp
jwt/detail/meta.hpp
include/jwt/impl/jwt/detail/meta.hpp
algorithm
-
include/jwt/impl/string_view.ipp
include/jwt/json/json.hpp
algorithm
-
array
-
cassert
-
ciso646
-
clocale
-
cmath
-
cstddef
-
cstdint
-
cstdlib
-
cstring
-
forward_list
-
functional
-
initializer_list
-
iomanip
-
iosfwd
-
iterator
-
limits
-
locale
-
map
-
memory
-
numeric
-
sstream
-
string
-
type_traits
-
utility
-
valarray
-
vector
-
include/jwt/jwt.hpp
set
-
array
-
string
-
chrono
-
ostream
-
cassert
-
cstring
-
jwt/base64.hpp
include/jwt/jwt/base64.hpp
jwt/algorithm.hpp
include/jwt/jwt/algorithm.hpp
jwt/string_view.hpp
include/jwt/jwt/string_view.hpp
jwt/parameters.hpp
include/jwt/jwt/parameters.hpp
jwt/exceptions.hpp
include/jwt/jwt/exceptions.hpp
jwt/json/json.hpp
include/jwt/jwt/json/json.hpp
jwt/impl/jwt.ipp
include/jwt/jwt/impl/jwt.ipp
include/jwt/parameters.hpp
map
-
chrono
-
string
-
vector
-
utility
-
unordered_map
-
jwt/algorithm.hpp
include/jwt/jwt/algorithm.hpp
jwt/detail/meta.hpp
include/jwt/jwt/detail/meta.hpp
jwt/string_view.hpp
include/jwt/jwt/string_view.hpp
include/jwt/string_view.hpp
limits
-
string
-
cassert
-
jwt/impl/string_view.ipp
include/jwt/jwt/impl/string_view.ipp

View file

@ -1,113 +0,0 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.6
# Delete rule output on recipe failure.
.DELETE_ON_ERROR:
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /usr/local/Cellar/cmake/3.6.2/bin/cmake
# The command to remove a file.
RM = /usr/local/Cellar/cmake/3.6.2/bin/cmake -E remove -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /Users/amuralid/dev_test/cpp-jwt
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /Users/amuralid/dev_test/cpp-jwt
# Include any dependencies generated for this target.
include examples/CMakeFiles/simple_ex1.dir/depend.make
# Include the progress variables for this target.
include examples/CMakeFiles/simple_ex1.dir/progress.make
# Include the compile flags for this target's objects.
include examples/CMakeFiles/simple_ex1.dir/flags.make
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: examples/CMakeFiles/simple_ex1.dir/flags.make
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: examples/simple_ex1.cc
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/Users/amuralid/dev_test/cpp-jwt/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building CXX object examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o"
cd /Users/amuralid/dev_test/cpp-jwt/examples && /Library/Developer/CommandLineTools/usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/simple_ex1.dir/simple_ex1.cc.o -c /Users/amuralid/dev_test/cpp-jwt/examples/simple_ex1.cc
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.i: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/simple_ex1.dir/simple_ex1.cc.i"
cd /Users/amuralid/dev_test/cpp-jwt/examples && /Library/Developer/CommandLineTools/usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /Users/amuralid/dev_test/cpp-jwt/examples/simple_ex1.cc > CMakeFiles/simple_ex1.dir/simple_ex1.cc.i
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.s: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/simple_ex1.dir/simple_ex1.cc.s"
cd /Users/amuralid/dev_test/cpp-jwt/examples && /Library/Developer/CommandLineTools/usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /Users/amuralid/dev_test/cpp-jwt/examples/simple_ex1.cc -o CMakeFiles/simple_ex1.dir/simple_ex1.cc.s
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o.requires:
.PHONY : examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o.requires
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o.provides: examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o.requires
$(MAKE) -f examples/CMakeFiles/simple_ex1.dir/build.make examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o.provides.build
.PHONY : examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o.provides
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o.provides.build: examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o
# Object files for target simple_ex1
simple_ex1_OBJECTS = \
"CMakeFiles/simple_ex1.dir/simple_ex1.cc.o"
# External object files for target simple_ex1
simple_ex1_EXTERNAL_OBJECTS =
examples/simple_ex1: examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o
examples/simple_ex1: examples/CMakeFiles/simple_ex1.dir/build.make
examples/simple_ex1: examples/CMakeFiles/simple_ex1.dir/link.txt
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/Users/amuralid/dev_test/cpp-jwt/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking CXX executable simple_ex1"
cd /Users/amuralid/dev_test/cpp-jwt/examples && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/simple_ex1.dir/link.txt --verbose=$(VERBOSE)
# Rule to build all files generated by this target.
examples/CMakeFiles/simple_ex1.dir/build: examples/simple_ex1
.PHONY : examples/CMakeFiles/simple_ex1.dir/build
examples/CMakeFiles/simple_ex1.dir/requires: examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o.requires
.PHONY : examples/CMakeFiles/simple_ex1.dir/requires
examples/CMakeFiles/simple_ex1.dir/clean:
cd /Users/amuralid/dev_test/cpp-jwt/examples && $(CMAKE_COMMAND) -P CMakeFiles/simple_ex1.dir/cmake_clean.cmake
.PHONY : examples/CMakeFiles/simple_ex1.dir/clean
examples/CMakeFiles/simple_ex1.dir/depend:
cd /Users/amuralid/dev_test/cpp-jwt && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /Users/amuralid/dev_test/cpp-jwt /Users/amuralid/dev_test/cpp-jwt/examples /Users/amuralid/dev_test/cpp-jwt /Users/amuralid/dev_test/cpp-jwt/examples /Users/amuralid/dev_test/cpp-jwt/examples/CMakeFiles/simple_ex1.dir/DependInfo.cmake --color=$(COLOR)
.PHONY : examples/CMakeFiles/simple_ex1.dir/depend

View file

@ -1,48 +0,0 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.6
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o
/Users/amuralid/dev_test/cpp-jwt/examples/simple_ex1.cc
/usr/local/Cellar/openssl/1.0.2j/include/openssl/asn1.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/bio.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/bn.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/buffer.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/crypto.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/dh.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/dsa.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/e_os2.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/ebcdic.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/ec.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/ecdh.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/ecdsa.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/evp.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/hmac.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/lhash.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/obj_mac.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/objects.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/opensslconf.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/opensslv.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/ossl_typ.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/pem.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/pem2.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/pkcs7.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/rsa.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/safestack.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/sha.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/stack.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/symhacks.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/x509.h
/usr/local/Cellar/openssl/1.0.2j/include/openssl/x509_vfy.h
include/jwt/algorithm.hpp
include/jwt/base64.hpp
include/jwt/detail/meta.hpp
include/jwt/error_codes.hpp
include/jwt/exceptions.hpp
include/jwt/impl/algorithm.ipp
include/jwt/impl/error_codes.ipp
include/jwt/impl/jwt.ipp
include/jwt/impl/string_view.ipp
include/jwt/json/json.hpp
include/jwt/jwt.hpp
include/jwt/parameters.hpp
include/jwt/string_view.hpp

View file

@ -1,48 +0,0 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.6
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: examples/simple_ex1.cc
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/asn1.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/bio.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/bn.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/buffer.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/crypto.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/dh.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/dsa.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/e_os2.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/ebcdic.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/ec.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/ecdh.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/ecdsa.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/evp.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/hmac.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/lhash.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/obj_mac.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/objects.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/opensslconf.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/opensslv.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/ossl_typ.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/pem.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/pem2.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/pkcs7.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/rsa.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/safestack.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/sha.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/stack.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/symhacks.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/x509.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: /usr/local/Cellar/openssl/1.0.2j/include/openssl/x509_vfy.h
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: include/jwt/algorithm.hpp
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: include/jwt/base64.hpp
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: include/jwt/detail/meta.hpp
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: include/jwt/error_codes.hpp
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: include/jwt/exceptions.hpp
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: include/jwt/impl/algorithm.ipp
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: include/jwt/impl/error_codes.ipp
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: include/jwt/impl/jwt.ipp
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: include/jwt/impl/string_view.ipp
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: include/jwt/json/json.hpp
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: include/jwt/jwt.hpp
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: include/jwt/parameters.hpp
examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o: include/jwt/string_view.hpp

View file

@ -1,10 +0,0 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.6
# compile CXX with /Library/Developer/CommandLineTools/usr/bin/c++
CXX_FLAGS = -std=c++14 -DCERT_ROOT_DIR="\"/Users/amuralid/dev_test/cpp-jwt/examples/certs\""
CXX_DEFINES =
CXX_INCLUDES = -I/Users/amuralid/dev_test/cpp-jwt/include -I/usr/local/Cellar/openssl/1.0.2j/include

View file

@ -1 +0,0 @@
/Library/Developer/CommandLineTools/usr/bin/c++ -std=c++14 -DCERT_ROOT_DIR="\"/Users/amuralid/dev_test/cpp-jwt/examples/certs\"" -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/simple_ex1.dir/simple_ex1.cc.o -o simple_ex1 -L/usr/local/Cellar/openssl/1.0.2j/lib -lssl -lcrypto -lgtest -Wl,-rpath,/usr/local/Cellar/openssl/1.0.2j/lib

View file

@ -2,7 +2,7 @@
include_directories(${OPENSSL_INCLUDE_DIR})
link_directories(${OPENSSL_LIBRARIES})
SET(CERT_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/certs")
SET(CERT_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/rsa_256")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCERT_ROOT_DIR=\"\\\"${CERT_ROOT_DIR}\\\"\"")
add_executable(simple_ex1 simple_ex1.cc)
@ -10,3 +10,6 @@ target_link_libraries(simple_ex1 ssl crypto gtest)
add_executable(simple_ex2 simple_ex2.cc)
target_link_libraries(simple_ex2 ssl crypto gtest)
add_executable(simple_ex3_rsa simple_ex3_rsa.cc)
target_link_libraries(simple_ex3_rsa ssl crypto gtest)

View file

@ -1,226 +0,0 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.6
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target
# Allow only one "make -f Makefile2" at a time, but pass parallelism.
.NOTPARALLEL:
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /usr/local/Cellar/cmake/3.6.2/bin/cmake
# The command to remove a file.
RM = /usr/local/Cellar/cmake/3.6.2/bin/cmake -E remove -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /Users/amuralid/dev_test/cpp-jwt
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /Users/amuralid/dev_test/cpp-jwt
#=============================================================================
# Targets provided globally by CMake.
# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
/usr/local/Cellar/cmake/3.6.2/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : edit_cache
# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
/usr/local/Cellar/cmake/3.6.2/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache
# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast
# The main all target
all: cmake_check_build_system
cd /Users/amuralid/dev_test/cpp-jwt && $(CMAKE_COMMAND) -E cmake_progress_start /Users/amuralid/dev_test/cpp-jwt/CMakeFiles /Users/amuralid/dev_test/cpp-jwt/examples/CMakeFiles/progress.marks
cd /Users/amuralid/dev_test/cpp-jwt && $(MAKE) -f CMakeFiles/Makefile2 examples/all
$(CMAKE_COMMAND) -E cmake_progress_start /Users/amuralid/dev_test/cpp-jwt/CMakeFiles 0
.PHONY : all
# The main clean target
clean:
cd /Users/amuralid/dev_test/cpp-jwt && $(MAKE) -f CMakeFiles/Makefile2 examples/clean
.PHONY : clean
# The main clean target
clean/fast: clean
.PHONY : clean/fast
# Prepare targets for installation.
preinstall: all
cd /Users/amuralid/dev_test/cpp-jwt && $(MAKE) -f CMakeFiles/Makefile2 examples/preinstall
.PHONY : preinstall
# Prepare targets for installation.
preinstall/fast:
cd /Users/amuralid/dev_test/cpp-jwt && $(MAKE) -f CMakeFiles/Makefile2 examples/preinstall
.PHONY : preinstall/fast
# clear depends
depend:
cd /Users/amuralid/dev_test/cpp-jwt && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend
# Convenience name for target.
examples/CMakeFiles/simple_ex2.dir/rule:
cd /Users/amuralid/dev_test/cpp-jwt && $(MAKE) -f CMakeFiles/Makefile2 examples/CMakeFiles/simple_ex2.dir/rule
.PHONY : examples/CMakeFiles/simple_ex2.dir/rule
# Convenience name for target.
simple_ex2: examples/CMakeFiles/simple_ex2.dir/rule
.PHONY : simple_ex2
# fast build rule for target.
simple_ex2/fast:
cd /Users/amuralid/dev_test/cpp-jwt && $(MAKE) -f examples/CMakeFiles/simple_ex2.dir/build.make examples/CMakeFiles/simple_ex2.dir/build
.PHONY : simple_ex2/fast
# Convenience name for target.
examples/CMakeFiles/simple_ex1.dir/rule:
cd /Users/amuralid/dev_test/cpp-jwt && $(MAKE) -f CMakeFiles/Makefile2 examples/CMakeFiles/simple_ex1.dir/rule
.PHONY : examples/CMakeFiles/simple_ex1.dir/rule
# Convenience name for target.
simple_ex1: examples/CMakeFiles/simple_ex1.dir/rule
.PHONY : simple_ex1
# fast build rule for target.
simple_ex1/fast:
cd /Users/amuralid/dev_test/cpp-jwt && $(MAKE) -f examples/CMakeFiles/simple_ex1.dir/build.make examples/CMakeFiles/simple_ex1.dir/build
.PHONY : simple_ex1/fast
simple_ex1.o: simple_ex1.cc.o
.PHONY : simple_ex1.o
# target to build an object file
simple_ex1.cc.o:
cd /Users/amuralid/dev_test/cpp-jwt && $(MAKE) -f examples/CMakeFiles/simple_ex1.dir/build.make examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.o
.PHONY : simple_ex1.cc.o
simple_ex1.i: simple_ex1.cc.i
.PHONY : simple_ex1.i
# target to preprocess a source file
simple_ex1.cc.i:
cd /Users/amuralid/dev_test/cpp-jwt && $(MAKE) -f examples/CMakeFiles/simple_ex1.dir/build.make examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.i
.PHONY : simple_ex1.cc.i
simple_ex1.s: simple_ex1.cc.s
.PHONY : simple_ex1.s
# target to generate assembly for a file
simple_ex1.cc.s:
cd /Users/amuralid/dev_test/cpp-jwt && $(MAKE) -f examples/CMakeFiles/simple_ex1.dir/build.make examples/CMakeFiles/simple_ex1.dir/simple_ex1.cc.s
.PHONY : simple_ex1.cc.s
simple_ex2.o: simple_ex2.cc.o
.PHONY : simple_ex2.o
# target to build an object file
simple_ex2.cc.o:
cd /Users/amuralid/dev_test/cpp-jwt && $(MAKE) -f examples/CMakeFiles/simple_ex2.dir/build.make examples/CMakeFiles/simple_ex2.dir/simple_ex2.cc.o
.PHONY : simple_ex2.cc.o
simple_ex2.i: simple_ex2.cc.i
.PHONY : simple_ex2.i
# target to preprocess a source file
simple_ex2.cc.i:
cd /Users/amuralid/dev_test/cpp-jwt && $(MAKE) -f examples/CMakeFiles/simple_ex2.dir/build.make examples/CMakeFiles/simple_ex2.dir/simple_ex2.cc.i
.PHONY : simple_ex2.cc.i
simple_ex2.s: simple_ex2.cc.s
.PHONY : simple_ex2.s
# target to generate assembly for a file
simple_ex2.cc.s:
cd /Users/amuralid/dev_test/cpp-jwt && $(MAKE) -f examples/CMakeFiles/simple_ex2.dir/build.make examples/CMakeFiles/simple_ex2.dir/simple_ex2.cc.s
.PHONY : simple_ex2.cc.s
# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... edit_cache"
@echo "... rebuild_cache"
@echo "... simple_ex2"
@echo "... simple_ex1"
@echo "... simple_ex1.o"
@echo "... simple_ex1.i"
@echo "... simple_ex1.s"
@echo "... simple_ex2.o"
@echo "... simple_ex2.i"
@echo "... simple_ex2.s"
.PHONY : help
#=============================================================================
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
cd /Users/amuralid/dev_test/cpp-jwt && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system

View file

@ -1,29 +0,0 @@
# Install script for directory: /Users/amuralid/dev_test/cpp-jwt/examples
# Set the install prefix
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "/usr/local")
endif()
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
# Set the install configuration name.
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
if(BUILD_TYPE)
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
else()
set(CMAKE_INSTALL_CONFIG_NAME "")
endif()
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
endif()
# Set the component getting installed.
if(NOT CMAKE_INSTALL_COMPONENT)
if(COMPONENT)
message(STATUS "Install component: \"${COMPONENT}\"")
set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
else()
set(CMAKE_INSTALL_COMPONENT)
endif()
endif()

View file

@ -0,0 +1,15 @@
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQC4fkg/JYyN3Skr6RYLiAd/Yhl02TE3/HzHSNPnCaRdUakGp9og
7oXBMcoadFDjnoSq1sz+gUHnpoO7s2fwkD5Q4OnCBGD3oKP2A4PlOOWD2B2cVmMq
X/vf1nAA/343496jsbfgkh1Q7LTzR0IXfdii0o1UCbvrVCuaBoyiv4TxWQIDAQAB
AoGAWA5uDTWu0Ecuz3aAvyA9896up8bCZyZrp/JqsWs4uBGxyytyQSWXUY6iF95M
fVe7mo7LaO3ottgTKBOJGJjAJKnfwXRn8/NV/Q5oHx48sPGDoUUtyMrRbZpeLM1L
gpFX715XWrtALInWPlVG1OfkQQLv4K7mwveM0cez0bWPUsECQQDuPK9IL7WuO2WR
s6pGEHBc3/MMk6I+vqJ+rJMgJjCC/Wjeyo6U3xTNipJRJL5L/Y8iMqpWCrYOjpo8
+1p4FXqDAkEAxj/FcVhXl3NMco6D9u0LxTAmqavMzmXDmODVW2m1K3+rQWQDqXqr
FQ9WQq0LSsqiwRul6hrd0EmCkNJqpCMN8wJBAIz06uDTGbPVAOuMWhrKbzEEcFHo
p/5n3M0GXqaO8fUO6pWnU2VR+IUEkD3id5WOmLmrMI1oGP/T7/5U2dpjGvECQEBq
0k4tJXEJvupuUoT2q19scPOq5kaenHrde5ZTd9HljxEVXXdBa7vRGvdZYRTxWQck
Y7n49uBKMom6RXqGBW8CQQCrnub4stg6dwdpnmZmEtAE4VqNSZeV5UWz7+l7+R+B
ENtNlIgyQfE6NpOc3Fr/uy3IQjaHcOOwIKI0GMJww9sC
-----END RSA PRIVATE KEY-----

View file

@ -0,0 +1,6 @@
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC4fkg/JYyN3Skr6RYLiAd/Yhl0
2TE3/HzHSNPnCaRdUakGp9og7oXBMcoadFDjnoSq1sz+gUHnpoO7s2fwkD5Q4OnC
BGD3oKP2A4PlOOWD2B2cVmMqX/vf1nAA/343496jsbfgkh1Q7LTzR0IXfdii0o1U
CbvrVCuaBoyiv4TxWQIDAQAB
-----END PUBLIC KEY-----

View file

@ -0,0 +1,82 @@
#include <chrono>
#include <cassert>
#include <fstream>
#include <string>
#include <iostream>
#include "jwt/jwt.hpp"
/***
* STEPS TO GENERATE RSA PRIVATE PUBLIC KEYPAIR.
*
* 1. openssl genrsa -out jwtRS256.key 1024
* 2. openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
*/
std::string read_from_file(const std::string& path)
{
std::string contents;
std::ifstream is{path, std::ifstream::binary};
if (is) {
// get length of file:
is.seekg (0, is.end);
auto length = is.tellg();
is.seekg (0, is.beg);
contents.resize(length);
is.read(&contents[0], length);
if (!is) {
is.close();
return {};
}
} else {
std::cerr << "FILE not FOUND!!" << std::endl;
}
is.close();
return contents;
}
int main() {
using namespace jwt::params;
const std::string priv_key_path = std::string{CERT_ROOT_DIR} + "/jwtRS256.key";
const std::string pub_key_path = std::string{CERT_ROOT_DIR} + "/jwtRS256.key.pub";
auto priv_key = read_from_file(priv_key_path);
jwt::jwt_object obj{algorithm("rs256"), secret(priv_key), payload({{"user", "admin"}})};
//Use add_claim API to add claim values which are
// _not_ strings.
// For eg: `iat` and `exp` claims below.
// Other claims could have been added in the payload
// function above as they are just stringy things.
obj.add_claim("iss", "arun.muralidharan")
.add_claim("sub", "test")
.add_claim("id", "a-b-c-d-e-f-1-2-3")
.add_claim("iat", 1513862371)
.add_claim("exp", std::chrono::system_clock::now() + std::chrono::seconds{10})
;
//Use `has_claim` to check if the claim exists or not
assert (obj.has_claim("iss"));
assert (obj.has_claim("exp"));
//Use `has_claim_with_value` to check if the claim exists
//with a specific value or not.
assert (obj.payload().has_claim_with_value("id", "a-b-c-d-e-f-1-2-3"));
assert (obj.payload().has_claim_with_value("iat", 1513862371));
auto pub_key = read_from_file(pub_key_path);
std::error_code ec{};
auto sign = obj.signature(ec);
if (ec) {
std::cerr << ec.message() << std::endl;
return 1;
}
auto dec_obj = jwt::decode(sign, algorithms({"rs256"}), verify(false), secret(pub_key));
return 0;
}