For PHP, combining the hashlib and openssl signature function seems to be non-trivial. <div>As a default, we might want to fall back to <span class="Apple-style-span" style="font-family: Times; font-size: medium; color: rgb(51, 51, 51); line-height: 24px; ">RSASSA-PKCS1-v1_5. </span><br>
<br><div class="gmail_quote">On Tue, Apr 27, 2010 at 11:56 AM, John Bradley <span dir="ltr"><<a href="mailto:jbradley@mac.com">jbradley@mac.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div style="word-wrap:break-word">There is basic PKCS7 functionality in the openssl interface for PHP.<div><br></div><div>Unfortunately the PHP interface to openSSL seems to be quite a bit behind openSSL.</div><div><br></div>
<div>PHP has a separate Hash lib that supports SHA256.</div><div><br></div><div>There is also phpAES that implements AES in pure PHP.</div><div><a href="http://phpseclib.sourceforge.net/" target="_blank">http://phpseclib.sourceforge.net/</a></div>
<div><br></div><div>Looking at what can reasonably be done I think the defaults should be:</div><div>Hash SHA256</div><div>Signature RSA-PSS</div><div>Symmetric encryption AES128_CBC with a IV of null bytes (the IV is only required if you are using the same secret across messages).</div>
<div>Asymmetric encryption of the symmetric key RSA OAEP</div><div><br></div><div>AES256_CBC should be recommended to implement. (This is required at LoA 4 if attributes are rated TOP SECRET)</div><div><br></div><div>From what I can find, PHP, Ruby, Python and Perl all support those features.</div>
<div><br></div><div>Python M2Crypto <a href="http://chandlerproject.org/bin/view/Projects/MeTooCrypto" target="_blank">http://chandlerproject.org/bin/view/Projects/MeTooCrypto</a></div><div>This is a table of crypto libs for Python <a href="http://mikeivanov.com/pc/python-crypto.pdf" target="_blank">http://mikeivanov.com/pc/python-crypto.pdf</a></div>
<div><br></div><div>Perl CryptRSA <a href="http://search.cpan.org/~vipul/Crypt-RSA-1.99/lib/Crypt/RSA.pm" target="_blank">http://search.cpan.org/~vipul/Crypt-RSA-1.99/lib/Crypt/RSA.pm</a></div><div>SHA256 <a href="http://search.cpan.org/~dido/SHA256-0.01b/SHA256.pod" target="_blank">http://search.cpan.org/~dido/SHA256-0.01b/SHA256.pod</a></div>
<div>AES128 <a href="http://search.cpan.org/~ttar/Crypt-OpenSSL-AES-0.02/lib/Crypt/OpenSSL/AES.pm" target="_blank">http://search.cpan.org/~ttar/Crypt-OpenSSL-AES-0.02/lib/Crypt/OpenSSL/AES.pm</a></div><div><br></div><div>
Ruby SHA256 is in Digest::SHA2</div><div>For AES and RSA you need the openSSL wrapper. The native libs seem to be commercial.</div><div><br></div><div>In 6 change to RSA-SHA256</div><div>Magic signatures wraps the data as json or XML this is not covered, are we trying to use that or the method from openID 2.0?</div>
<div>I am not against Magic signatures but that is not transparent.</div><div><br></div><div>In the request we need a required encryption algorithm.</div><div>7.4</div><div>openid.enctype </div><div> </div><div>
<span style="white-space:pre"> </span>Value: (optional) Requested symmetric encryption algorithm. If openid.enckey is specified the default for enctype is AES-128-CBC</div><div><span style="white-space:pre"> </span>Other options are AES-256-CBC and DES-EDE3-CBC </div>
<div><br></div><div><br></div><div><br></div><div><span style="font-family:verdana, charcoal, helvetica, arial, sans-serif;font-size:small"><h3 style="font-family:helvetica, monaco, 'MS Sans Serif', arial, sans-serif;font-weight:bold;font-style:normal;color:rgb(51, 51, 51);background-color:transparent">
7.9. Direct Assertion Response</h3><p style="margin-left:2em;margin-right:2em">Upon receipt of the Direct Assertion Request, OP MUST return either Positive or Negative Assertion as defined in <a href="http://www.sakimura.org/specs/ab/1.0/#OpenID.authentication-2.0" style="font-weight:bold;text-decoration:none;color:rgb(153, 0, 0);background-color:transparent" target="_blank">[OpenID.authentication‑2.0]</a> in the HTTPS response body with the exception of openid.invalidate_handle, openid.assoc_handle, openid.signed, which are unnecessary. At the same time, this specification defines the following variables.</p>
<div style="margin-left:2em;margin-right:2em"><br></div><ul style="margin-left:2em;margin-right:2em"><li style="margin-left:3em">openid.proofkey<blockquote><p style="margin-left:2em;margin-right:2em">Value: (optional) X.509 public key certificate presented by the user to the OP during authentication.</p>
</blockquote></li></ul><div style="margin-left:2em;margin-right:2em"><br></div><div style="margin-left:2em;margin-right:2em"><span style="white-space:pre"> </span>openid.sig<blockquote><p style="margin-left:2em;margin-right:2em">
Value: (optional) The assertion will be encoded into Magic Signature <a href="http://www.sakimura.org/specs/ab/1.0/#magic_signatures" style="font-weight:bold;text-decoration:none;color:rgb(153, 0, 0);background-color:transparent" target="_blank">[magic_signatures]</a>Format with the parameters described in <a href="http://www.sakimura.org/specs/ab/1.0/#generating_signatures" style="font-weight:bold;text-decoration:none;color:rgb(153, 0, 0);background-color:transparent" target="_blank">Section 6</a> .</p>
</blockquote></div></span></div><div><br></div><div><span style="font-family:verdana, charcoal, helvetica, arial, sans-serif;font-size:small"><p style="margin-left:2em;margin-right:2em">Further, the payload may be encrypted. If it is encrypted, the data is formatted as follows in JSON as defined in <a href="http://www.sakimura.org/specs/ab/1.0/#RFC4627" style="font-weight:bold;text-decoration:none;color:rgb(153, 0, 0);background-color:transparent" target="_blank">[RFC4627]</a> .</p>
<div style="margin-left:2em;margin-right:2em"><br></div><ul style="margin-left:2em;margin-right:2em"><li style="margin-left:3em">"encdata"<blockquote><p style="margin-left:2em;margin-right:2em">Value: Encrypted data which is base64url encoded as in <a href="http://www.sakimura.org/specs/ab/1.0/#magic_signatures" style="font-weight:bold;text-decoration:none;color:rgb(153, 0, 0);background-color:transparent" target="_blank">[magic_signatures]</a> .</p>
</blockquote></li><li style="margin-left:3em">"enckey"<blockquote><p style="margin-left:2em;margin-right:2em">Value: (Optional) The symmetric encryption key that was used for the encryption of the payload RSA-OAEP encrypted with the Public specified by the RP then base64 encoded. </p>
</blockquote></li></ul><ul style="margin-left:2em;margin-right:2em"><li style="margin-left:3em">"enciv"<blockquote><p style="margin-left:2em;margin-right:2em">Value: (Optional) Base64 encoded initialization vector. The default IV is null.</p>
</blockquote></li></ul><div style="margin-left:2em;margin-right:2em"><br></div><ul style="margin-left:2em;margin-right:2em"><li style="margin-left:3em"><font color="#000000" face="Verdana" size="2"><span style="background-color:transparent;font-size:10px">"enctype"</span></font><blockquote>
<p style="margin-left:2em;margin-right:2em">Value: (Optional) String expressing the encryption type. Default is "AES-128-CBC" </p><p style="margin-left:2em;margin-right:2em"> Possible values are:</p><p style="margin-left:2em;margin-right:2em">
"PLAIN" No encryption base64 encoding only</p><p style="margin-left:2em;margin-right:2em">"AES-128-CBC" 128 bit AES encryption in CBC mode (default)</p><p style="margin-left:2em;margin-right:2em">"AES-256-CBC" 256 bit AES encryption in CBC mode (required by NIST for Top Secret)</p>
<p style="margin-left:2em;margin-right:2em">"DES-EDE3-CBC" Three Key Triple DES EDE in CBC mode (slower and less secure than AES for backwards compatibility)</p></blockquote></li><ul><li><span style="font-family:Verdana, charcoal, helvetica, arial, sans-serif">"encref" </span></li>
<ul><li>Value: (Optional) URI of the request parameter file. If openid.rpfurl was specified in the request, it is REQUIRED that this be returned . (The RP may have multiple keys)</li></ul><li><span style="font-family:Verdana, charcoal, helvetica, arial, sans-serif"><span style="font-family:verdana, charcoal, helvetica, arial, sans-serif"><p style="margin-left:2em;margin-right:2em">
</p></span></span></li></ul></ul><div><br></div><div><font color="#00000000"><span style="background-color:transparent">In 8 we only say artifact is reserved we also have rpfurl and proofkey we may want to put everything under artifact.</span></font></div>
</span></div></div></blockquote></div><br><br clear="all"><br>-- <br>Nat Sakimura (=nat)<br><a href="http://www.sakimura.org/en/">http://www.sakimura.org/en/</a><br><a href="http://twitter.com/_nat_en">http://twitter.com/_nat_en</a><br>
</div>