title: Python: base64.b64decode() vs .decode?
body: <p>The Code Furies have turned their baleful glares upon me, and it's fallen to me to implement "Secure Transport" as defined by <a href="http://wiki.directproject.org/" rel="noreferrer">The Direct Project</a>. Whether or not we internally use DNS rather than LDAP for sharing certificates, I'm obviously going to need to set up the former to test against, and that's what's got me stuck. Apparently, an X509 cert needs some massaging to be used in a CERT record, and I'm trying to work out how that's done. </p>
  
  <p>The clearest thing I've found is a script on <a href="http://www.videntity.com/2013/08/how-to-serve-public-certificates-in-bind-for-the-direct-project/" rel="noreferrer">Videntity's blog</a>, but not being versed in python, I'm hitting a stumbling block. Specifically, this line crashes:</p>
  
  <pre><code>decoded_clean_pk = clean_pk.decode('base64', strict)
  </code></pre>
  
  <p>since it doesn't seem to like (or rather, to know) whatever 'strict' is supposed to represent. I'm making the semi-educated guess that the line is supposed to decode the base64 data, but I learned from the Debian OpenSSL debacle some years back that blindly diddling with crypto-related code is a Bad Thing(TM). </p>
  
  <p>So I turn the illustrious python wonks on SO to ask if that line might be replaced by this one (with the appropriate import added):</p>
  
  <pre><code>decoded_clean_pk = base64.b64decode(clean_pk)
  </code></pre>
  
  <p>The script runs after that change, and produces correct-looking output, but I've got enough instinct to know that I can't necessarily trust my instincts here. :)</p>