流程图中用到的符号说明如下: m 未加密的原始数据(明文) c 加密后数据(密文) e 随机选取的加密密钥,与(p - 1)(q - 1)互素
(p、q 是两个大素数) n n=p*q dP p 的指数 dQ q 的指数 qInv 系数数据 流程图引用到源程序中的类型定义如下: typedef unsigned long int UINT4; typedef unsigned short int UINT2; typedef UINT4 NN_DIGIT; typedef UINT2 NN_HALF_DIGIT; typedef struct { unsigned int bits; /* length in bits of modulus */ unsigned char modulus[MAX_RSA_MODULUS_LEN]; /* modulus */ unsigned char exponent[MAX_RSA_MODULUS_LEN]; /* public exponent */ } R_RSA_PUBLIC_KEY; // 公钥 typedef struct { unsigned int bits; /* length in bits of modulus */ unsigned char modulus[MAX_RSA_MODULUS_LEN]; /* modulus */ unsigned char publicExponent[MAX_RSA_MODULUS_LEN]; /* public exponent */ unsigned char exponent[MAX_RSA_MODULUS_LEN]; /* private exponent */ unsigned char prime[2][MAX_RSA_PRIME_LEN]; /* prime fa