(void) ERR_get_error(); } return p - first; } 需要解释下if (p < last && *data && (flags & ERR_TXT_STRING))这个分支。在阅读了相关代码后,我发现 OpenSSL 调用出错时,除了会往队列里面放入个错误,有时还有额外附赠一个err_data。这个err_data的实际类型,由对应的flags参数确定
int top, bottom;用于指明ERR_STATE的使用状态。 } 14.3 主要函数 a.ERR_add_error_data 在本层错误的err_data元素中添加说明信息。 b.ERR_clear_error 清除所有错误信息。如果不清楚所有错误信息,可能会有其他无关错误遗留在ERR_STATE表中 c.ERR_error_string / ERR_error_string_n 根据错误码获取具体的错误...
printf("error code: %lu in %s line %d.\n", code, file, line); if(data && (flags & ERR_TXT_STRING)) printf("error data: %s\n", data); code = ERR_get_error_line_data(&file, &line, &data, &flags); } } 2. 人类可读的错误消息 error handling package为其定义的error code提供标...
unsigned long err = ERR_get_error(); //获取错误号 char err_msg[1024] = { 0 }; ERR_error_string(ulErr, szErrMsg); // 格式:error:errId:库:函数:原因 printf("err msg: err:%ld, msg:%s\n", err , err_msg); BIO_free_all(keybio); return decrypt_text; } // 获取RSA单次处理的...
int error = RSA_generate_key_ex(publicKey, bits, bn, NULL); if (error != 1) { fprintf(stderr, "生成公钥时出错: %s\n", ERR_error_string(ERR_get_error(), NULL)); return 1; } error = RSA_generate_key_ex(privateKey, bits, bn, NULL); if (error != 1) { fprintf(stderr, ...
LOGE("rsa error string:%s/n", pTmp); //ERR_error_string_n(); break; } } RSA_free(pRSAPrivateKey); // free(out); free(enc_tmp); return result; } 二、公钥解密: //公钥解密 string utils_openssl::public_decrypt(unsigned char* enc_data, int data_len, unsigned char* key ) ...
return(SSL_ERROR_SSL); } So, as you can see, the only way that function can return 1 (SSL_ERROR_SSL) is if ERR_peek_error() returns a value != 0. However the error string you are getting back is what happens when you pass 0 as the error value toERR_error_string_n(). SoERR...
= 0) { perror("Connect "); exit(errno); } /*创建SSL*/ ssl = SSL_new(ctx); if (ssl == NULL) { printf("SSL_new error.\n"); } /*将fd添加到ssl层*/ SSL_set_fd(ssl, sockfd); if (SSL_connect(ssl) == -1) { printf("SSL_connect fail.\n"); ERR_print_errors_fp(std...
= nil { fmt.Println(err.Error()) continue } else {//go handleConnection_smtp(conn);//取消这个注释就能回应 } }//for}///smtpfunc handleConnection_smtp(conn net.Conn) { defer fmt.Println("handleConnection_smtp conn.Close"); defer conn.Close(); writer := bufio...
("Error: cannot create SSL_CTX.\n"); ERR_print_errors_fp(stderr); return -1; } /* set our supported ciphers */ r = SSL_CTX_set_cipher_list(k->ctx, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); if(r != 1) { printf("Error: cannot set the cipher list.\n"); ERR_print_...