title: Generate GOST 34.10-2001 keypair and save it to some keystore
body: <p>Currently I need to generate a keypair for GOST 34.10-2001 signature algorithm. It was pleasant to discover that bouncy castle provider has supported this algorithm, but I can not generate a keypair and save it to any keystore of any type. Currently I tried this command (this command works great if <code>keyalg</code> is <code>DSA</code> and sigalg is <code>SHA1withDSA</code>):</p>
  
  <pre><code>keytool -genkey -alias test1 -keyalg ECGOST3410 -keysize 512  -sigalg GOST3411withECGOST3410 \
  -keypass test_1 -validity 1000 -storetype JKS -keystore test1.jks -storepass test_1 -v \
  -provider org.bouncycastle.jce.provider.BouncyCastleProvider -providerpath "bcprov-jdk16-1.46.jar"
  </code></pre>
  
  <p>But I've got an error: </p>
  
  <pre><code>keytool error: java.lang.IllegalArgumentException: unknown key size.
  java.lang.IllegalArgumentException: unknown key size.
          at sun.security.x509.CertAndKeyGen.generate(CertAndKeyGen.java:134)
          at sun.security.tools.KeyTool.doGenKeyPair(KeyTool.java:1156)
          at sun.security.tools.KeyTool.doCommands(KeyTool.java:786)
          at sun.security.tools.KeyTool.run(KeyTool.java:172)
          at sun.security.tools.KeyTool.main(KeyTool.java:166)
  </code></pre>
  
  <p>Exactly the same error I can see when I try to manipulate keysize or remove <code>keysize</code> option from the command. But there is some special case. When I set <code>keysize</code> to <code>256</code> I've got another error:</p>
  
  <pre><code>keytool error: java.lang.IllegalArgumentException: key size not configurable.
  java.lang.IllegalArgumentException: key size not configurable.
          at sun.security.x509.CertAndKeyGen.generate(CertAndKeyGen.java:134)
          at sun.security.tools.KeyTool.doGenKeyPair(KeyTool.java:1156)
          at sun.security.tools.KeyTool.doCommands(KeyTool.java:786)
          at sun.security.tools.KeyTool.run(KeyTool.java:172)
          at sun.security.tools.KeyTool.main(KeyTool.java:166)
  </code></pre>
  
  <p>Currently I have no idea how to generate a keypair and how to save it to a keystore. Also I've got some java code that can generate a key pair for GOST 34.10-2001 algorithm:</p>
  
  <pre><code>Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
  
  KeyPairGenerator kpg = KeyPairGenerator.getInstance("ECGOST3410", "BC");
  kpg.initialize(new ECGenParameterSpec("GostR3410-2001-CryptoPro-A"));
  
  KeyPair kp = kpg.generateKeyPair();
  </code></pre>
  
  <p>This code sample uses <code>ECGenParameterSpec</code> class to initialize a key pair generator, so may be I should provide it somehow to the keytool (<code>-providerArg provider_arg</code> or <code>-Jjavaoption</code>)?</p>
  
  <p>P.S. I think that I should provide curve name as some parameter but I can not determine what parameter I should use.</p>