SSL Verison3
- 格式:pdf
- 大小:97.60 KB
- 文档页数:67
使用Fiddle访问页面err_ssl_version_or_cipher_mismatch解决思路使用Fiddle访问页面err_ssl_version_or_cipher_mismatch解决思路err_ssl_version_or_cipher_mismatch错误意味着客户端与服务器之间的SSL协议版本或加密套件不匹配,导致无法建立安全连接。
要解决此问题,可以采取以下步骤:1.更新浏览器版本:首先,确保你使用的是最新版本的浏览器。
新版本的浏览器通常支持更多的SSL协议版本和加密套件。
2. 检查系统时间和日期:检查你的计算机的日期和时间设置是否正确。
如果日期和时间设置不正确,SSL证书的有效性将无法验证,可能会导致err_ssl_version_or_cipher_mismatch错误。
3.禁用SSL/TLS版本:如果你的浏览器支持多个SSL/TLS版本,尝试禁用一些较旧的版本。
这样可以限制浏览器尝试使用的版本,从而减少与服务器之间的协议不匹配问题。
-在栏中“TLS”或“SSL”,找到相关的选项。
-将不需要的SSL/TLS版本禁用,然后重新启动浏览器。
4. 清除浏览器缓存:有时,浏览器缓存可能导致SSL连接出错。
尝试清除浏览器缓存,并重新加载页面。
在Chrome浏览器中,可以按Ctrl + Shift + Delete键打开清除浏览数据对话框。
5. 检查防火墙设置:一些防火墙设置可能会阻止SSL连接。
如果你遇到err_ssl_version_or_cipher_mismatch错误,请检查你的防火墙设置,并确保SSL通信未被阻止。
6.重新启动网络设备:有时,网络设备(例如路由器或调制解调器)可能出现故障,导致SSL连接失败。
尝试将这些设备关机并重新启动,然后再次尝试访问站点。
7. 通过Fiddle进行调试:Fiddle是一个用于调试和监视HTTP流量的工具。
使用Fiddle,你可以查看更详细的SSL握手过程,帮助你找到问题的根本原因。
SSL3.0是SSL(安全套接字层)协议的第三个版本。
该协议位于TCP/IP 协议与各种应用层协议之间,为数据通讯提供安全支持。
SSL协议可分为两层:SSL记录协议(SSL Record Protocol):它建立在可靠的传输协议(如TCP)之上,为高层协议提供数据封装、压缩、加密等基本功能的支持。
SSL握手协议(SSL Handshake Protocol):它建立在SSL 记录协议之上,用于在实际的数据传输开始前,通讯双方进行身份认证、协商加密算法、交换加密密钥等。
然而,随着时间的推移,SSL3.0也被证明是不安全的,因此对于使用SSL3.0的网站,很多浏览器都已停止支持,建议网站尽快升级至更加安全的TLS协议。
1.简介:POP3S协议是一种安全的邮件接收协议,它在POP3协议的基础上添加了SSL/TLS加密保护。
POP3S(Secure POP3)协议是一种用于安全地接收电子邮件的协议。
它是在POP3(Post Office Protocol version 3)协议的基础上添加了SSL/TLS(Secure Sockets Layer/Transport Layer Security)加密保护机制。
POP3S 协议的引入使得邮件传输过程更加安全,保护了用户的隐私和邮件内容的机密性。
POP3S协议的工作原理与传统的POP3协议类似,但在数据传输过程中引入了SSL/TLS加密层。
SSL/TLS是一种常用的加密协议,它通过使用密钥对邮件进行加密和解密,确保邮件在传输过程中不会被窃听或篡改。
使用POP3S协议的优势在于它提供了对邮件接收过程的端到端的安全保护。
通过SSL/TLS加密,POP3S协议防止了恶意用户或黑客截取邮件内容或登录凭据。
这种加密保护机制还可以防止邮件被篡改或伪装,确保邮件的完整性和真实性。
为了使用POP3S协议,用户需要在邮件客户端和邮件服务器中进行相应的配置。
通常,需要获取邮件服务器的SSL/TLS证书,并将其导入到邮件客户端中。
这样,客户端和服务器之间的通信就可以建立安全的加密连接,保护邮件的传输过程。
总之,POP3S协议通过添加SSL/TLS加密保护,提供了一种安全的方式来接收电子邮件。
它保护了邮件传输过程中的机密性和完整性,为用户提供了更高的安全性保障。
2.工作原理:POP3S协议使用SSL/TLS协议对邮件传输进行加密,确保邮件在传输过程中的机密性和完整性。
POP3S协议是通过使用SSL/TLS协议对邮件传输进行加密,以确保邮件在传输过程中的机密性和完整性。
SSL/TLS (Secure Sockets Layer/Transport Layer Security)是一种常用的加密协议,广泛应用于保护网络通信的安全性。
openssl3 手册摘要:1.OpenSSL3 简介2.OpenSSL3 的安装与配置3.OpenSSL3 的功能与应用4.OpenSSL3 的安全性5.OpenSSL3 的未来发展正文:【OpenSSL3 简介】OpenSSL3 是一个强大的安全套接字层(SSL)库,用于加密网络通信。
它是OpenSSL2 的升级版本,提供了许多改进和新功能。
OpenSSL3 提供了广泛的加密和签名算法,支持各种安全协议,如TLS、SSL、DTLS 等。
它广泛应用于Web 服务器、客户端应用程序和各种网络设备中,保障网络通信的安全性。
【OpenSSL3 的安装与配置】安装OpenSSL3 非常简单,只需从官方网站下载源代码并按照官方文档进行编译和安装即可。
安装完成后,需要对OpenSSL3 进行配置,包括设置加密算法、证书、密钥等。
配置过程可以通过命令行工具或编译时选项完成。
【OpenSSL3 的功能与应用】OpenSSL3 提供了许多功能,包括加密、签名、哈希等。
它可以用于保护网络通信、数字签名文件、加密文件等。
OpenSSL3 还支持各种安全协议,如TLS、SSL、DTLS 等,可以满足各种应用场景的需求。
【OpenSSL3 的安全性】OpenSSL3 非常注重安全性,采用了多种措施来保障通信的安全性。
它支持多种加密算法,如AES、RSA、ECC 等,可以根据需求选择合适的加密算法。
此外,OpenSSL3 还支持证书验证、密钥交换、哈希函数等,可以有效防止各种攻击。
【OpenSSL3 的未来发展】随着网络通信的不断发展,OpenSSL3 将继续完善和升级,以适应新的需求。
未来,OpenSSL3 可能会引入更多的加密算法、支持更多的安全协议,并继续提高安全性能。
同时,OpenSSL3 还将加强与其他安全技术的集成,如IPsec、TLS 等,以提供更全面的安全解决方案。
总之,OpenSSL3 是一个重要的安全库,用于加密网络通信。
基于OpenSSL的SM2与RSA自动切换算法的设计贾冀芳;张立新;廖明耀【摘要】为了SSL/TLS协议的安全性与性能能同时满足用户的需求,基于国家商用密码算法(国密算法)的安全性强于通用密码算法、性能弱于通用密码算法的现状,在OpenSSL基础上设计一种SM2与RSA自动切换的算法以满足在性能达标的前提下提高系统的安全性.SSL/TLS握手协议在性能满足需求的前提下,优先使用国密SM2算法,当每秒新建连接数达到一定峰值时,SM2的性能满足不了需求,则系统自动切换到RSA算法,满足更高每秒新建连接数的性能需求.该算法在OpenSSL的数据结构和函数上进行扩展,经过测试实现了在每秒新建SSL/TLS连接数达到一定数值时,SM2算法与RSA算法的自动切换.该算法在满足性能需求的前提下能有效提高系统的安全性.%Based on observation that security of national commercial cipher algorithms(national cipher algorithms)is stronger than general cipher algorithms, and the performance is weaker than general cipher algorithms, an automatic switching algorithm between SM2 and RSA based on OpenSSL is designed in order to improve system security under the premise of performance standards. SSL/TLS handshake protocol is given the priority to use SM2 algorithm, before new connections per second reaches a certain peak. When the new connection rate of SM2 can not meet the demand, the system automatically switches to the RSA algorithm to reach the higher rate. The algorithm is extended on the data structure and function of OpenSSL. The experimental results show that the SM2 algorithm and RSA algorithm can be switched automat-ically when the new SSL/TLS connection rate reaches a certain value. The algorithmcan effectively improve the system security under the premise of meeting the performance requirements.【期刊名称】《计算机工程与应用》【年(卷),期】2018(054)003【总页数】8页(P74-81)【关键词】SSL/TLS协议;SM2算法;RSA算法;自动切换算法;OpenSSL【作者】贾冀芳;张立新;廖明耀【作者单位】北京中电普华信息技术有限公司研发事业部,北京 100192;北京中电普华信息技术有限公司研发事业部,北京 100192;北京中电普华信息技术有限公司研发事业部,北京 100192【正文语种】中文【中图分类】TP301.61 引言我国政府高度重视密码算法国产化升级改造工作[1]。
通过JSP在SSL连接中读取数字证书一、概述数字证书是一个经证书授权中心数字签名的包含公开密钥拥有者信息和公开密钥的文件。
最简单的证书包含一个公开密钥、名称以及证书授权中心的数字签名。
一般情况下证书中还包括密钥的有效时间,发证机关(证书授权中心)的名称,该证书的序列号等信息,证书的格式遵循ITUT X.509国际标准。
二、证书的格式X.509目前有三个版本:V1、V2和V3。
X.509 V1和V2证书所包含的主要内容如下:●证书版本号(Version):版本号指明X.509证书的格式版本,现在的值可以为0、1、2,也为将来的版本进行了预定义。
●证书序列号(SerialNumber):序列号指定由CA分配给证书的唯一的数字型标识符。
当证书被取消时,实际上是将此证书的序列号放入由CA签发的CRL中,这也是序列号唯一的原因。
●签名算法标识符(Signature):签名算法标识用来指定由CA签发证书时所使用的签名算法。
算法标识符用来指定CA签发证书时所使用的公开密钥算法和hash算法,须向国际知名标准组织(如ISO)注册。
●签发机构名(Issuer):此域用来标识签发证书的CA的X.500 DN名字。
包括国家、省市、地区、组织机构、单位部门和通用名。
●有效期(Validity):指定证书的有效期,包括证书开始生效的日期和时间以及失效的日期和时间。
每次使用证书时,需要检查证书是否在有效期内。
●证书用户名(Subject):指定证书持有者的X.500唯一名字。
包括国家、省市、地区、组织机构、单位部门和通用名,还可包含email地址等个人信息等●证书持有者公开密钥信息(subjectPublicKeyInfo):证书持有者公开密钥信息域包含两个重要信息:证书持有者的公开密钥的值;公开密钥使用的算法标识符。
此标识符包含公开密钥算法和hash算法。
●签发者唯一标识符(Issuer Unique Identifier):签发者唯一标识符在第2版加入证书定义中。
关于SSL V3 Protocol存在高危漏洞处理措施10月15日披露的SSL V3协议存在的一个可导致信息泄露的高危漏洞(CNVD-2014-06718,对应CVE-2014-3566)。
攻击者用来发起远程攻击,窃取采用了sslv3加密通信过程中的内容,构成信息泄露安全风险,目前厂商暂时没有提供升级补丁。
1.漏洞情况分析SSL V3是一项传输层安全协议,主要用于网站、邮件服务器等相关应用服务的网络安全传输。
近日,SSL V3协议被披露存在安全漏洞,攻击者可以利用此漏洞发起中间人欺骗攻击,当通信两端的用户主机均使用SSL V3进行安全传输时,可发起攻击窃取敏感信息。
SSL V3协议最早启用于1996年,目前已被TLS 1.0,TLS 1.1,TLS 1.2等高级协议代替,同时由于兼容性原因,大多数的TLS 协议实现兼容SSL V3。
用户浏览器在与服务器端的TLS握手阶段进行版本协商的时候,首先提供其所支持协议的最新版本,若该握手失败,则尝试以较旧的协议版本协商,即降级协商。
根据分析,受漏洞影响的除了SSL V3本身外,还包括采用TLS 1.0和TLS 1.2等协议组件的客户端产品。
CNVD对该漏洞的综合评级为“高危”。
漏洞存在于SSL V3的CBC块加密漏洞,攻击者可成功破解SSL连接的加密信息。
进一步分析表明,攻击者很有可能会通过控制客户端和服务器之间的数据通信,使受影响版本浏览器与服务器端使用较新协议的协商建立失败,从而导致直接应用SSL V3的降级通信协商,达成攻击条件。
2.漏洞处置建议1、软件生产厂商暂时没有提供升级补丁,同时请关注集团信息管理部以及厂商官网一旦发布补丁,请立即更新。
2、建议用户先检测使用软件是否支持SSLV3协议,并配置服务器暂时不支持sslv3协议,具体如下所示。
3.紧急处理方式目前解决该问题可以禁用SSL3.0,或者SSL3.0中使用的CBC模式加密,但是有可能造成兼容性问题。
Internet Engineering Task Force (IETF) A. Freier Request for Comments: 6101 P. Karlton Category: Historic Netscape Communications ISSN: 2070-1721 P. Kocher Independent Consultant August 2011 The Secure Sockets Layer (SSL) Protocol Version 3.0AbstractThis document is published as a historical record of the SSL 3.0protocol. The original Abstract follows.This document specifies version 3.0 of the Secure Sockets Layer (SSL 3.0) protocol, a security protocol that provides communicationsprivacy over the Internet. The protocol allows client/serverapplications to communicate in a way that is designed to preventeavesdropping, tampering, or message forgery.ForewordAlthough the SSL 3.0 protocol is a widely implemented protocol, apioneer in secure communications protocols, and the basis forTransport Layer Security (TLS), it was never formally published bythe IETF, except in several expired Internet-Drafts. This allowed no easy referencing to the protocol. We believe a stable reference tothe original document should exist and for that reason, this document describes what is known as the last published version of the SSL 3.0 protocol, that is, the November 18, 1996, version of the protocol.There were no changes to the original document other than trivialeditorial changes and the addition of a "Security Considerations"section. However, portions of the original document that no longerapply were not included. Such as the "Patent Statement" section, the "Reserved Ports Assignment" section, and the cipher-suite registrator note in the "The CipherSuite" section. The "US export rules"discussed in the document do not apply today but are kept intact toprovide context for decisions taken in protocol design. The "Goalsof This Document" section indicates the goals for adopters of SSL3.0, not goals of the IETF.The authors and editors were retained as in the original document.The editor of this document is Nikos Mavrogiannopoulos(nikos.mavrogiannopoulos@esat.kuleuven.be). The editor would like to thank Dan Harkins, Linda Dunbar, Sean Turner, and Geoffrey Keatingfor reviewing this document and providing helpful comments.Freier, et al. Historic [Page 1]Status of This MemoThis document is not an Internet Standards Track specification; it is published for the historical record.This document defines a Historic Document for the Internet community. This document is a product of the Internet Engineering Task Force(IETF). It represents the consensus of the IETF community. It hasreceived public review and has been approved for publication by theInternet Engineering Steering Group (IESG). Not all documentsapproved by the IESG are a candidate for any level of InternetStandard; see Section 2 of RFC 5741.Information about the current status of this document, any errata,and how to provide feedback on it may be obtained at/info/rfc6101.Copyright NoticeCopyright (c) 2011 IETF Trust and the persons identified as thedocument authors. All rights reserved.This document is subject to BCP 78 and the IETF Trust’s LegalProvisions Relating to IETF Documents(/license-info) in effect on the date ofpublication of this document. Please review these documentscarefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e ofthe Trust Legal Provisions and are provided without warranty asdescribed in the Simplified BSD License.This document may contain material from IETF Documents or IETFContributions published or made publicly available before November10, 2008. The person(s) controlling the copyright in some of thismaterial may not have granted the IETF Trust the right to allowmodifications of such material outside the IETF Standards Process.Without obtaining an adequate license from the person(s) controlling the copyright in such materials, this document may not be modifiedoutside the IETF Standards Process, and derivative works of it maynot be created outside the IETF Standards Process, except to formatit for publication as an RFC or to translate it into languages other than English.Freier, et al. Historic [Page 2]Table of Contents1. Introduction (5)2. Goals (5)3. Goals of This Document (6)4. Presentation Language (6)4.1. Basic Block Size (7)4.2. Miscellaneous (7)4.3. Vectors (7)4.4. Numbers (8)4.5. Enumerateds (8)4.6. Constructed Types (9)4.6.1. Variants (10)4.7. Cryptographic Attributes (11)4.8. Constants (12)5. SSL Protocol (12)5.1. Session and Connection States (12)5.2. Record Layer (14)5.2.1. Fragmentation (14)5.2.2. Record Compression and Decompression (15)5.2.3. Record Payload Protection and the CipherSpec (16)5.3. Change Cipher Spec Protocol (18)5.4. Alert Protocol (18)5.4.1. Closure Alerts (19)5.4.2. Error Alerts (20)5.5. Handshake Protocol Overview (21)5.6. Handshake Protocol (23)5.6.1. Hello messages (24)5.6.2. Server Certificate (28)5.6.3. Server Key Exchange Message (28)5.6.4. Certificate Request (30)5.6.5. Server Hello Done (31)5.6.6. Client Certificate (31)5.6.7. Client Key Exchange Message (31)5.6.8. Certificate Verify (34)5.6.9. Finished (35)5.7. Application Data Protocol (36)6. Cryptographic Computations (36)6.1. Asymmetric Cryptographic Computations (36)6.1.1. RSA (36)6.1.2. Diffie-Hellman (37)6.1.3. FORTEZZA (37)6.2. Symmetric Cryptographic Calculations and the CipherSpec (37)6.2.1. The Master Secret (37)6.2.2. Converting the Master Secret into Keys andMAC Secrets (37)7. Security Considerations (39)8. Informative References (40)Freier, et al. Historic [Page 3]Appendix A. Protocol Constant Values (42)A.1. Record Layer (42)A.2. Change Cipher Specs Message (43)A.3. Alert Messages (43)A.4. Handshake Protocol (44)A.4.1. Hello Messages (44)A.4.2. Server Authentication and Key Exchange Messages (45)A.5. Client Authentication and Key Exchange Messages (46)A.5.1. Handshake Finalization Message (47)A.6. The CipherSuite (47)A.7. The CipherSpec (49)Appendix B. Glossary (50)Appendix C. CipherSuite Definitions (53)Appendix D. Implementation Notes (56)D.1. Temporary RSA Keys (56)D.2. Random Number Generation and Seeding (56)D.3. Certificates and Authentication (57)D.4. CipherSuites (57)D.5. FORTEZZA (57)D.5.1. Notes on Use of FORTEZZA Hardware (57)D.5.2. FORTEZZA Cipher Suites (58)D.5.3. FORTEZZA Session Resumption (58)Appendix E. Version 2.0 Backward Compatibility (59)E.1. Version 2 Client Hello (59)E.2. Avoiding Man-in-the-Middle Version Rollback (61)Appendix F. Security Analysis (61)F.1. Handshake Protocol (61)F.1.1. Authentication and Key Exchange (61)F.1.2. Version Rollback Attacks (64)F.1.3. Detecting Attacks against the Handshake Protocol (64)F.1.4. Resuming Sessions (65)F.1.5. MD5 and SHA (65)F.2. Protecting Application Data (65)F.3. Final Notes (66)Appendix G. Acknowledgements (66)G.1. Other Contributors (66)G.2. Early Reviewers (67)Freier, et al. Historic [Page 4]1. IntroductionThe primary goal of the SSL protocol is to provide privacy andreliability between two communicating applications. The protocol is composed of two layers. At the lowest level, layered on top of some reliable transport protocol (e.g., TCP [RFC0793]), is the SSL record protocol. The SSL record protocol is used for encapsulation ofvarious higher level protocols. One such encapsulated protocol, the SSL handshake protocol, allows the server and client to authenticate each other and to negotiate an encryption algorithm and cryptographic keys before the application protocol transmits or receives its first byte of data. One advantage of SSL is that it is applicationprotocol independent. A higher level protocol can layer on top ofthe SSL protocol transparently. The SSL protocol provides connection security that has three basic properties:o The connection is private. Encryption is used after an initialhandshake to define a secret key. Symmetric cryptography is used for data encryption (e.g., DES [DES], 3DES [3DES], RC4 [SCH]).o The peer’s identity can be authenticated using asymmetric, orpublic key, cryptography (e.g., RSA [RSA], DSS [DSS]).o The connection is reliable. Message transport includes a message integrity check using a keyed Message Authentication Code (MAC)[RFC2104]. Secure hash functions (e.g., SHA, MD5) are used forMAC computations.2. GoalsThe goals of SSL protocol version 3.0, in order of their priority,are:1. Cryptographic securitySSL should be used to establish a secure connection betweentwo parties.2. InteroperabilityIndependent programmers should be able to develop applications utilizing SSL 3.0 that will then be able to successfullyexchange cryptographic parameters without knowledge of oneanother’s code.Freier, et al. Historic [Page 5]Note: It is not the case that all instances of SSL (even inthe same application domain) will be able to successfullyconnect. For instance, if the server supports a particularhardware token, and the client does not have access to such a token, then the connection will not succeed.3. ExtensibilitySSL seeks to provide a framework into which new public key and bulk encryption methods can be incorporated as necessary.This will also accomplish two sub-goals: to prevent the needto create a new protocol (and risking the introduction ofpossible new weaknesses) and to avoid the need to implement an entire new security library.4. Relative efficiencyCryptographic operations tend to be highly CPU intensive,particularly public key operations. For this reason, the SSL protocol has incorporated an optional session caching schemeto reduce the number of connections that need to beestablished from scratch. Additionally, care has been takento reduce network activity.3. Goals of This DocumentThe SSL protocol version 3.0 specification is intended primarily for readers who will be implementing the protocol and those doingcryptographic analysis of it. The spec has been written with this in mind, and it is intended to reflect the needs of those two groups.For that reason, many of the algorithm-dependent data structures and rules are included in the body of the text (as opposed to in anappendix), providing easier access to them.This document is not intended to supply any details of servicedefinition or interface definition, although it does cover selectareas of policy as they are required for the maintenance of solidsecurity.4. Presentation LanguageThis document deals with the formatting of data in an externalrepresentation. The following very basic and somewhat casuallydefined presentation syntax will be used. The syntax draws fromseveral sources in its structure. Although it resembles theprogramming language "C" in its syntax and External DataRepresentation (XDR) [RFC1832] in both its syntax and intent, it Freier, et al. Historic [Page 6]would be risky to draw too many parallels. The purpose of thispresentation language is to document SSL only, not to have generalapplication beyond that particular goal.4.1. Basic Block SizeThe representation of all data items is explicitly specified. Thebasic data block size is one byte (i.e., 8 bits). Multiple byte data items are concatenations of bytes, from left to right, from top tobottom. From the byte stream, a multi-byte item (a numeric in theexample) is formed (using C notation) by:value = (byte[0] << 8*(n-1)) | (byte[1] << 8*(n-2)) | ...| byte[n-1];This byte ordering for multi-byte values is the commonplace networkbyte order or big-endian format.4.2. MiscellaneousComments begin with "/*" and end with "*/". Optional components are denoted by enclosing them in "[[ ]]" double brackets. Single-byteentities containing uninterpreted data are of type opaque.4.3. VectorsA vector (single dimensioned array) is a stream of homogeneous dataelements. The size of the vector may be specified at documentationtime or left unspecified until runtime. In either case, the lengthdeclares the number of bytes, not the number of elements, in thevector. The syntax for specifying a new type T’ that is a fixed-length vector of type T isT T’[n];Here, T’ occupies n bytes in the data stream, where n is a multipleof the size of T. The length of the vector is not included in theencoded stream.In the following example, Datum is defined to be three consecutivebytes that the protocol does not interpret, while Data is threeconsecutive Datum, consuming a total of nine bytes.opaque Datum[3]; /* three uninterpreted bytes */Datum Data[9]; /* 3 consecutive 3 byte vectors */Freier, et al. Historic [Page 7]Variable-length vectors are defined by specifying a subrange of legal lengths, inclusively, using the notation <floor..ceiling>. Whenencoded, the actual length precedes the vector’s contents in the byte stream. The length will be in the form of a number consuming as many bytes as required to hold the vector’s specified maximum (ceiling)length. A variable-length vector with an actual length field of zero is referred to as an empty vector.T T’<floor..ceiling>;In the following example, mandatory is a vector that must containbetween 300 and 400 bytes of type opaque. It can never be empty.The actual length field consumes two bytes, a uint16, sufficient torepresent the value 400 (see Section 4.4). On the other hand, longer can represent up to 800 bytes of data, or 400 uint16 elements, and it may be empty. Its encoding will include a two-byte actual lengthfield prepended to the vector.opaque mandatory<300..400>;/* length field is 2 bytes, cannot be empty */uint16 longer<0..800>;/* zero to 400 16-bit unsigned integers */4.4. NumbersThe basic numeric data type is an unsigned byte (uint8). All larger numeric data types are formed from fixed-length series of bytesconcatenated as described in Section 4.1 and are also unsigned. The following numeric types are predefined.uint8 uint16[2];uint8 uint24[3];uint8 uint32[4];uint8 uint64[8];4.5. EnumeratedsAn additional sparse data type is available called enum. A field of type enum can only assume the values declared in the definition.Each definition is a different type. Only enumerateds of the sametype may be assigned or compared. Every element of an enumeratedmust be assigned a value, as demonstrated in the following example.Since the elements of the enumerated are not ordered, they can beassigned any unique value, in any order.enum { e1(v1), e2(v2), ... , en(vn), [[(n)]] } Te;Freier, et al. Historic [Page 8]Enumerateds occupy as much space in the byte stream as would itsmaximal defined ordinal value. The following definition would cause one byte to be used to carry fields of type Color.enum { red(3), blue(5), white(7) } Color;Optionally, one may specify a value without its associated tag toforce the width definition without defining a superfluous element.In the following example, Taste will consume two bytes in the datastream but can only assume the values 1, 2, or 4.enum { sweet(1), sour(2), bitter(4), (32000) } Taste;The names of the elements of an enumeration are scoped within thedefined type. In the first example, a fully qualified reference tothe second element of the enumeration would be Color.blue. Suchqualification is not required if the target of the assignment is well specified.Color color = Color.blue; /* overspecified, legal */Color color = blue; /* correct, type implicit */For enumerateds that are never converted to external representation, the numerical information may be omitted.enum { low, medium, high } Amount;4.6. Constructed TypesStructure types may be constructed from primitive types forconvenience. Each specification declares a new, unique type. Thesyntax for definition is much like that of C.struct {T1 f1;T2 f2;...Tn fn;} [[T]];The fields within a structure may be qualified using the type’s name using a syntax much like that available for enumerateds. Forexample, T.f2 refers to the second field of the previous declaration. Structure definitions may be embedded.Freier, et al. Historic [Page 9]4.6.1. VariantsDefined structures may have variants based on some knowledge that is available within the environment. The selector must be an enumerated type that defines the possible variants the structure defines. There must be a case arm for every element of the enumeration declared inthe select. The body of the variant structure may be given a labelfor reference. The mechanism by which the variant is selected atruntime is not prescribed by the presentation language.struct {T1 f1;T2 f2;....Tn fn;select (E) {case e1: Te1;case e2: Te2;....case en: Ten;} [[fv]];} [[Tv]];For example,enum { apple, orange } VariantTag;struct {uint16 number;opaque string<0..10>; /* variable length */} V1;struct {uint32 number;opaque string[10]; /* fixed length */} V2;struct {select (VariantTag) { /* value of selector is implicit */case apple: V1; /* VariantBody, tag = apple */case orange: V2; /* VariantBody, tag = orange */} variant_body; /* optional label on variant */} VariantRecord;Freier, et al. Historic [Page 10]Variant structures may be qualified (narrowed) by specifying a value for the selector prior to the type. For example, anorange VariantRecordis a narrowed type of a VariantRecord containing a variant_body oftype V2.4.7. Cryptographic AttributesThe four cryptographic operations digital signing, stream cipherencryption, block cipher encryption, and public key encryption aredesignated digitally-signed, stream-ciphered, block-ciphered, andpublic-key-encrypted, respectively. A field’s cryptographicprocessing is specified by prepending an appropriate key worddesignation before the field’s type specification. Cryptographickeys are implied by the current session state (see Section 5.1).In digital signing, one-way hash functions are used as input for asigning algorithm. In RSA signing, a 36-byte structure of two hashes (one SHA and one MD5) is signed (encrypted with the private key). In DSS, the 20 bytes of the SHA hash are run directly through theDigital Signature Algorithm with no additional hashing.In stream cipher encryption, the plaintext is exclusive-ORed with an identical amount of output generated from a cryptographically secure keyed pseudorandom number generator.In block cipher encryption, every block of plaintext encrypts to ablock of ciphertext. Because it is unlikely that the plaintext(whatever data is to be sent) will break neatly into the necessaryblock size (usually 64 bits), it is necessary to pad out the end ofshort blocks with some regular pattern, usually all zeroes.In public key encryption, one-way functions with secret "trapdoors"are used to encrypt the outgoing data. Data encrypted with thepublic key of a given key pair can only be decrypted with the private key, and vice versa. In the following example:stream-ciphered struct {uint8 field1;uint8 field2;digitally-signed opaque hash[20];} UserType;The contents of hash are used as input for the signing algorithm,then the entire structure is encrypted with a stream cipher.Freier, et al. Historic [Page 11]4.8. ConstantsTyped constants can be defined for purposes of specification bydeclaring a symbol of the desired type and assigning values to it.Under-specified types (opaque, variable-length vectors, andstructures that contain opaque) cannot be assigned values. No fields of a multi-element structure or vector may be elided.For example,struct {uint8 f1;uint8 f2;} Example1;Example1 ex1 = {1, 4};/* assigns f1 = 1, f2 = 4 */5. SSL ProtocolSSL is a layered protocol. At each layer, messages may includefields for length, description, and content. SSL takes messages tobe transmitted, fragments the data into manageable blocks, optionally compresses the data, applies a MAC, encrypts, and transmits theresult. Received data is decrypted, verified, decompressed, andreassembled, then delivered to higher level clients.5.1. Session and Connection StatesAn SSL session is stateful. It is the responsibility of the SSLhandshake protocol to coordinate the states of the client and server, thereby allowing the protocol state machines of each to operateconsistently, despite the fact that the state is not exactlyparallel. Logically, the state is represented twice, once as thecurrent operating state and (during the handshake protocol) again as the pending state. Additionally, separate read and write states are maintained. When the client or server receives a change cipher spec message, it copies the pending read state into the current readstate. When the client or server sends a change cipher spec message, it copies the pending write state into the current write state. When the handshake negotiation is complete, the client and server exchange change cipher spec messages (see Section 5.3), and they thencommunicate using the newly agreed-upon cipher spec.An SSL session may include multiple secure connections; in addition, parties may have multiple simultaneous sessions.Freier, et al. Historic [Page 12]The session state includes the following elements:session identifier: An arbitrary byte sequence chosen by the server to identify an active or resumable session state.peer certificate: X509.v3 [X509] certificate of the peer. Thiselement of the state may be null.compression method: The algorithm used to compress data prior toencryption.cipher spec: Specifies the bulk data encryption algorithm (such asnull, DES, etc.) and a MAC algorithm (such as MD5 or SHA). Italso defines cryptographic attributes such as the hash_size. (See Appendix A.7 for formal definition.)master secret: 48-byte secret shared between the client and server. is resumable: A flag indicating whether the session can be used toinitiate new connections.The connection state includes the following elements:server and client random: Byte sequences that are chosen by theserver and client for each connection.server write MAC secret: The secret used in MAC operations on datawritten by the server.client write MAC secret: The secret used in MAC operations on datawritten by the client.server write key: The bulk cipher key for data encrypted by theserver and decrypted by the client.client write key: The bulk cipher key for data encrypted by theclient and decrypted by the server.initialization vectors: When a block cipher in Cipher Block Chaining (CBC) mode is used, an initialization vector (IV) is maintainedfor each key. This field is first initialized by the SSLhandshake protocol. Thereafter, the final ciphertext block fromeach record is preserved for use with the following record.Freier, et al. Historic [Page 13]sequence numbers: Each party maintains separate sequence numbers for transmitted and received messages for each connection. When aparty sends or receives a change cipher spec message, theappropriate sequence number is set to zero. Sequence numbers are of type uint64 and may not exceed 2^64-1.5.2. Record LayerThe SSL record layer receives uninterpreted data from higher layersin non-empty blocks of arbitrary size.5.2.1. FragmentationThe record layer fragments information blocks into SSLPlaintextrecords of 2^14 bytes or less. Client message boundaries are notpreserved in the record layer (i.e., multiple client messages of the same ContentType may be coalesced into a single SSLPlaintext record). struct {uint8 major, minor;} ProtocolVersion;enum {change_cipher_spec(20), alert(21), handshake(22),application_data(23), (255)} ContentType;struct {ContentType type;ProtocolVersion version;uint16 length;opaque fragment[SSLPlaintext.length];} SSLPlaintext;type: The higher level protocol used to process the enclosedfragment.version: The version of protocol being employed. This documentdescribes SSL version 3.0 (see Appendix A.1).length: The length (in bytes) of the followingSSLPlaintext.fragment. The length should not exceed 2^14.fragment: The application data. This data is transparent andtreated as an independent block to be dealt with by the higherlevel protocol specified by the type field.Freier, et al. Historic [Page 14]Note: Data of different SSL record layer content types may beinterleaved. Application data is generally of lower precedence fortransmission than other content types.5.2.2. Record Compression and DecompressionAll records are compressed using the compression algorithm defined in the current session state. There is always an active compressionalgorithm; however, initially it is defined asCompressionMethod.null. The compression algorithm translates anSSLPlaintext structure into an SSLCompressed structure. Compression functions erase their state information whenever the CipherSpec isreplaced.Note: The CipherSpec is part of the session state described inSection 5.1. References to fields of the CipherSpec are madethroughout this document using presentation syntax. A more complete description of the CipherSpec is shown in Appendix A.7.Compression must be lossless and may not increase the content length by more than 1024 bytes. If the decompression function encounters an SSLCompressed.fragment that would decompress to a length in excess of 2^14 bytes, it should issue a fatal decompression_failure alert(Section 5.4.2).struct {ContentType type; /* same as SSLPlaintext.type */ProtocolVersion version;/* same as SSLPlaintext.version */uint16 length;opaque fragment[SSLCompressed.length];} SSLCompressed;length: The length (in bytes) of the followingSSLCompressed.fragment. The length should not exceed 2^14 + 1024. fragment: The compressed form of SSLPlaintext.fragment.Note: A CompressionMethod.null operation is an identity operation; no fields are altered (see Appendix A.4.1.)Implementation note: Decompression functions are responsible forensuring that messages cannot cause internal buffer overflows.Freier, et al. Historic [Page 15]5.2.3. Record Payload Protection and the CipherSpecAll records are protected using the encryption and MAC algorithmsdefined in the current CipherSpec. There is always an activeCipherSpec; however, initially it is SSL_NULL_WITH_NULL_NULL, whichdoes not provide any security.Once the handshake is complete, the two parties have shared secretsthat are used to encrypt records and compute keyed MessageAuthentication Codes (MACs) on their contents. The techniques usedto perform the encryption and MAC operations are defined by theCipherSpec and constrained by CipherSpec.cipher_type. The encryption and MAC functions translate an SSLCompressed structure into anSSLCiphertext. The decryption functions reverse the process.Transmissions also include a sequence number so that missing,altered, or extra messages are detectable.struct {ContentType type;ProtocolVersion version;uint16 length;select (CipherSpec.cipher_type) {case stream: GenericStreamCipher;case block: GenericBlockCipher;} fragment;} SSLCiphertext;type: The type field is identical to SSLCompressed.type.version: The version field is identical to SSLCompressed.version.length: The length (in bytes) of the followingSSLCiphertext.fragment. The length may not exceed 2^14 + 2048.fragment: The encrypted form of SSLCompressed.fragment, includingthe MAC.5.2.3.1. Null or Standard Stream CipherStream ciphers (including BulkCipherAlgorithm.null; see Appendix A.7) convert SSLCompressed.fragment structures to and from streamSSLCiphertext.fragment structures.stream-ciphered struct {opaque content[SSLCompressed.length];opaque MAC[CipherSpec.hash_size];} GenericStreamCipher;Freier, et al. Historic [Page 16]。