Generate Secp256k1 Key From Password 4,2/5 1165 votes

One of the most common forms of cryptography today is public-key cryptography helps to communicate two system by encrypting information using the public key and information can be decrypted using private key. These keys are using mainly on login to server securely and also transferring data securely.

We can generate these private public keys by various ways.

1) By using openssl.

Generate private key - compress private key - generate public key Generate private key - generate public key - compress public key I have tested both using openssl and I believe the answer is yes, but was hoping someone with an understanding of the underlying math could confirm before I assume this is always true. When prompted, type the password for the root key, and the organizational information for the custom CA: Country, State, Org, OU, and the fully qualified domain name. This is the domain of the website and it should be different from the issuer. Generate the certificate with the CSR and the key and sign it with the CA's root key.

ECDSA with secp256k1 in C# - Generate Keys, Sign, Verify - ECDSA-secp256k1-example.cs. Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. In cryptocurrencies, a private key allows a user to gain access to their wallet. The person who holds the private key fully controls the coins in that wallet. For this reason, you should keep it secret. And if you really want to generate the key yourself, it makes sense to generate it in a secure way. Here, I will provide an introduction to private keys and show you how you can generate your.

with password encryption

Generate public key:

2) By using ssh keygen

Download

3) using putty-gen for windows.

Download puttyGen from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html and run it.

You can select one of the key types, SSH-1, SSH-2, and SSH-2 DSA.
SSH-2 is probably better than others but you have to make sure if your system supports SSH-2, if your system ( server) doesnt support it then you better off with SSH-1.

Generate Secp256k1 Key From Password Download

Level of encryption can be set from “Number of bits in a generated key” . Security level can be enhance by using 2048 but again make sure where you are using it and thus follow the recommendation for this value. I prefer 2048 but even with 1024 is much more secure.

Click on generate to create keys. Move your mouse over the empty space to help puttygen to genereate random variables.

Once the key is generated you will see following window.

Generate Secp256k1 Key From Password Windows 7

If you want to login without password ( in case of ssh login) you can put your passphase empty. click on Save Public key and Save private key to save your keys.

When you save private key it will be saved in ppk format which you can use putty to login to your system.

We can get private key for openSSH by clicking on Conversions->Export OpenSSH key /microsoft-office-365-home-premium-activation-key-generator.html.

If you want to use ssh to login with these generated key / pair then
copy public key ( mykey.pub) to .ssh/authorized_key.

Generating Self sign certificate:

ECDSA with secp256k1 in C# - Generate Keys, Sign, Verify
ECDSA-secp256k1-example.cs
usingSystem;
usingSystem.Text;
usingNethereum.Hex.HexConvertors.Extensions;
usingNethereum.Signer;
usingNethereum.Util;
usingNethereum.Signer.Crypto;
classECDSASecp256k1Example
{
staticvoidMain()
{
//var privKey = EthECKey.GenerateKey();
varprivKey=newEthECKey('97ddae0f3a25b92268175400149d65d6887b9cefaf28ea2c078e05cdc15a3c0a');
byte[] pubKeyCompressed=newECKey(privKey.GetPrivateKeyAsBytes(), true).GetPubKey(true);
Console.WriteLine('Private key: {0}', privKey.GetPrivateKey().Substring(4));
Console.WriteLine('Public key: {0}', privKey.GetPubKey().ToHex().Substring(2));
Console.WriteLine('Public key (compressed): {0}', pubKeyCompressed.ToHex());
Console.WriteLine();
stringmsg='Message for signing';
byte[] msgBytes=Encoding.UTF8.GetBytes(msg);
byte[] msgHash=newSha3Keccack().CalculateHash(msgBytes);
varsignature=privKey.SignAndCalculateV(msgHash);
Console.WriteLine('Msg: {0}', msg);
Console.WriteLine('Msg hash: {0}', msgHash.ToHex());
Console.WriteLine('Signature: [v = {0}, r = {1}, s = {2}]',
signature.V[0] -27, signature.R.ToHex(), signature.S.ToHex());
Console.WriteLine();
varpubKeyRecovered=EthECKey.RecoverFromSignature(signature, msgHash);
Console.WriteLine('Recovered pubKey: {0}', pubKeyRecovered.GetPubKey().ToHex().Substring(2));
boolvalidSig=pubKeyRecovered.Verify(msgHash, signature);
Console.WriteLine('Signature valid? {0}', validSig);
}
}
Secp256k1-ECDSA-CSharp.csproj
<ProjectSdk='Microsoft.NET.Sdk'>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReferenceInclude='Nethereum.Signer'Version='2.4.0' />
</ItemGroup>
</Project>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
Coments are closed
Scroll to top