geth-compatible keystore file can be created in Node using ethereumjs-wallet library:
> var Wallet = require('ethereumjs-wallet');
> var key = Buffer.from('efca4cdd31923b50f4214af5d2ae10e7ac45a5019e9431cc195482d707485378', 'hex');
> var wallet = Wallet.fromPrivateKey(key);
You can also specify additional options to control kdf, cipher and other wallet params. See here.
About the keystore file and specifications:
It is called: UTC JSON Keystore File
More info: https://theethereum.wiki/w/index.php/Accounts,_Addresses,_Public_And_Private_Keys,_And_Tokens
I found my JSON file:
- I put the HDD to another Linux machine
- installed testdisk, listed my drives (the lost key was at /dev/sdc)
- Then with:
strings /dev/sdc | grep ea52e36ce9481bde98904d4307ba90cbc6cb8ac4
I got a mass amount of data, where I found a JSON like text:
followed with the content of key file.
The ea52e36ce9481bde98904d4307ba90cbc6cb8ac4 is my account.
You can use MyEtherWallet or MyCrypto(fork of MyEtherWallet) offline only wallet "view wallet details" function to extract private key from wallet json file. Feel free to use its offline version on an air gapped computer to secure your private key.
Edit: MyCrypto only provides this function in the offline version of the wallet now for obvious security issues of getting a private key from an internet site on a connected computer. So you are warned that you should only do that on an air-gaped computer.