title: Convert signature from P1363 to ASN.1/DER format using Crypto++?
body: <p>I have a signature created this way:</p>
  
  <pre class="lang-cxx prettyprint-override"><code>size_t siglenth = _signer.MaxSignatureLength();
  QByteArray signature(siglenth, 0x00);
  signature.reserve(siglenth);
  siglenth = _signer.SignMessage(_prng,
          (const CryptoPP::byte*) (message.constData()),
          message.length(), (CryptoPP::byte*) signature.data());
  </code></pre>
  
  <p>My signature have a size of 64 and contains:</p>
  
  <blockquote>
    <p>ECCD530E5F232B7C566CA5322F990B3D55ED91156DF3845C4B9105BFE57606DDD68F332A0A5BF7CAB673E4970D10109B72F114571E7474F93ED7C89CD1B89AD4</p>
  </blockquote>
  
  <p>From what I have read in <code>dsa.h</code> file this signature is currently in <code>DSA_P1363</code> format. I need to convert it to <code>DSA_DER</code> format. </p>
  
  <p>To perform this action I try : </p>
  
  <pre class="lang-cxx prettyprint-override"><code>QByteArray derSign(70, 0xFF);
  size_t converted_size = CryptoPP::DSAConvertSignatureFormat(
          (CryptoPP::byte*) (derSign.data()), sizeof(derSign.data()), CryptoPP::DSA_DER,
          (CryptoPP::byte*) (signature.data()), sizeof(signature.data()), CryptoPP::DSA_P1363);
  </code></pre>
  
  <p>The output of this conversion is shown below. It seems to be only the first part of the signature. It has a size of 8 and contains: </p>
  
  <blockquote>
    <p>300D020500ECCD53</p>
  </blockquote>
  
  <p>What is wrong? </p>
  
  <p>Thanks.</p>