锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲美日韩Av中文字幕无码久久久妻妇,久久夜色精品国产网站,嫩草影院久久国产精品http://m.shnenglu.com/tangxinfa/寮鍙戣呬箣鏃?/description>zh-cnSat, 12 Jul 2025 06:32:12 GMTSat, 12 Jul 2025 06:32:12 GMT60SSL鍙屾柟緋葷粺鏃墮棿涓嶄竴鑷村鑷寸殑SSL榪炴帴澶辮觸鍙婂叾瑙e喅鏂規(guī)http://m.shnenglu.com/tangxinfa/archive/2008/07/25/57164.html鍞愭柊鍙?/dc:creator>鍞愭柊鍙?/author>Fri, 25 Jul 2008 09:45:00 GMThttp://m.shnenglu.com/tangxinfa/archive/2008/07/25/57164.htmlhttp://m.shnenglu.com/tangxinfa/comments/57164.htmlhttp://m.shnenglu.com/tangxinfa/archive/2008/07/25/57164.html#Feedback0http://m.shnenglu.com/tangxinfa/comments/commentRss/57164.htmlhttp://m.shnenglu.com/tangxinfa/services/trackbacks/57164.html銆銆涓錛屽皢璇佷功鐨勬湁鏁堟湡璁懼緱澶熷ぇ錛氬錛?970-2099
銆銆銆榪欐牱浼拌鍙互鍦ㄤ竴瀹氱▼搴︿笂瑙e喅榪欎釜闂錛屼笉榪囪繖涔熸槸涓涓繪剰錛?br>銆銆浜岋紝媯嫻嬪強蹇呰鏃惰嚜鍔ㄥ悓姝ュ鎴風涓庢湇鍔″櫒鐨勬椂闂?br>銆銆閫氳繃鐢╳ireshake鎶撳寘鍒嗘瀽SSL寤虹珛榪炴帴鐨勮繃紼嬶紝鍙戠幇鍦⊿SL鎻℃墜榪囩▼涓紝浼氬悜瀵規(guī)柟浼犻佹湰鏈虹殑緋葷粺鏃墮棿錛庡洜姝や竴涓樉鑰屾槗瑙佺殑鍔炴硶灝辨槸鑾峰彇瀵規(guī)柟鐨勬椂闂達紝鐒跺悗鍦ㄥ繀瑕佹椂灝嗘湰鏈虹殑緋葷粺鏃墮棿鏀逛負瀵規(guī)柟鐨勭郴緇熸椂闂達紝澶辮觸鍚庡啀榪炰竴嬈★紟涓嬮潰鏄叿浣撶殑紺轟緥浠g爜錛?br>
#include <openssl/ssl.h>
#include 
<openssl/bio.h>
#include 
<openssl/err.h>
#include 
<winsock2.h>
#include 
<stdio.h>
#include 
<string.h>
#include 
<time.h>

typedef 
struct _TimeInfo
{
    time_t client;  
/*瀹㈡埛绔殑鏃墮棿*/
    time_t server;  
/*鏈嶅姟鍣ㄧ殑鏃墮棿*/
} TimeInfo;

/**
* 鍚屾緋葷粺鏃墮棿.
*/
BOOL syncSystemTime(time_t t)
{
    SYSTEMTIME st;
    FILETIME   ft;  
    LONGLONG   ll;  
    
    ll 
= Int32x32To64(t, 10000000+ 116444736000000000//1970.01.01  
    
    ft.dwLowDateTime  
= (DWORD)ll;  
    ft.dwHighDateTime 
= (DWORD)(ll >> 32);  
    
    
return FileTimeToSystemTime(&ft, &st) && SetSystemTime(&st);
}

/**
* 鑾峰彇SSL鎻℃墜榪囩▼涓湇鍔″櫒涓庡鎴風鍙屾柟鐨勭郴緇熸椂闂?
*/
void getSSLHandleShakeTimeInfo(int write_p,
                               
int version,
                               
int content_type,
                               
const unsigned char* buf,
                               size_t len,
                               SSL 
*ssl,
                               TimeInfo 
*ti)
{
    
if(content_type != 22)   //require handshake message
        return;
    
if(len < 42)
        
return;
    
if(buf[0== 1)          //ClientHello Message send from client to server
        ti->client = htonl(*((u_long*)(buf + 6)));
    
else if(buf[0== 2)     //ServerHello Message send from server to client
        ti->server = htonl(*((u_long*)(buf + 6)));
    
else
        
return;
}

int main()
{
    BIO 
* bio;
    SSL 
* ssl;
    SSL_CTX 
* ctx;
    TimeInfo timeInfo 
= {-1-1};
    BOOL timeSynced 
= FALSE;
    
long result;

    
/* Set up the library */
    SSL_library_init();
    ERR_load_BIO_strings();
    SSL_load_error_strings();

    
/* Set up the SSL context */
    ctx 
= SSL_CTX_new(SSLv3_client_method());
    
if(ctx == NULL)
    {
        fprintf(stderr, 
"Error new SSL_CTX\n");
        ERR_print_errors_fp(stderr);
        SSL_CTX_free(ctx);
        
return 0;
    }

    
/* Get Server and Client system time via SSL Handshake */
    SSL_CTX_set_msg_callback(ctx, getSSLHandleShakeTimeInfo);
    SSL_CTX_set_msg_callback_arg(ctx, 
&timeInfo);
    
    
/* Load the trust store */
    
if(! SSL_CTX_load_verify_locations(ctx, ".\\certs\\cacert.pem", NULL))
    {
        fprintf(stderr, 
"Error loading trust store\n");
        ERR_print_errors_fp(stderr);
        SSL_CTX_free(ctx);
        
return 0;
    }

    
/* Setup the connection */
    bio 
= BIO_new_ssl_connect(ctx);

    
/* Set the SSL_MODE_AUTO_RETRY flag */
    BIO_get_ssl(bio, 
& ssl);
    SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);

    
/* Create and setup the connection */
    BIO_set_conn_hostname(bio, 
"192.168.1.5:5555");
    
if(BIO_do_connect(bio) <= 0)
    {
        fprintf(stderr, 
"Error attempting to connect\n");
        ERR_print_errors_fp(stderr);
        BIO_free_all(bio);
        SSL_CTX_free(ctx);
        
return 0;
    }
    
    
/* Check the certificate */
    
switch(SSL_get_verify_result(ssl))
    {
    
case X509_V_OK:
        
break;
    
case X509_V_ERR_CERT_NOT_YET_VALID:
    
case X509_V_ERR_CERT_HAS_EXPIRED:
        
if(timeInfo.server != -1 && timeInfo.client != -1)
        {
            printf(
"褰撳墠瀹㈡埛绔椂闂? %s", ctime(&timeInfo.client));
            printf(
"褰撳墠鏈嶅姟鍣ㄦ椂闂? %s", ctime(&timeInfo.server));
            printf(
"灝濊瘯涓庢湇鍔″櫒鏃墮棿鍚屾");
            
            
if(syncSystemTime(timeInfo.server))
                printf(
"鎴愬姛\n");
            
else
                printf(
"澶辮觸\n");
            printf(
"璇烽噸璇曡繛鎺ユ湇鍔″櫒錛乗n");
        }
    
default:
        fprintf(stderr, 
"Certificate verification error: %i\n", SSL_get_verify_result(ssl));
        BIO_free_all(bio);
        SSL_CTX_free(ctx);
        
return 0;
    }

    
/* Close the connection and free the context */
    BIO_free_all(bio);
    SSL_CTX_free(ctx);
    
return 0;
}



]]>
emacs鐢ㄤ簬鍦╟/c++澶存枃浠朵腑鐢熸垚鍖呭惈淇濇姢澶達紙include guard錛夌殑lisp鍑芥暟http://m.shnenglu.com/tangxinfa/archive/2008/05/21/50705.html鍞愭柊鍙?/dc:creator>鍞愭柊鍙?/author>Wed, 21 May 2008 15:40:00 GMThttp://m.shnenglu.com/tangxinfa/archive/2008/05/21/50705.htmlhttp://m.shnenglu.com/tangxinfa/comments/50705.htmlhttp://m.shnenglu.com/tangxinfa/archive/2008/05/21/50705.html#Feedback4http://m.shnenglu.com/tangxinfa/comments/commentRss/50705.htmlhttp://m.shnenglu.com/tangxinfa/services/trackbacks/50705.html;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; c/c++ header include guard
(defun insert-include-guard ()
  "insert include guard for c and c++ header file.
for file filename.ext will generate:
#ifndef FILENAME_EXT_
#define FILENAME_EXT_

original buffer content

#endif//FILENAME_EXT_
"
  (interactive)
  (setq file-macro
    (concat (replace-regexp-in-string "\\." "_" (upcase (file-name-nondirectory buffer-file-name))) "_"))
  (setq guard-begin (concat "#ifndef " file-macro "\n"
                "#define " file-macro "\n\n"))
  (setq guard-end
    (concat "\n\n#endif//" file-macro "\n"))
  (setq position (point))
  (goto-char (point-min))
  (insert guard-begin)
  (goto-char (point-max))
  (insert guard-end)
  (goto-char (+ position (length guard-begin))))




]]>
久久久久久久综合日本| 久久人人爽人人爽人人片AV麻豆| 亚洲精品午夜国产VA久久成人| 尹人香蕉久久99天天拍| 久久精品无码专区免费青青| 亚洲国产精品婷婷久久| 久久99热这里只频精品6| av无码久久久久久不卡网站| 色偷偷88欧美精品久久久 | 久久亚洲欧美国产精品| 国内精品久久久久| 久久精品国产亚洲AV不卡| www亚洲欲色成人久久精品| 亚洲国产精品无码久久98| 国产农村妇女毛片精品久久| 精品免费久久久久久久| 亚洲欧洲中文日韩久久AV乱码| 国产精品美女久久久| 亚洲欧美日韩久久精品第一区| 欧美亚洲日本久久精品| 国产精品成人久久久久久久| 91精品国产色综合久久| 国产亚洲综合久久系列| 嫩草伊人久久精品少妇AV| 久久SE精品一区二区| 三级三级久久三级久久| 日产精品久久久久久久| 久久精品极品盛宴观看| 亚洲伊人久久成综合人影院| 天天综合久久一二三区| 久久亚洲国产成人影院网站| 人妻少妇精品久久| 亚洲欧洲精品成人久久奇米网| 久久久精品无码专区不卡| 国产午夜精品理论片久久| 久久久久久极精品久久久| 久久综合视频网| 性欧美大战久久久久久久久| 无码人妻精品一区二区三区久久久 | 欧美黑人激情性久久| 狠狠色丁香久久婷婷综合图片|