title: codesign: "Argument list too long"
body: <p>In the <a href="https://stackoverflow.com/questions/3523487/what-is-the-identity-string-of-my-certificate-mac-codesign-utility">past</a>, I had to codesign a .dmg file.</p>
  
  <p>The old certificate has since expired, and I have a new one to sign with.  No problem, right?  Do what I did last time?  Yes.  I exported the new certificate chain and private key as a .pfx file, in windows.  It would seem I can import that directly into the OS X keychain tool, without converting to .p12 first.  So I did.</p>
  
  <p>When it comes time to actually codesign, first try says it can't determine which certificate to use.  So I put the old certificate chain and private key into one keychain (2011), and the new ones in another (2012), and try again:</p>
  
  <p>so...</p>
  
  <p><code>codesign -s "Identifier Name" --keychain 2012.keychain --verbose --dryrun somefile.dmg</code></p>
  
  <p>Returns...</p>
  
  <p><code>somefile.dmg: signed  []</code></p>
  
  <p>BUT!</p>
  
  <p><code>codesign -s "Identifier Name" --keychain 2012.keychain --verbose somefile.dmg</code></p>
  
  <p>Returns...</p>
  
  <p><code>somefile.dmg:  Argument list too long</code></p>
  
  <p>And just to be sure...</p>
  
  <p><code>codesign -d --verbose somefile.dmg</code></p>
  
  <p>Reveals...</p>
  
  <p><code>somefile.dmg:  code object is not signed</code></p>
  
  <p>And for kicks and giggles,</p>
  
  <p><code>codesign -s "Identifier Name" --keychain 2011.keychain --verbose somefile.dmg</code></p>
  
  <p>Reveals...</p>
  
  <p><code>somefile.dmg: signed generic [somefile.dmg]</code></p>
  
  <p><strong>tl;dr</strong> I can still sign things ok with my expired certificate, but when I try to do so with the new one, it works on a dryrun, but when I try to sign for real, the command returns "argument list too long".</p>
  
  <p>I've been trying to figure this out for about two weeks now I kid you not, and as far I can find from searching, there is nothing to be found on this mysterious error message.</p>
  
  <p>Any ideas as to what is going on, or what more I can do?</p>
  
  <p>Thanks,</p>
  
  <p>-Lunpa</p>