Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Support configurable client deadlines #30

Open
wants to merge 132 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
7cae818
Added an argument client_deadline
Shehab7osny Apr 15, 2020
1e0aa02
Added an argument client_deadline
Shehab7osny Apr 15, 2020
b6a06f6
Added an argument client_deadline
Shehab7osny Apr 15, 2020
f857924
Added an argument client_deadline
Shehab7osny Apr 15, 2020
07b181a
Add argument to options() along with a default
Shehab7osny Apr 20, 2020
4eb1790
Removed an argument
Shehab7osny Apr 20, 2020
097251a
Added an option in the example
Shehab7osny Apr 20, 2020
320b337
Documentation of the package (No Major Change)
Shehab7osny Apr 20, 2020
22c3f3b
Create Client_Server_Check.yml
Shehab7osny May 15, 2020
4ecc0d9
Update Client_Server_Check.yml
Shehab7osny May 15, 2020
d49699d
Update Client_Server_Check.yml
Shehab7osny May 15, 2020
80dd919
Update Client_Server_Check.yml
Shehab7osny May 15, 2020
cc305e6
Create Commit.txt
Shehab7osny May 19, 2020
c0515bb
PEM files for encryption
Shehab7osny May 19, 2020
3a2c617
Delete Commit.txt
Shehab7osny May 20, 2020
fa7f6e0
Client Credentials PEM files
Shehab7osny May 20, 2020
f9ad8cf
Added TLS Encryption Parameters
Shehab7osny May 27, 2020
24e5f93
Added TLS Encryption Parameters
Shehab7osny May 27, 2020
2a44f50
Added TLS Encryption Parameters
Shehab7osny May 27, 2020
0dc79b9
Added TLS Encryption Parameters
Shehab7osny May 27, 2020
ee76b32
Added TLS Encryption Parameters
Shehab7osny May 27, 2020
4537b10
Added TLS Encryption Parameters
Shehab7osny May 27, 2020
0c61327
Added TLS Encryption Parameters
Shehab7osny May 27, 2020
b2f366e
Added client_deadline parameter
Shehab7osny May 27, 2020
0236d3c
Added client_deadline argument
Shehab7osny May 27, 2020
b4d11e7
Added TLS Encryption Configuration
Shehab7osny May 27, 2020
f90468c
Added header files
Shehab7osny May 27, 2020
54051d5
Added TLS Encryption Configuration
Shehab7osny May 27, 2020
e7fd9c5
Delete test_root_cert.txt
Shehab7osny May 27, 2020
31bf310
Delete test_server1_cert.txt
Shehab7osny May 27, 2020
62a2d36
Delete test_server1_key.txt
Shehab7osny May 27, 2020
4fe480c
Delete test_signed_client_cert.txt
Shehab7osny May 27, 2020
98f51bb
Delete test_signed_client_key.txt
Shehab7osny May 27, 2020
4161ef3
Create Commit.txt
Shehab7osny May 27, 2020
bbc62d7
Upload files to generate TLS certificates
Shehab7osny May 27, 2020
05ae0d3
Delete Commit.txt
Shehab7osny May 27, 2020
8fd0a14
Rename the file
Shehab7osny May 27, 2020
3554872
Edited YAML file to check the test folder
Shehab7osny Jun 1, 2020
fa94c0c
Edited the first job
Shehab7osny Jun 1, 2020
d01e3ae
Create testthat.R file
Shehab7osny Jun 1, 2020
d38f4f5
Created test_grpc.R file
Shehab7osny Jun 1, 2020
038e1e6
Edited the package name
Shehab7osny Jun 1, 2020
057f667
Edited Test 1
Shehab7osny Jun 1, 2020
f6062e9
Minor edits in YAML file
Shehab7osny Jun 1, 2020
258c5fc
Installed RProtoBuf package
Shehab7osny Jun 1, 2020
17fc7ec
Edited installation of RProtoBuf package
Shehab7osny Jun 1, 2020
f20dd1a
Edited installation of RProtoBuf Package
Shehab7osny Jun 1, 2020
9411035
Edit
Shehab7osny Jun 1, 2020
0555afd
Edit 1
Shehab7osny Jun 1, 2020
a38928f
Edit
Shehab7osny Jun 2, 2020
771c0e3
Edit
Shehab7osny Jun 2, 2020
25f2b0e
Edit
Shehab7osny Jun 2, 2020
7310de8
Edit
Shehab7osny Jun 2, 2020
c4ac6c0
Edit RProtobuf
Shehab7osny Jun 2, 2020
0086525
Edit
Shehab7osny Jun 2, 2020
c42469b
Edit
Shehab7osny Jun 2, 2020
ce44f90
Edit
Shehab7osny Jun 2, 2020
dd6e978
Edited Test 1
Shehab7osny Jun 2, 2020
b30a96a
Edit
Shehab7osny Jun 2, 2020
ba152f6
Edit
Shehab7osny Jun 2, 2020
4c2fc1f
Updated first step
Shehab7osny Jun 2, 2020
f511808
Updated job name
Shehab7osny Jun 2, 2020
7ce489b
Updated step 2
Shehab7osny Jun 2, 2020
934e18e
Updated Step 3
Shehab7osny Jun 2, 2020
080ce25
Updated Step 3
Shehab7osny Jun 2, 2020
74b636e
Cache First 3 Steps
Shehab7osny Jun 2, 2020
54a8be8
New YAML file for dependencies
Shehab7osny Jun 2, 2020
aff21e9
Update
Shehab7osny Jun 2, 2020
dc4f0f2
Delete Dependencies.yml
Shehab7osny Jun 2, 2020
474a3ed
Update
Shehab7osny Jun 2, 2020
c984a2c
Create bashlib.sh
Shehab7osny Jun 2, 2020
27d7d07
Create caches.js
Shehab7osny Jun 2, 2020
333dc45
Update Client_Server_Check.yml
Shehab7osny Jun 2, 2020
2471f95
Update Client_Server_Check.yml
Shehab7osny Jun 2, 2020
b6ce09e
Update caches.js
Shehab7osny Jun 2, 2020
e26c555
Update caches.js
Shehab7osny Jun 2, 2020
d6c9d7c
Update Client_Server_Check.yml
Shehab7osny Jun 2, 2020
89791cf
Update Client_Server_Check.yml
Shehab7osny Jun 2, 2020
fe29353
Update Client_Server_Check.yml
Shehab7osny Jun 2, 2020
a58d52e
Update Client_Server_Check.yml
Shehab7osny Jun 2, 2020
0b575b7
Update Client_Server_Check.yml
Shehab7osny Jun 2, 2020
7b3f007
Update Client_Server_Check.yml
Shehab7osny Jun 2, 2020
b8b99bf
Update Client_Server_Check.yml
Shehab7osny Jun 3, 2020
2f5d616
Update Client_Server_Check.yml
Shehab7osny Jun 3, 2020
e5a46ef
Update Client_Server_Check.yml
Shehab7osny Jun 3, 2020
11fa88d
Update Client_Server_Check.yml
Shehab7osny Jun 3, 2020
3f7244a
Commands to generate Client Certificates
Shehab7osny Jun 3, 2020
92bae18
Upload files to generate TLS certificates
Shehab7osny Jun 3, 2020
09e7515
Delete client-ext.cnf
Shehab7osny Jun 3, 2020
23b65fc
Edited command
Shehab7osny Jun 3, 2020
ea9530d
Update the CN
Shehab7osny Jun 3, 2020
2fc750b
Provide the certificates for TLS encryption
Shehab7osny Jun 3, 2020
dec4034
Update the server credentials
Shehab7osny Jun 3, 2020
ca38e5e
Clean Code + Authentication
Shehab7osny Jun 21, 2020
4390b90
Clean Code + Authentication
Shehab7osny Jun 21, 2020
84ed31f
Update functions' arguments
Shehab7osny Jun 21, 2020
f06b572
Added authentication functionality
Shehab7osny Jun 21, 2020
746ab52
Added authentication functionality
Shehab7osny Jun 21, 2020
87cc846
Update functions' arguments
Shehab7osny Jun 21, 2020
4079297
Added test for authentication functionality
Shehab7osny Jun 21, 2020
a7161c2
Added test for authentication functionality
Shehab7osny Jun 21, 2020
f0cf49e
Added files struct
Shehab7osny Jun 21, 2020
618916c
Added Authentication_Token struct
Shehab7osny Jun 21, 2020
2d5580b
Update server.cpp
Shehab7osny Aug 9, 2020
b992ba1
Initial steps to add streaming functionality
Shehab7osny Aug 9, 2020
20c07dc
Added the server-side streaming functionality
Shehab7osny Aug 20, 2020
4f3d6db
Added the server-side streaming functionality
Shehab7osny Aug 20, 2020
814ee88
Example to test streaming
Shehab7osny Aug 20, 2020
543d3dd
Example to test streaming
Shehab7osny Aug 20, 2020
566fdb3
Delete testthat.R
Shehab7osny Aug 23, 2020
c1ca5d5
Delete test_grpc.R
Shehab7osny Aug 23, 2020
a1ccbfa
Delete Client_Libraries.h
Shehab7osny Aug 23, 2020
2302ae9
Delete Server_Libraries.h
Shehab7osny Aug 23, 2020
a781a93
Update client.cpp
Shehab7osny Aug 23, 2020
eb39b27
Update server.cpp
Shehab7osny Aug 23, 2020
715902d
Add files via upload
Shehab7osny Aug 23, 2020
c08db6f
Delete Generate.sh
Shehab7osny Aug 23, 2020
8bd272e
Delete bashlib.sh
Shehab7osny Aug 23, 2020
fb73912
Delete caches.js
Shehab7osny Aug 23, 2020
273fc68
Delete Client_Server_Check.yml
Shehab7osny Aug 23, 2020
83a53d0
Delete tempCodeRunnerFile.python
Shehab7osny Aug 24, 2020
57d896b
Added logging hooks for Oauth2
Shehab7osny Aug 26, 2020
a51fd88
Create Createfolder
Shehab7osny Aug 27, 2020
28ba503
Add files via upload
Shehab7osny Aug 27, 2020
f089f36
Delete Createfolder
Shehab7osny Aug 27, 2020
c546a66
Update Report.Rmd
Shehab7osny Aug 28, 2020
4b872d1
Update Report.Rmd
Shehab7osny Aug 28, 2020
cd9233d
Image to be added in the vignette
Shehab7osny Aug 28, 2020
509b2ef
Update Report.Rmd
Shehab7osny Aug 28, 2020
f72dda5
Add files via upload
Shehab7osny Aug 28, 2020
8f0c1fb
Delete gRPC GSoC 2020.html
Shehab7osny Aug 28, 2020
5072680
Update Report.Rmd
Shehab7osny Aug 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ LinkingTo: Rcpp
SystemRequirements:
grpc (>= 4.0.0)
protobuf
RoxygenNote: 6.0.1
RoxygenNote: 7.1.0
8 changes: 4 additions & 4 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

fetch <- function(server, method, requestArg, metadata) {
.Call('_grpc_fetch', PACKAGE = 'grpc', server, method, requestArg, metadata)
fetch <- function(server, method, requestArg, metadata, UseTLS, CertPath, AccessToken, ClientDeadline) {
.Call('_grpc_fetch', PACKAGE = 'grpc', server, method, requestArg, metadata, UseTLS, CertPath, AccessToken, ClientDeadline)
}

#' Check grpc version
Expand All @@ -12,7 +12,7 @@ grpc_version <- function() {
.Call('_grpc_grpc_version', PACKAGE = 'grpc')
}

run <- function(target, hoststring, hooks) {
.Call('_grpc_run', PACKAGE = 'grpc', target, hoststring, hooks)
run <- function(target, hoststring, hooks, UseTLS, CertPath, AccessToken) {
.Call('_grpc_run', PACKAGE = 'grpc', target, hoststring, hooks, UseTLS, CertPath, AccessToken)
}

71 changes: 54 additions & 17 deletions R/client.R
Original file line number Diff line number Diff line change
@@ -1,25 +1,62 @@
#' Build a client handle
#'
#' Build a client handle
#' @param stubs the stub of the service
#' @param channel what to connect to
#' @return client handle
#' @importFrom RProtoBuf P serialize read new
#' @export
grpc_client <- function(impl, channel) {


client_functions <- lapply(impl, function(fn)
{
RequestDescriptor <- P(fn[["RequestType"]]$proto)
ResponseDescriptor <- P(fn[["ResponseType"]]$proto)

list(
call = function(x, metadata=character(0)) read(ResponseDescriptor, fetch(channel, fn$name, serialize(x, NULL), metadata)),
build = function(...) new(RequestDescriptor, ...)
)
})

grpc_client <- function(impl, channel)
{

UseTLS <- getOption("UseTLS", default = TRUE)
CertPath <- getOption("CertPath", default = NULL)
AccessToken <- getOption("AccessToken", default = NULL)
ClientDeadline <- getOption("ClientDeadline", default = 5)

client_functions <- lapply(impl,
function(fn)
{
RequestDescriptor <- P(fn[["RequestType"]]$proto)
ResponseDescriptor <- P(fn[["ResponseType"]]$proto)
stream_bool <- fn[["ResponseType"]]$stream
message <- list(
call = function(x, metadata=character(0))
{
if(stream_bool) {
i <- 1
List_messages <- list()
while(1) {
message <- read(
ResponseDescriptor,
fetch(channel, fn$name, serialize(x, NULL), metadata, UseTLS, CertPath, AccessToken, ClientDeadline)
)

if(as.list(message) == '')
break;

List_messages[[i]] <- message
i <- i + 1
}
}

else {
List_messages <- read(
ResponseDescriptor,
fetch(channel, fn$name, serialize(x, NULL), metadata, UseTLS, CertPath, AccessToken, ClientDeadline)
)
}

List_messages
},

build = function(...)
{
new(RequestDescriptor, ...)
}
)

message
}
)

client_functions
}
}
33 changes: 27 additions & 6 deletions R/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,43 @@
#' @seealso \code{\link{grpc_default_hooks}}
start_server <- function(impl, channel, hooks = grpc_default_hooks()) {

UseTLS <- getOption("UseTLS", default = TRUE)
CertPath <- getOption("CertPath", default = NULL)
AccessToken <- getOption("AccessToken", default = NULL)

if (!is.null(hooks$exit) & is.function(hooks$exit)) {
on.exit(hooks$exit())
}

server_functions <- lapply(impl, function(fn){
serialFun <- function(fn) {

descriptor <- P(fn[["RequestType"]]$proto)

f <- structure(fn$f,
RequestType = fn[["RequestType"]],
ResponseType = fn[["ResponseType"]])

function(x) serialize(f(read(descriptor, x)), NULL)
})
}

streamFun <- function(fn) {
descriptor <- fn[["ResponseType"]]$stream
}

stream_bool <- lapply(impl, streamFun)
server_functions <- lapply(impl, serialFun)

checkAuthCallback <- function(token) {
token == AccessToken
}

names(server_functions) <- vapply(impl, function(x)x$name, NA_character_)
names(stream_bool) <- vapply(impl, function(x)x$name, NA_character_)

run(server_functions, channel, hooks)
run(server_functions, channel, hooks, UseTLS, CertPath, checkAuthCallback, stream_bool)
invisible(NULL)
}


#' Construct a new ProtoBuf of ResponseType
#'
#' @param ... threaded through to the ProtoBuf constructor
Expand All @@ -40,6 +56,11 @@ start_server <- function(impl, channel, hooks = grpc_default_hooks()) {
#'
#' @export
#' @importFrom RProtoBuf P new
newResponse <- function(..., WFUN=sys.function(-1)){
new(P(attr(WFUN, "ResponseType")$proto), ...)
newResponse <- function(..., WFUN=sys.function(-1)) {

response <- new(P(attr(WFUN, "ResponseType")$proto), ...)

# Serialize the response
serializedResponse = serialize(response, NULL)
streamMessage(serializedResponse)
}
24 changes: 24 additions & 0 deletions demo/hello_Client_Streaming.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#' Example gRPC client
#'
#' Sends a message with a name and returns a message greeting the name.
#' @references \url{https://github.com/grpc/grpc/tree/master/examples/cpp/helloworld}

library(grpc)


spec <- system.file('examples/helloworld.proto', package = 'grpc')
impl <- read_services(spec)

options(UseTLS = FALSE)
options(CertPath = "/home/shehab/Dropbox/gRPC/Certificates/")
options(AccessToken = "Bearer Token Shehab and Neal")
options(ClientDeadline = 10)

client <- grpc_client(impl, "localhost:50051")

everything <- client$SayEverything$build(name='Shehab')
queue <- client$SayEverything$call(everything)

for (message in queue) {
print(as.list(message))
}
38 changes: 38 additions & 0 deletions demo/hello_Server_Streaming.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#' Example gRPC service
#'
#' Reads a message with a name and returns a message greeting the name.
#' @references \url{https://github.com/grpc/grpc/tree/master/examples/cpp/helloworld}

library(grpc)

## reading the service definitions
spec <- system.file('examples/helloworld.proto', package = 'grpc')

impl <- read_services(spec)

options(UseTLS = FALSE)
options(CertPath = "/home/shehab/Dropbox/gRPC/Certificates/")
options(AccessToken = "Bearer Token Shehab and Neal")

impl$SayHello$f <- function(request){
newResponse(message = paste('Hello,', request$name))
}

impl$SayThanks$f <- function(request){
newResponse(message = paste('Thanks,', request$name))
}

impl$SayBye$f <- function(request){
newResponse(message = paste('Bye,', request$name))
}

impl$SayEverything$f <- function(request){
newResponse(message = paste('Your name is ', request$name))
newResponse(message = paste('Hello,', request$name))
newResponse(message = paste('I hope you are enjoying your day,', request$name))
newResponse(message = paste('Thanks,', request$name))
newResponse(message = paste('Bye,', request$name))
}

## actually running the service handlers
start_server(impl, "0.0.0.0:50051")
14 changes: 10 additions & 4 deletions demo/helloclient.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,31 @@ library(grpc)

spec <- system.file('examples/helloworld.proto', package = 'grpc')
impl <- read_services(spec)

options(UseTLS = TRUE)
options(CertPath = "/home/shehab/Dropbox/gRPC/Certificates/")
options(AccessToken = "Bearer Token Shehab and Neal")
options(ClientDeadline = 10)

client <- grpc_client(impl, "localhost:50051")


for(who in c("Neal", "Gergely", "Jay")){
hello <- client$SayHello$build(name=who)
message <- client$SayHello$call(hello)

print(message)
#print(message)
print(as.list(message))

thanks <- client$SayThanks$build(name=who)
message <- client$SayThanks$callWithMetadata(thanks, c("key1", "val1"))
message <- client$SayThanks$call(thanks, c("authorization", "Bearer Token Shehab and Neal"))

print(message)
#print(message)
print(as.list(message))

bye <- client$SayBye$build(name=who)
message <- client$SayBye$call(bye)

print(message)
#print(message)
print(as.list(message))
}
5 changes: 4 additions & 1 deletion demo/helloserver.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ spec <- system.file('examples/helloworld.proto', package = 'grpc')

impl <- read_services(spec)

options(UseTLS = TRUE)
options(CertPath = "/home/shehab/Dropbox/gRPC/Certificates/")
options(AccessToken = "Bearer Token Shehab and Neal")

impl$SayHello$f <- function(request){
newResponse(message = paste('Hello,', request$name))
}
Expand All @@ -24,4 +28,3 @@ impl$SayBye$f <- function(request){

## actually running the service handlers
start_server(impl, "0.0.0.0:50051")

19 changes: 13 additions & 6 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@
using namespace Rcpp;

// fetch
RawVector fetch(CharacterVector server, CharacterVector method, RawVector requestArg, CharacterVector metadata);
RcppExport SEXP _grpc_fetch(SEXP serverSEXP, SEXP methodSEXP, SEXP requestArgSEXP, SEXP metadataSEXP) {
RawVector fetch(CharacterVector server, CharacterVector method, RawVector requestArg, CharacterVector metadata, bool useTLS, CharacterVector CertPath, CharacterVector AccessToken, int ClientDeadline);
RcppExport SEXP _grpc_fetch(SEXP serverSEXP, SEXP methodSEXP, SEXP requestArgSEXP, SEXP metadataSEXP, SEXP useTLSSEXP, SEXP CertPathSEXP, SEXP AccessTokenSEXP, SEXP ClientDeadlineSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< CharacterVector >::type server(serverSEXP);
Rcpp::traits::input_parameter< CharacterVector >::type method(methodSEXP);
Rcpp::traits::input_parameter< RawVector >::type requestArg(requestArgSEXP);
Rcpp::traits::input_parameter< CharacterVector >::type metadata(metadataSEXP);
rcpp_result_gen = Rcpp::wrap(fetch(server, method, requestArg, metadata));
Rcpp::traits::input_parameter< bool >::type useTLS(useTLSSEXP);
Rcpp::traits::input_parameter< CharacterVector >::type CertPath(CertPathSEXP);
Rcpp::traits::input_parameter< CharacterVector >::type AccessToken(AccessTokenSEXP);
Rcpp::traits::input_parameter< int >::type ClientDeadline(ClientDeadlineSEXP);
rcpp_result_gen = Rcpp::wrap(fetch(server, method, requestArg, metadata, useTLS, CertPath, AccessToken, ClientDeadline));
return rcpp_result_gen;
END_RCPP
}
Expand All @@ -30,15 +34,18 @@ BEGIN_RCPP
END_RCPP
}
// run
List run(List target, CharacterVector hoststring, List hooks);
RcppExport SEXP _grpc_run(SEXP targetSEXP, SEXP hoststringSEXP, SEXP hooksSEXP) {
List run(List target, CharacterVector hoststring, List hooks, bool useTLS, CharacterVector CertPath, CharacterVector AccessToken);
RcppExport SEXP _grpc_run(SEXP targetSEXP, SEXP hoststringSEXP, SEXP hooksSEXP, SEXP useTLSSEXP, SEXP CertPathSEXP, SEXP AccessTokenSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< List >::type target(targetSEXP);
Rcpp::traits::input_parameter< CharacterVector >::type hoststring(hoststringSEXP);
Rcpp::traits::input_parameter< List >::type hooks(hooksSEXP);
rcpp_result_gen = Rcpp::wrap(run(target, hoststring, hooks));
Rcpp::traits::input_parameter< bool >::type useTLS(useTLSSEXP);
Rcpp::traits::input_parameter< CharacterVector >::type CertPath(CertPathSEXP);
Rcpp::traits::input_parameter< CharacterVector >::type AccessToken(AccessTokenSEXP);
rcpp_result_gen = Rcpp::wrap(run(target, hoststring, hooks, useTLS, CertPath, AccessToken));
return rcpp_result_gen;
END_RCPP
}
16 changes: 16 additions & 0 deletions src/TLS/Generated.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
rm *.pem

# 1. Generate CA's private key and self-signed certificate
openssl req -x509 -newkey rsa:4096 -days 365 -nodes -keyout ca-key.pem -out ca-cert.pem -subj "/C=EG/ST=CairoEG/L=Cairo/O=GSoC/OU=CerAuth/CN=Cert/[email protected]"

# 2. Generate web server's private key and certificate signing request (CSR)
openssl req -newkey rsa:4096 -nodes -keyout server-key.pem -out server-req.pem -subj "/C=EG/ST=AlexEG/L=Alex/O=GSoC/OU=Server/CN=Server/[email protected]"

# 3. Use CA's private key to sign web server's CSR and get back the signed certificate
openssl x509 -req -in server-req.pem -days 60 -CA ca-cert.pem -CAkey ca-key.pem -CAcreateserial -out server-cert.pem -extfile server-ext.cnf

# 4. Generate client's private key and certificate signing request (CSR)
openssl req -newkey rsa:4096 -nodes -keyout client-key.pem -out client-req.pem -subj "/C=FR/ST=Alsace/L=Strasbourg/O=PC Client/OU=Computer/CN=Client/[email protected]"

# 5. Use CA's private key to sign client's CSR and get back the signed certificate
openssl x509 -req -in client-req.pem -days 60 -CA ca-cert.pem -CAkey ca-key.pem -CAcreateserial -out client-cert.pem
1 change: 1 addition & 0 deletions src/TLS/TokenValue.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bearer Token Shehab and Neal
34 changes: 34 additions & 0 deletions src/TLS/ca-cert.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
-----BEGIN CERTIFICATE-----
MIIF2TCCA8GgAwIBAgIUMS+szswcHFErLoEzUBoSFd+c8mQwDQYJKoZIhvcNAQEL
BQAwfDELMAkGA1UEBhMCRUcxEDAOBgNVBAgMB0NhaXJvRUcxDjAMBgNVBAcMBUNh
aXJvMQ0wCwYDVQQKDARHU29DMRAwDgYDVQQLDAdDZXJBdXRoMQ0wCwYDVQQDDARD
ZXJ0MRswGQYJKoZIhvcNAQkBFgxjYUBnbWFpbC5jb20wHhcNMjAwODIzMDMyNzAx
WhcNMjEwODIzMDMyNzAxWjB8MQswCQYDVQQGEwJFRzEQMA4GA1UECAwHQ2Fpcm9F
RzEOMAwGA1UEBwwFQ2Fpcm8xDTALBgNVBAoMBEdTb0MxEDAOBgNVBAsMB0NlckF1
dGgxDTALBgNVBAMMBENlcnQxGzAZBgkqhkiG9w0BCQEWDGNhQGdtYWlsLmNvbTCC
AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAN2jxex7Q7xQplF1sjsQcluD
4fiuyUVite0/P3x9YwwmYyH+9Kfgfr6XDFm73JGbu1yEkNpcsH0QoFNwuofWh8VV
v779qh2JDhgLHUmhFAeIfX2PRxKlne5WEYlavrRXOZfnXp6L9yWZGbJ5PT77yrd/
2m+HPYPTdbfeLvo953tXKBc+1sIuAYgTY7SgWB9HnCNSLl7prdyKP5gTLXZ2ZJG4
3ilG2+o6WC7y7HHVKJAlDCajm+haAOmfoiEcMMiD4ROTBeVpyGveVJYPkOokmAgt
ZJ829Vg3v8b35UWGoC31D6UsOVBU80tnjGGqKnAuolhGcThh8O+zySeMYGiEuCqc
NaSaf752cSC1ZmmxpuxPXpTpG+mbrK8VcoPV/2Aw268obUc/xij6F4fzsaynWpS4
rr60pcFGhvCoAJFHCrJpZubhUjCOLB4R2SR0ZPTWEjfelaTnUsdAK42i7clf9ey0
AUNdE4/7Wsg5P0CrWBMyUHN07TFwuPznIn/i0yLcYSOgmg3BBzoqFnxpWWd+AvHR
L3/Nr/ffqpWGSwbahpCbvAm600BjIpMCtmpvcW0ozkH2gT2R9Iq0lwgd/NtF2ntG
QkcJZBqbbzLOD+BxxDAQTy6O4cQ755jASFF7Y/VQysOj8uWEmEXikfthhFcbiZSZ
srrO6tz4RuBFCrYbHaWvAgMBAAGjUzBRMB0GA1UdDgQWBBTA6JHuSLi59H4MYX6r
dZ/Hdmbm9jAfBgNVHSMEGDAWgBTA6JHuSLi59H4MYX6rdZ/Hdmbm9jAPBgNVHRMB
Af8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4ICAQC77fpr71FiWe7foraaB/xbr5Ll
1wh5tg2HpuvZZC78GO4WYHmDInsG3KX3/W5Ojc3BjtQFyPWDE5Riwe0t5aM/EsOt
iYAuD6qtaDmB4slXTISGujRkutPYraPEXDpfE/NUuw6yfl05qU1pCYQYoiF6yXBh
Q9E65xHb1M1nLM2kebT6cxKhdyYrz/ivbSD9Z4j9t+wQSLKH1bRIjtSvIE0jOySA
SmpayhwrNcuyDZDW/FaQ/pjHrYscqPKIs1FMyHJdja+/TDrkRuugQAaFFVdiu2NM
yUm9rBdA/ota2HTDg8CLUbWcyxvuXgJ2VU/7RVC3aOPbqv1dR9LmcEhiQlbTSM7k
8HAmsfRjzKhQnGvYPQuwoaiSLxUx1WrQU6WOUP5bYV9Vdyp2xNFbxD893Ixsfwww
1mFh2ONrPThJk1uMYFBwfVRcdW4UyyG1XK56nkgyvcssY69TKV1IdXyXkJBOWCJ3
eSl217Qp5hinSMfZhCjA54uYFcEx5zDFuDF2FJ3N39Wcpunkw7Imz5JnEl+P3dhD
NYKUZD547zCpXJCQnQ5H5IxO4tgY2sUY5FfCWzUjE3EYOINQafH/DSJhHLkN1Gv3
YRVyBse1Fr3skdR3Y5IbaXz+mwlK5g3NdTcKLuDff8NbWJ7jyaKIampFPKQiOQ60
pcDFhM+qUu8DWVbsPw==
-----END CERTIFICATE-----
1 change: 1 addition & 0 deletions src/TLS/ca-cert.srl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7F33FEC39385275088DF073E9DBD3A32AE20FF1C
Loading