2017년 6월 19일 월요일

tls/dtls handshake


server                                                              client




helloRequest           ----------------->                   ClientHandshaker
                                                                     starthandshake
                                                                     ProtocolVersion
                                                                     clientRandom,                                                                                                  supportedClientCertificateTypes
                                                                     supportedServerCertificateTypes
                                                                     CompressionMethod
                                                                     clientHello
                    <------------------------------------     sendFlight(flight);


receivedClientHello
starthandshake  
negotiateProtocolVersion
서버 와 클라이언트 난수
세션생성후 세션 설정
세션에 압축 협상후 설정
클라이언트에서 제안한 암호화 선택
후 세션에 저장
세션에 데이터 조각 크기 지정

먼저 ServerHello (필수).
// 1) ServerHello                                                      receivedServerHello
ServerHello        -------------------------------------------> usedProtocol =                                                                                            message.getServerVersion();                                        serverRandom = message.getRandom();
                            session.setSessionIdentifier(message.getSessionId());
                            session.setCipherSuite(message.getCipherSuite());                             session.setCompressionMethod(                                                                           setSendRawPublicKey
                                            setReceiveRawPublicKey
                                                                                                       
                                                                                                           
                                                                                                           


// 2) CertificateMessage  -------------------------------> CertificateMessage
                                                                            receivedServerCertificate
Second, send Certificate
 (if required by key exchange algorithm)                                   검증                        

// 3) Server Key Exchange ------------------------------    receivedServerKeyExchange

                       message.verifySignature(serverPublicKey, clientRandom, serverRandom);
            The ServerKeyExchange message is sent by the server only when the server
CertificateMessage(if sent) does not contain enough data to
allow the client to exchange a premaster secret. Used when the key
  exchange is ECDH. The client tries to verify the server's signature and
 on success prepares the ECDH key agreement.                                                               
// 4) Certificate Request(옵션)------------------------------>







// 5) Server Hello Done(필수)                <    -->              receivedServerHelloDone  


                                               First, if required by server, send Certificate.                                                            Second, send ClientKeyExchange as specified by the                                          
                                               Third, send CertificateVerify message if necessary.
                                               Fourth, send ChangeCipherSpec
                                               Fifth, send the finished message.                                                                                                        
                                                                                                             
                                                                                                             
                                                                                                             

                                                                                                                                                                                                                           
                                                                                                             

                                                                                                             

                                                                                                             

                                                                                                             
                                                                                                             








                            





























































댓글 없음:

댓글 쓰기

nexacro 인터셉터 설정

    <dependency>       <groupId>com.fasterxml.jackson.core</groupId>   <artifactId>jackson-core</artifactId&...