Azure currently supports SSH protocol 2 (SSH-2) RSA public-private key pairs with a minimum length of 2048 bits. Other key formats such as ED25519 and ECDSA are not supported. Create an SSH key pair. Use the ssh-keygen command to generate SSH public and private key files. By default, these files are created in the /.ssh directory. There is no way to generate a secure key-pair from the password 'puppies'. If you are using a 256-bit elliptic curve and want the full 128-bit security it can offer, any password from which you directly derive a key needs to have over 100 bits of entropy. Windows 7 prodict key generator.

Generate self-signed certs with different key types
openssl-notes.txt
*** RSA
# Generate self-signed certificate with RSA 4096 key-pair
openssl req -x509 -nodes -days 3650 -newkey rsa:4096 -keyout rsakey.pem -out rsacert.pem
# print private and public key
openssl rsa -in rsakey.pem -text -noout
# print certificate
openssl x509 -in rsacert.pem -text -noout
# generate PKCS#12 container
openssl pkcs12 -export -inkey rsakey.pem -in rsacert.pem -out rsacred.p12
*** ECDSA
# Generate self-signed certificate with ECDSA using two common curves
openssl req -x509 -nodes -days 3650 -newkey ec:<(openssl ecparam -name prime256v1) -keyout ecdsakey.pem -out ecdsacert.pem
openssl req -x509 -nodes -days 3650 -newkey ec:<(openssl ecparam -name secp384r1) -keyout ecdsakey.pem -out ecdsacert.pem
# print private and public key + curve name
openssl ec -in ecdsakey.pem -text -noout
# print certificate
openssl x509 -in ecdsacert.pem -text -noout
# generate container
openssl pkcs12 -export -inkey ecdsakey.pem -in ecdsacert.pem -out ecdsacred.p12
Which curve to choose?
http://security.stackexchange.com/questions/78621/which-elliptic-curve-should-i-use
'Interoperability' means that you would probably prefer it if SSL clients can actually
connect to your server; otherwise, having a SSL server would be rather pointless.
This simplifies the question a lot: in practice, average clients only support two curves,
the ones which are designated in so-called NSA Suite B: these are NIST curves P-256 and
P-384 (in OpenSSL, they are designated as, respectively, 'prime256v1' and 'secp384r1').
If you use any other curve, then some widespread Web browsers (e.g. Internet Explorer,
Firefox..) will be unable to talk to your server.
*** DSA
# generate both key and DSA parameters (both will be stored in dsakey.pem)
openssl dsaparam -genkey 1024 -out dsakey.pem
openssl req -x509 -new -days 3650 -key dsakey.pem -out dsacert.pem
# print private and public key with DSA params
openssl dsa -in dsakey.pem -text -noout
# print certificate
openssl x509 -in dsacert.pem -text -noout
# print only DSA params from key file
openssl dsaparam -in dsakey.pem -text -noout
# generate container
openssl pkcs12 -export -inkey dsakey.pem -in dsacert.pem -out dsacred.p12
*** Test TLS connection
openssl s_server -accept 1443 -www -key key.pem -cert cert.pem
openssl s_client -showcerts -connect localhost:1443 -CAfile cert.pem

commented Jan 29, 2018

This is very useful

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
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

Generate Ecdsa Key Pair Elixir 3

<ProjectSdk='Microsoft.NET.Sdk'>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReferenceInclude='Nethereum.Signer'Version='2.4.0' />
</ItemGroup>
</Project>

Generate Ecdsa Key Pair Elixir List

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment