ecPrivateKey.addElement(new INTEGER(1));
ecPrivateKey
.addElement(new OCTET_STRING(EcCore.fieldElemToBytes(S, params)));
try {
ecPrivateKey.encode(baos);
} catch (IOException ioe) {
throw new RuntimeException("Internal ASN.1 encoding error", ioe);
}
privateKeyInfo.addElement(new OCTET_STRING(baos.toByteArray()));