Skip to content

Instantly share code, notes, and snippets.

@cute
cute / dtls_api.md
Created August 21, 2020 09:23 — forked from Jxck/dtls_api.md
OpenSSL DTLS API

OpenSSL DTLS API

The API used for DTLS is mostly the same as for TLS, because of the mapping of generic functions to protocol specifc ones. Some additional functions are still necessary, because of the new BIO objects and the timer handling for handshake messages. The generic concept of the API is described in the following sections. Examples of applications using DTLS are available at [9].

DTLS の API は TLS とほぼ同じ。 BIO オブジェクトの生成とタイマのために追加でいくつか必要。

@cute
cute / ssl_server_nonblock.c
Created November 28, 2019 16:05 — forked from darrenjs/ssl_server_nonblock.c
OpenSSL example using memory BIO with non-blocking socket IO
/*
This file had now been added to the git repo
https://github.com/darrenjs/openssl_examples
... which also includes a non blocking client example.
-------------------------------------------------------------------------------
ssl_server_nonblock.c -- Copyright 2017 Darren Smith -- MIT license
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <netinet/tcp.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/socket.h>
int main(int argc, char **argv) {
int s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
@cute
cute / gencert.sh
Last active October 6, 2019 00:34
#!/bin/sh
# create self-signed server certificate:
read -p "Enter your domain [www.example.com]: " DOMAIN
echo "Create server key..."
openssl genrsa -aes256 -out $DOMAIN.key 4096
echo "Create server certificate signing request..."
@cute
cute / osx-openssh-portable.md
Created September 27, 2019 14:27 — forked from surjikal/macos-openssh-portable.sh
Compile OpenSSH Portable on OSX
brew install openssl

git clone git://anongit.mindrot.org/openssh.git
cd openssh

# ./configure script does not exist, so we have to build it
autoreconf

mkdir dist
安装zsh
brew install zsh
设置zsh为默认shell
mate /etc/shells
在文末增加:
/usr/local/bin/zsh
将zsh设置为默认的Shell:
@cute
cute / filer.js
Last active August 8, 2019 08:18
weibo intl launch screen ad filter
/*
* weibo intl launch screen ad filter
* @author Li Guangming
*
* add rule: DOMAIN,weibointl.api.weibo.com,DIRECT,script-filter
*
*/
function scriptFilterExecute(args) {
if (args.url.indexOf('get_coopen_ads') > 0) {
@cute
cute / nginx.conf
Created August 1, 2019 04:01 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@cute
cute / Apple_mobile_device_types.txt
Created June 19, 2019 01:01 — forked from adamawolf/Apple_mobile_device_types.txt
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
iPhone5,1 : iPhone 5 (GSM)
@cute
cute / openssl_commands.md
Created May 31, 2019 06:56 — forked from p3t3r67x0/openssl_commands.md
Some list of openssl commands for check and verify your keys

openssl

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl