PolarSSL

How calculate size of RSA cipher text using key size & clear text length?

拈花ヽ惹草 提交于 2019-12-18 13:14:20
问题 I've some clear text which I want to encrypt using RSA_PKCS_V21 (using PolarSSL library). The problem is that I need to know size of cipher text before executing the algorithm (for dynamic memory allocation purpose). I know RSA key size & clear text length. I also want to know the limitation on input clear text length. Any idea? 回答1: Just check the RSA PKCS#1 v2.1 standard, chapter 7.2: RSAES-PKCS1-V1_5-ENCRYPT ((n, e), M) Input: (n, e) recipient's RSA public key (k denotes the length in

makefile模板一

限于喜欢 提交于 2019-11-30 15:02:57
linux 下开发经常要编写makefile,记录下这些常用的模板,直接套用,简单方便 下面这个模板是编译linux环境,.c工程的makefile模板 工程链接: https://github.com/jorinzou/MQTT-TLS.git CC=gcc OBJ=Emqtt_client all:$(OBJ) HERE=./ SRC_INC=$(HERE)/src/ POLARSSL_INC=$(HERE)/lib/mbedtls-1.3.14/include/ incs=-I$(HERE) incs+=-I$(SRC_INC) incs+=-I$(POLARSSL_INC) POLARSSL_LIB_DIR=$(HERE)/lib/mbedtls-1.3.14/library/ SRC_DIR=$(HERE)/src/ #一次性包含某个目录下的所有.c文件 files:=$(foreach dir,$(SRC_DIR),$(wildcard $(SRC_DIR)/*.c)) files+=$(foreach dir,$(POLARSSL_LIB_DIR),$(wildcard $(POLARSSL_LIB_DIR)/*.c)) OBJS_C := $(patsubst %.c,%.o,$(files)) CFLAGS=-O0 -g CFLAGS+=$(incs)