91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 8.31MB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2023-10-14
  • 語言: 其他
  • 標簽: 國嵌??Linux??

資源簡介

國嵌 Linux 項目專題3(安全文件傳輸)買板子送的

資源截圖

代碼片段和文件信息

#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?

#define?MAXBUF?1024

void?ShowCerts(SSL?*?ssl)
{
??X509?*cert;
??char?*line;

??cert?=?SSL_get_peer_certificate(ssl);
??if?(cert?!=?NULL)?{
????printf(“Digital?certificate?information:\n“);
????line?=?X509_NAME_oneline(X509_get_subject_name(cert)?0?0);
????printf(“Certificate:?%s\n“?line);
????free(line);
????line?=?X509_NAME_oneline(X509_get_issuer_name(cert)?0?0);
????printf(“Issuer:?%s\n“?line);
????free(line);
????X509_free(cert);
??}
??else
????printf(“No?certificate?information!\n“);
}

int?main(int?argc?char?**argv)
{
??int?ijsockfd?len?fd?size;
??char?fileName[50]sendFN[20];
??struct?sockaddr_in?dest;
??char?buffer[MAXBUF?+?1];
??SSL_CTX?*ctx;
??SSL?*ssl;

??if?(argc?!=?3)
??{
????printf(“Parameter?format?error!?Correct?usage?is?as?follows:\n\t\t%s?IP?Port\n\tSuch?as:\t%s?127.0.0.1?80\n“?argv[0]?argv[0]);?exit(0);
??}

??/*?SSL?庫初始化?*/
??SSL_library_init();
??OpenSSL_add_all_algorithms();
??SSL_load_error_strings();
??ctx?=?SSL_CTX_new(SSLv23_client_method());
??if?(ctx?==?NULL)
??{
????ERR_print_errors_fp(stdout);
????exit(1);
??}

??/*?創建一個?socket?用于?tcp?通信?*/
??if?((sockfd?=?socket(AF_INET?SOCK_STREAM?0))???{
????perror(“Socket“);
????exit(errno);
??}
??printf(“socket?created\n“);

??/*?初始化服務器端(對方)的地址和端口信息?*/
??bzero(&dest?sizeof(dest));
??dest.sin_family?=?AF_INET;
??dest.sin_port?=?htons(atoi(argv[2]));
??if?(inet_aton(argv[1]?(struct?in_addr?*)?&dest.sin_addr.s_addr)?==?0)
??{
????perror(argv[1]);
????exit(errno);
??}
??printf(“address?created\n“);

??/*?連接服務器?*/
??if?(connect(sockfd?(struct?sockaddr?*)?&dest?sizeof(dest))?!=?0)
??{
????perror(“Connect?“);
????exit(errno);
??}
??printf(“server?connected\n\n“);

??/*?基于?ctx?產生一個新的?SSL?*/
??ssl?=?SSL_new(ctx);
??SSL_set_fd(ssl?sockfd);
??/*?建立?SSL?連接?*/
??if?(SSL_connect(ssl)?==?-1)
????ERR_print_errors_fp(stderr);
??else
??{
????printf(“Connected?with?%s?encryption\n“?SSL_get_cipher(ssl));
????ShowCerts(ssl);
??}

??/*?接收用戶輸入的文件名,并打開文件?*/
??printf(“\nPlease?input?the?filename?of?you?want?to?load?:\n>“);
??scanf(“%s“fileName);
??if((fd?=?open(fileNameO_RDONLY0666))<0)
??{
????perror(“open:“);
????exit(1);
??}
????
??/*?將用戶輸入的文件名,去掉路徑信息后,發給服務器?*/
??for(i=0;i<=strlen(fileName);i++)
??{
????if(fileName[i]==‘/‘)
????{
??????j=0;
??????continue;
????}
????else?{sendFN[j]=fileName[i];++j;}
??}
??len?=?SSL_write(ssl?sendFN?strlen(sendFN));
??if?(len?????printf(“‘%s‘message?Send?failure?!Error?code?is?%d,Error?messages?are?‘%s‘\n“?buffer?errno?strerror(errno));

??/*?循環發送文件內容到服務器?*/
??bzero(buffer?MAXBUF?+?1);?
??while((size=read

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????2086131??2009-06-16?22:55??項目專題3(安全文件傳輸)\OpenSSL\代碼\庫\openssl-0.9.6.tar.gz

?????文件????3852259??2009-06-16?22:08??項目專題3(安全文件傳輸)\OpenSSL\代碼\庫\openssl-0.9.8k.tar.gz

?????文件???????1525??2010-02-27?11:00??項目專題3(安全文件傳輸)\OpenSSL\代碼\編程范例\cacert.pem

?????文件???????3607??2009-03-19?12:58??項目專題3(安全文件傳輸)\OpenSSL\代碼\編程范例\client.c

?????文件???????1675??2010-02-27?10:52??項目專題3(安全文件傳輸)\OpenSSL\代碼\編程范例\privkey.pem

?????文件???????4664??2009-03-20?11:55??項目專題3(安全文件傳輸)\OpenSSL\代碼\編程范例\server.c

?????文件??????32256??2009-03-20?16:08??項目專題3(安全文件傳輸)\OpenSSL\代碼\編程范例\范例說明.doc

?????文件?????533427??2009-06-09?10:31??項目專題3(安全文件傳輸)\OpenSSL\資料\openssl_program.chm

?????文件?????237056??2009-06-09?10:31??項目專題3(安全文件傳輸)\OpenSSL\資料\openssl中文簡介.doc

?????文件????1190527??2009-06-09?10:31??項目專題3(安全文件傳輸)\OpenSSL\資料\openssl編程.pdf

?????文件?????624810??2010-02-27?21:27??項目專題3(安全文件傳輸)\實驗手冊.pdf

?????文件???????5775??2009-09-20?21:03??項目專題3(安全文件傳輸)\線程池\編程范例\thread.c

?????文件??????59392??2010-02-27?11:51??項目專題3(安全文件傳輸)\線程池\資料\條件變量.doc

?????文件??????21504??2010-02-27?11:42??項目專題3(安全文件傳輸)\線程池\資料\線程池介紹.doc

?????文件??????16010??2010-02-27?12:16??項目專題3(安全文件傳輸)\項目代碼\客戶端\client.c

?????文件???????1851??2008-02-04?11:49??項目專題3(安全文件傳輸)\項目代碼\客戶端\client.h

?????文件?????????18??2009-09-17?13:04??項目專題3(安全文件傳輸)\項目代碼\服務器\admin.txt

?????文件???????1619??2009-03-16?19:39??項目專題3(安全文件傳輸)\項目代碼\服務器\cacert.pem

?????文件?????841109??2009-03-13?10:37??項目專題3(安全文件傳輸)\項目代碼\服務器\log.txt

?????文件??????????2??2009-06-18?20:38??項目專題3(安全文件傳輸)\項目代碼\服務器\maxclientnum.txt

?????文件???????1679??2009-03-16?19:38??項目專題3(安全文件傳輸)\項目代碼\服務器\privkey.pem

?????文件??????26119??2010-02-27?12:09??項目專題3(安全文件傳輸)\項目代碼\服務器\server.c

?????文件???????1126??2008-01-28?19:19??項目專題3(安全文件傳輸)\項目代碼\服務器\server.h

?????文件??????????0??2010-02-27?17:06??項目專題3(安全文件傳輸)\項目代碼\服務器\user.txt

?????文件?????189952??2008-12-01?13:56??項目專題3(安全文件傳輸)\項目文檔\文檔模版\XXX概要設計說明書.doc

?????文件??????66048??2009-07-07?16:29??項目專題3(安全文件傳輸)\項目文檔\文檔模版\XXX測試報告.doc

?????文件?????908800??2008-12-01?13:56??項目專題3(安全文件傳輸)\項目文檔\文檔模版\XXX詳細設計說明書.doc

?????文件??????68096??2009-07-07?16:27??項目專題3(安全文件傳輸)\項目文檔\文檔模版\XXX需求規格說明書.doc

?????文件??????69120??2009-03-13?14:07??項目專題3(安全文件傳輸)\項目文檔\概要設計.doc

?????文件?????264192??2010-02-27?12:27??項目專題3(安全文件傳輸)\項目文檔\詳細設計.doc

............此處省略18個文件信息

評論

共有 條評論