⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ssl_intro.wml

📁 apach加密模块
💻 WML
📖 第 1 页 / 共 2 页
字号:
#use "ssl_template.inc" title="Introduction" tag=intro num=2 <page_prev name="Overview"  url="ssl_overview.html"><page_next name="Reference" url="ssl_reference.html">#use wml::std::toc style=nbsp<quotation width=400            author="A. Tannenbaum, ``Introduction to Computer Networks''">``The nice thing about standards is that there are so many to choose from.And if you really don't like all the standards you just have to wait anotheryear until the one arises you are looking for.''</quotation><p><table cellspacing=0 cellpadding=0 border=0><tr valign=bottom><td><big A>s an introduction this chapter is aimed at readers who are familiarwith the Web, HTTP, and Apache, but are not security experts. It is notintended to be a definitive guide to the SSL protocol, nor does it discussspecific techniques for managing certificates in an organization, or theimportant legal issues of patents and import and export restrictions. Rather,it is intended to provide a common background to mod_ssl users by pullingtogether various concepts, definitions, and examples as a starting point forfurther exploration.<p>The presented content is mainly derived, with permission by the author, fromthe article <ahref="http://www.ultranet.com/~fhirsch/Papers/wwwj/index.html"><em>Introducing SSLand Certificates using SSLeay</em></a> from <ahref="http://www.ultranet.com/~fhirsch/">Frederick J. Hirsch</a>, of The OpenGroup Research Institute, which was published in <ahref="http://www.ora.com/catalog/wjsum97/"><em>Web Security: A Matter ofTrust</em></a>, World Wide Web Journal, Volume 2, Issue 3, Summer 1997.Please send any postive feedback to <ahref="mailto:fjh@alum.mit.edu">Frederick Hirsch</a> (the originalarticle author) and all negative feedback to <ahref="mailto:rse@engelschall.com">Ralf S. Engelschall</a> (the mod_sslauthor).</td><td>&nbsp;&nbsp;</td><td><div align=right><table cellspacing=0 cellpadding=5 border=0 bgcolor="#ccccff"><tr><td bgcolor="#333399"><font face="Arial,Helvetica" color="#ccccff"><b>Table Of Contents</b></font></td></tr><tr><td><font face="Arial,Helvetica" size=-1><toc></font></td></tr></table></div></td></tr></table><h2>Cryptographic Techniques</h2>Understanding SSL requires an understanding of cryptographic algorithms,message digest functions (aka. one-way or hash functions), and digitalsignatures. These techniques are the subject of entire books (see for instance[<a href="#AC96">AC96</a>]) and provide the basis for privacy, integrity, andauthentication.<h3>Cryptographic Algorithms</h3>Suppose Alice wants to send a message to her bank to transfer some money.Alice would like the message to be private, since it will include informationsuch as her account number and transfer amount.  One solution is to use acryptographic algorithm, a technique that would transform her message into anencrypted form, unreadable except by those it is intended for.  Once in thisform, the message may only be interpreted through the use of a secret key.Without the key the message is useless: good cryptographic algorithms make itso difficult for intruders to decode the original text that it isn't worththeir effort.<p>There are two categories of cryptographic algorithms:conventional and public key.<ul><li><em>Conventional cryptography</em>, also known as symmetric cryptography, requires the sender and receiver to share a key: a secretpiece of information that may be used to encrypt or decrypt a message.If this key is secret, then nobody other than the sender or receiver mayread the message.  If Alice and the bank know a secret key, then theymay send each other private messages. The task of privately choosing a keybefore communicating, however, can be problematic.<p><li><em>Public key cryptography</em>, also known as asymmetric cryptography,solves the key exchange problem by defining an algorithm which uses two keys,each of which may be used to encrypt a message.  If one key is used to encrypta message then the other must be used to decrypt it.  This makes it possibleto receive secure messages by simply publishing one key (the public key) andkeeping the other secret (the private key).  <p>Anyone may encrypt a message using the public key, but only the owner of theprivate key will be able to read it.  In this way,  Alice may send privatemessages to the  owner of a key-pair (the bank), by encrypting it using theirpublic key.  Only the bank will be able to decrypt it. </ul><h3>Message Digests</h3>Although Alice may encrypt her message to make it private, there is still aconcern that someone might modify her original message message or substituteit with a different one, in order to transfer the money to themselves, forinstance.  One way of guaranteeing the integrity of Alice's message is tocreate a concise summary of her message and send this to the bank as well.Upon receipt of the message, the bank creates its own summary and compares itwith the one Alice sent. If they agree then the message was received intact.<p>A summary such as this is called a <em>message digest</em>, <em>one-wayfunction</em> or <em>hash function</em>. Message digests are used to createshort, fixed-length representations of longer, variable-length messages.Digest algorithms are designed to produce unique digests for differentmessages.  Message digests are designed to make it too difficult to determinethe message from the digest, and also impossible to find two differentmessages which create the same digest -- thus eliminating the possibility ofsubstituting one message for another while maintaining the same digest.<p>Another challenge that Alice faces is finding a way to send the digest to thebank securely; when this is achieved, the integrity of the associated messageis assured. One way to to this is to include the digest in a digitalsignature.<h3>Digital Signatures</h3>When Alice sends a message to the bank, the bank needs to ensure that themessage is really from her, so an intruder does not request a transactioninvolving her account.  A <em>digital signature</em>, created by Alice andincluded with the message, serves this purpose.<p>Digital signatures are created by encrypting a digest of the message,and other information (such as a sequence number) with the sender'sprivate key. Though anyone may <em>decrypt</em> the signature using the publickey, only the signer knows the private key.  This means that only they mayhave signed it.  Including the digest in the signature means the signature isonly good for that message; it also ensures the integrity of the message sinceno one can change the digest and still sign it. <p>To guard against interception and reuse of the signature by an intruder at alater date,  the signature contains a unique sequence number. This protectsthe bank  from a fraudulent claim from Alice that she did not send the message--  only she could have signed it (non-repudiation).<h2>Certificates</h2>Although Alice could have sent a private message to the bank, signed it, andensured the integrity of the message, she still needs to be sure that she isreally communicating with the bank.  This means that she needs to be sure thatthe public key she is using corresponds to the bank's private key.  Similarly,the bank also needs to verify that the message signature really corresponds toAlice's signature.<p>If each party has a certificate which validates the other's identity, confirmsthe public key, and is signed by a trusted agency, then they both will beassured that they are communicating with whom they think they are. Such atrusted agency is called a <em>Certificate Authority</em>, and certificates areused for authentication. <h3>Certificate Contents</h3>A certificate associates a public key with the real identity of an individual,server, or other entity, known as the subject.  As shown in <ahref="#table1">Table 1</a>, information about the subject includes identifyinginformation (the distinguished name), and the public key.  It also includesthe identification and signature of the Certificate Authority that issued thecertificate, and the period of time during which the certificate is valid.  Itmay have additional information (or extensions) as well as administrativeinformation for the Certificate Authority's use, such as a serial number.<p><float name="table1" caption="Table 1: Certificate Information"><table><tr valign=top><td><b>Subject:</b></td><td>Distinguished Name, Public Key</td></tr><tr valign=top><td><b>Issuer:</b></td><td>Distinguished Name, Signature</td></tr><tr><td><b>Period of Validity:</b></td><td>Not Before Date, Not After Date</td></tr><tr><td><b>Administrative Information:</b></td><td>Version, Serial Number</td></TR><tr><td><b>Extended Information:</b></td><td>Basic Contraints, Netscape Flags, etc.</td></TR></table></float><p>A distinguished name is used to provide an identity in a specific context --for instance, an individual might have a personal certificate as well as onefor their identity as an employee.  Distinguished names are defined by theX.509 standard [<a href="#X509">X509</A>], which defines the fields, fieldnames, and abbreviations used to refer to the fields(see <a href="#table2">Table 2</a>). <p><float name="table2" caption="Table 2: Distinguished Name Information"><table><tr valign=top><td><b>DN Field:</b></td><td><b>Abbrev.:</b></td><td><b>Description:</b></td><td><b>Example:</b></td></t><tr valign=top><td>Common Name</td><td>CN</td><td>Name being certified</td><td>CN=Joe Average</td></tr><tr valign=top><td>Organization or Company</td><td>O</td><td>Name is associated with this<br>organization</td><td>O=Snake Oil, Ltd.</td></tr><tr valign=top><td>Organizational Unit</td><td>OU</td><td>Name is associated with this <br>organization unit, such as a department</td><td>OU=Research Institute</td></tr><tr valign=top><td>City/Locality</td><td>L</td><td>Name is located in this City</td><td>L=Snake City</td></tr><tr valign=top><td>State/Province</td><td>ST</td><td>Name is located in this State/Province</td><td>ST=Desert</td></tr><tr valign=top><td>Country</td><td>C</td><td>Name is located in this Country (ISO code)</td><td>C=XZ</td></tr></table></float><p>A Certificate Authority may define a policy specifying which distinguishedfield names are optional, and which are required. It may also placerequirements upon the field contents, as may users of certificates. As anexample, a Netscape browser requires that the Common Name for a certificaterepresenting a server has a name which matches a wildcard pattern for thedomain name of that server, such as <code>*.snakeoil.com</code>.<p>The binary format of a certificate is defined using the ASN.1 notation [ <ahref="#X208">X208</a>] [<a href="#PKCS">PKCS</a>]. This notation defines how tospecify the contents, and encoding rules define how this information istranslated into binary form.  The binary encoding of the certificate isdefined using Distinguished Encoding Rules (DER), which are based on the moregeneral Basic Encoding Rules (BER).  For those transmissions which cannothandle binary, the binary form may be translated into an ASCII form by usingBase64 encoding [<a href="#MIME">MIME</a>]. This encoded version is called PEMencoded (the name comes from "Privacy Enhanced Mail"), when placed betweenbegin and end delimiter lines as illustrated in <a href="#table3">Table 3</a>. <p><float name="table3" caption="Table 3: Example of a PEM-encoded certificate (snakeoil.crt)"><table cellspacing=0 cellpadding=0><tr><td><div class="code"><pre>-----BEGIN CERTIFICATE-----MIIC7jCCAlegAwIBAgIBATANBgkqhkiG9w0BAQQFADCBqTELMAkGA1UEBhMCWFkxFTATBgNVBAgTDFNuYWtlIERlc2VydDETMBEGA1UEBxMKU25ha2UgVG93bjEXMBUGA1UEChMOU25ha2UgT2lsLCBMdGQxHjAcBgNVBAsTFUNlcnRpZmljYXRlIEF1dGhvcml0eTEVMBMGA1UEAxMMU25ha2UgT2lsIENBMR4wHAYJKoZIhvcNAQkBFg9jYUBzbmFrZW9pbC5kb20wHhcNOTgxMDIxMDg1ODM2WhcNOTkxMDIxMDg1ODM2WjCBpzELMAkGA1UEBhMCWFkxFTATBgNVBAgTDFNuYWtlIERlc2VydDETMBEGA1UEBxMKU25ha2UgVG93bjEXMBUGA1UEChMOU25ha2UgT2lsLCBMdGQxFzAVBgNVBAsTDldlYnNlcnZlciBUZWFtMRkwFwYDVQQDExB3d3cuc25ha2VvaWwuZG9tMR8wHQYJKoZIhvcNAQkBFhB3d3dAc25ha2VvaWwuZG9tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDH9Ge/s2zcH+da+rPTx/DPRp3xGjHZ4GG6pCmvADIEtBtKBFAcZ64n+Dy7Np8bvKR+yy5DGQiijsH1D/j8HlGE+q4TZ8OFk7BNBFazHxFbYI4OKMiCxdKzdif1yfaalWoANFlAzlSdbxeGVHoT0K+gT5w3UxwZKv2DLbCTzLZyPwIDAQABoyYwJDAPBgNVHRMECDAGAQH/AgEAMBEGCWCGSAGG+EIBAQQEAwIAQDANBgkqhkiG9w0BAQQFAAOBgQAZUIHAL4D09oE6Lv2k56Gp38OBDuILvwLg1v1KL8mQR+KFjghCrtpqaztZqcDt2q2QoyulCgSzHbEGmi0EsdkPfg6mp0penssIFePYNI+/8u9HT4LuKMJX15hxBam7dUHzICxBVC1lnHyYGjDuAMhe396lYAn8bCld1/L4NMGBCQ==-----END CERTIFICATE-----</pre></div></td></tr></table></float><h3>Certificate Authorities</h3>By first verifying the information in a certificate request before grantingthe certificate, the Certificate Authority assures the identity of the privatekey owner of a key-pair.  For instance, if Alice requests a personalcertificate, the Certificate Authority must first make sure that Alice reallyis the person the certificate request claims.<h4>Certificate Chains</h4>A Certificate Authority may also issue a certificate for another CertificateAuthority.  When examining a certificate, Alice may need to examine thecertificate of the issuer, for each parent Certificate Authority, untilreaching one which she has confidence in. She may decide to trust onlycertificates with a limited chain of issuers, to reduce her risk of a "bad"certificate in the chain.<h4>Creating a Root-Level CA</h4>As noted earlier, each certificate requires an issuer to assert the validityof the identity of the certificate subject, up to the top-level CertificateAuthority (CA). This presents a problem: Since this is who vouches for thecertificate of the top-level authority, which has no issuer? In this unique case, the certificate is "self-signed", so the issuer of thecertificate is the same as the subject.  As a result, one must exercise extracare in trusting a self-signed certificate. The wide publication of a publickey by the root authority reduces the risk in trusting this key -- it would beobvious if someone else publicized a key claiming to be the authority.Browsers are preconfigured to trust well-known certificate authorities.<p>A number of companies, such as <a href="http://www.thawte.com/">Thawte</a> and<a href="http://www.verisign.com/">VeriSign</a> have established themselves asCertificate Authorities. These companies provide the following services:<ul>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -