This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> $ openssl version | |
OpenSSL 1.0.1e-fips 11 Feb 2013 | |
> $ openssl ciphers -v | column -t | |
ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH Au=RSA Enc=AESGCM(256) Mac=AEAD | |
ECDHE-ECDSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH Au=ECDSA Enc=AESGCM(256) Mac=AEAD | |
ECDHE-RSA-AES256-SHA384 TLSv1.2 Kx=ECDH Au=RSA Enc=AES(256) Mac=SHA384 | |
ECDHE-ECDSA-AES256-SHA384 TLSv1.2 Kx=ECDH Au=ECDSA Enc=AES(256) Mac=SHA384 | |
ECDHE-RSA-AES256-SHA SSLv3 Kx=ECDH Au=RSA Enc=AES(256) Mac=SHA1 | |
ECDHE-ECDSA-AES256-SHA SSLv3 Kx=ECDH Au=ECDSA Enc=AES(256) Mac=SHA1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <netdb.h> | |
#include <arpa/inet.h> | |
#include <netinet/tcp.h> | |
#include <sys/socket.h> | |
#define BUFFERSIZE 2048 | |
int main(){ | |
int sockDesc = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <boost/asio.hpp> | |
#include <boost/exception/diagnostic_information.hpp> | |
#define BUFFERSIZE 2048 | |
using boost::asio::ip::udp; | |
int main(){ | |
boost::asio::io_service* io_service = nullptr; | |
boost::asio::ip::udp::socket* socket = nullptr; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC = g++ -c -g -Wall -I . | |
LINKER = g++ | |
PLATFORMLINK = -lstdc++ -lpthread -ldl -lssl | |
OBJFILES = ${patsubst %.cpp,%.o,${wildcard *.cpp)) | |
all:Program | |
%.o: $.cpp | |
$(CC) -o $@ $< |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void poller(int socketIn, std::string srcIP, int port){ | |
struct pollfd fds[2]; | |
// Initialize the fds to 0 | |
memset(fds, 0, sizeof(fds)); | |
// Wait in ms before poll times out. -1 for infinite | |
int timeout = 15000; | |
fds[0].fd = socketIn; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static struct sockaddr_in sa; | |
int listenCount = 0; | |
static const MAX_FD = 2048; | |
static struct pollfd listenFds[MAX_FD]; | |
int main(int argc, char** argv){ | |
int timeout = 15000; | |
listenPort(16000); | |
while(1){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int connect(const std::string &host, const int port, const int timeout){ | |
struct sockaddr_in sa = {0}; | |
int socket; | |
// Create and populate the connect address structure | |
sa.sin_family = AF_INET; | |
// The htons() function converts the unsigned short integer hostshort | |
// from host byte order to network byte order | |
// On the i80x86 the host byte order is least significant byte first, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Convert .pfx, .p12 to .pem | |
openssl pkcs12 -in a.pfx -out a.pem -nodes | |
# Convert .p7b to .pem | |
openssl pkcs7 -inform der -in a.p7b -out a.pem | |
# Remove passphrase | |
openssl rsa -in a.pem -out b.pem |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
client = yes | |
cert = /home/test/test.pem | |
debug = 7 | |
pid = /home/test/pid | |
output = /home/test/log | |
;output = /dev/stdout | |
fips = no | |
socket = r:TCP_NODELAY=1 | |
socket = l:TCP_NODELAY=1 | |
sslVersion = TLSv1.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2015.07.20 06:33:46 LOG6[2700:...]: Initializing service [prices] | |
2015.07.20 06:33:46 LOG7[2700:...]: Certificate: /home/test/test.pem | |
2015.07.20 06:33:46 LOG7[2700:...]: Certificate loaded | |
2015.07.20 06:33:46 LOG7[2700:...]: Key file: /home/test/test.pem | |
2015.07.20 06:33:46 LOG7[2700:...]: Private key loaded | |
2015.07.20 06:33:46 LOG7[2700:...]: SSL options set: 0x00000004 | |
2015.07.20 06:33:46 LOG5[2700:...]: Configuration successful | |
2015.07.20 06:33:46 LOG7[2700:...]: Service [barx_trades] (FD=12) bound to 0.0.0.0:8444 | |
2015.07.20 06:33:46 LOG7[2700:...]: Service [prices] (FD=13) bound to 0.0.0.0:8443 | |
2015.07.20 06:33:46 LOG7[2706:...]: Created pid file /home/test/pid |