title: Unattended generation of an ECDSA key using gpg2
body: <p><strong>Short question</strong></p>
  
  <p>How do I specify an elliptic curve in a gpg2 v2.1.11 parameter file?</p>
  
  <p><strong>Long question</strong></p>
  
  <p>I have successfully used the following bash script to generate an RSA key using gpg2 v2.1.11:</p>
  
  <pre><code>#!/bin/bash
  
  PUBRING_FILE=$(mktemp /tmp/pub.XXXXXX)
  CONFIG_FILE=$(mktemp /tmp/config.XXXXXX)
  
  cat &gt;$CONFIG_FILE &lt;&lt;EOF
      Key-Type: DSA
      Key-Length: 1024
      Subkey-Type: RSA
      Subkey-Length: 2048
      Name-Real: Name
      Name-Comment: Comment
      Name-Email: Email
      Expire-Date: 0
      Passphrase: abc
      %pubring $PUBRING_FILE
  EOF
  
  gpg2 --quiet --batch --expert --full-gen-key $CONFIG_FILE
  </code></pre>
  
  <p>I want to use the same script to generate an ECDSA key. However, when I replace </p>
  
  <pre><code>Subkey-Type: RSA
  Subkey-Length: 2048
  </code></pre>
  
  <p>with </p>
  
  <pre><code>Subkey-Type: ECDSA
  Subkey-Length: 256
  </code></pre>
  
  <p>I get the following error</p>
  
  <blockquote>
    <p><em>gpg: key generation failed: Unknown elliptic curve</em></p>
  </blockquote>
  
  <p>My configuration file clearly omits the curve, but how can I include it? I.e., how do I specify an elliptic curve in a gpg2 v2.1.11 parameter file?</p>