v2 Major rewrite / Win32 GUI. Still needs plenty of work.
This commit is contained in:
parent
23ce5f10ef
commit
7139c79592
|
@ -1,87 +1,398 @@
|
||||||
# User-specific stuff
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
.idea/**/workspace.xml
|
## files generated by popular Visual Studio add-ons.
|
||||||
.idea/**/tasks.xml
|
##
|
||||||
.idea/**/usage.statistics.xml
|
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
|
||||||
.idea/**/dictionaries
|
|
||||||
.idea/**/shelf
|
|
||||||
|
|
||||||
# AWS User-specific
|
# User-specific files
|
||||||
.idea/**/aws.xml
|
*.rsuser
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
# Generated files
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
.idea/**/contentModel.xml
|
*.userprefs
|
||||||
|
|
||||||
# Sensitive or high-churn files
|
# Mono auto generated files
|
||||||
.idea/**/dataSources/
|
mono_crash.*
|
||||||
.idea/**/dataSources.ids
|
|
||||||
.idea/**/dataSources.local.xml
|
|
||||||
.idea/**/sqlDataSources.xml
|
|
||||||
.idea/**/dynamic.xml
|
|
||||||
.idea/**/uiDesigner.xml
|
|
||||||
.idea/**/dbnavigator.xml
|
|
||||||
|
|
||||||
# Gradle
|
# Build results
|
||||||
.idea/**/gradle.xml
|
[Dd]ebug/
|
||||||
.idea/**/libraries
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
[Ww][Ii][Nn]32/
|
||||||
|
[Aa][Rr][Mm]/
|
||||||
|
[Aa][Rr][Mm]64/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Ll]og/
|
||||||
|
[Ll]ogs/
|
||||||
|
|
||||||
# Gradle and Maven with auto-import
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
.vs/
|
||||||
# since they will be recreated, and may cause churn. Uncomment if using
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
# auto-import.
|
#wwwroot/
|
||||||
# .idea/artifacts
|
|
||||||
# .idea/compiler.xml
|
|
||||||
# .idea/jarRepositories.xml
|
|
||||||
# .idea/modules.xml
|
|
||||||
# .idea/*.iml
|
|
||||||
# .idea/modules
|
|
||||||
# *.iml
|
|
||||||
# *.ipr
|
|
||||||
|
|
||||||
# CMake
|
# Visual Studio 2017 auto generated files
|
||||||
cmake-build-*/
|
Generated\ Files/
|
||||||
|
|
||||||
# Mongo Explorer plugin
|
# MSTest test Results
|
||||||
.idea/**/mongoSettings.xml
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
# File-based project format
|
# NUnit
|
||||||
*.iws
|
*.VisualState.xml
|
||||||
|
TestResult.xml
|
||||||
|
nunit-*.xml
|
||||||
|
|
||||||
# IntelliJ
|
# Build Results of an ATL Project
|
||||||
out/
|
[Dd]ebugPS/
|
||||||
|
[Rr]eleasePS/
|
||||||
|
dlldata.c
|
||||||
|
|
||||||
# mpeltonen/sbt-idea plugin
|
# Benchmark Results
|
||||||
.idea_modules/
|
BenchmarkDotNet.Artifacts/
|
||||||
|
|
||||||
# JIRA plugin
|
# .NET Core
|
||||||
atlassian-ide-plugin.xml
|
project.lock.json
|
||||||
|
project.fragment.lock.json
|
||||||
|
artifacts/
|
||||||
|
|
||||||
# Cursive Clojure plugin
|
# ASP.NET Scaffolding
|
||||||
.idea/replstate.xml
|
ScaffoldingReadMe.txt
|
||||||
|
|
||||||
# SonarLint plugin
|
# StyleCop
|
||||||
.idea/sonarlint/
|
StyleCopReport.xml
|
||||||
|
|
||||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
# Files built by Visual Studio
|
||||||
com_crashlytics_export_strings.xml
|
*_i.c
|
||||||
crashlytics.properties
|
*_p.c
|
||||||
crashlytics-build.properties
|
*_h.h
|
||||||
fabric.properties
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.iobj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.ipdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*_wpftmp.csproj
|
||||||
|
*.log
|
||||||
|
*.tlog
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.svclog
|
||||||
|
*.scc
|
||||||
|
|
||||||
# Editor-based Rest Client
|
# Chutzpah Test files
|
||||||
.idea/httpRequests
|
_Chutzpah*
|
||||||
|
|
||||||
# Android studio 3.1+ serialized cache file
|
# Visual C++ cache files
|
||||||
.idea/caches/build_file_checksums.ser
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opendb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
*.VC.db
|
||||||
|
*.VC.VC.opendb
|
||||||
|
|
||||||
# CMake
|
# Visual Studio profiler
|
||||||
CMakeLists.txt.user
|
*.psess
|
||||||
CMakeCache.txt
|
*.vsp
|
||||||
CMakeFiles
|
*.vspx
|
||||||
CMakeScripts
|
*.sap
|
||||||
Testing
|
|
||||||
Makefile
|
# Visual Studio Trace Files
|
||||||
cmake_install.cmake
|
*.e2e
|
||||||
install_manifest.txt
|
|
||||||
compile_commands.json
|
# TFS 2012 Local Workspace
|
||||||
CTestTestfile.cmake
|
$tf/
|
||||||
_deps
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
*.DotSettings.user
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# AxoCover is a Code Coverage Tool
|
||||||
|
.axoCover/*
|
||||||
|
!.axoCover/settings.json
|
||||||
|
|
||||||
|
# Coverlet is a free, cross platform Code Coverage Tool
|
||||||
|
coverage*.json
|
||||||
|
coverage*.xml
|
||||||
|
coverage*.info
|
||||||
|
|
||||||
|
# Visual Studio code coverage results
|
||||||
|
*.coverage
|
||||||
|
*.coveragexml
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
_NCrunch_*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
nCrunchTemp_*
|
||||||
|
|
||||||
|
# MightyMoose
|
||||||
|
*.mm.*
|
||||||
|
AutoTest.Net/
|
||||||
|
|
||||||
|
# Web workbench (sass)
|
||||||
|
.sass-cache/
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.azurePubxml
|
||||||
|
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||||
|
# but database connection strings (with potential passwords) will be unencrypted
|
||||||
|
*.pubxml
|
||||||
|
*.publishproj
|
||||||
|
|
||||||
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||||
|
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||||
|
# in these scripts will be unencrypted
|
||||||
|
PublishScripts/
|
||||||
|
|
||||||
|
# NuGet Packages
|
||||||
|
*.nupkg
|
||||||
|
# NuGet Symbol Packages
|
||||||
|
*.snupkg
|
||||||
|
# The packages folder can be ignored because of Package Restore
|
||||||
|
**/[Pp]ackages/*
|
||||||
|
# except build/, which is used as an MSBuild target.
|
||||||
|
!**/[Pp]ackages/build/
|
||||||
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
|
#!**/[Pp]ackages/repositories.config
|
||||||
|
# NuGet v3's project.json files produces more ignorable files
|
||||||
|
*.nuget.props
|
||||||
|
*.nuget.targets
|
||||||
|
|
||||||
|
# Microsoft Azure Build Output
|
||||||
|
csx/
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Microsoft Azure Emulator
|
||||||
|
ecf/
|
||||||
|
rcf/
|
||||||
|
|
||||||
|
# Windows Store app package directories and files
|
||||||
|
AppPackages/
|
||||||
|
BundleArtifacts/
|
||||||
|
Package.StoreAssociation.xml
|
||||||
|
_pkginfo.txt
|
||||||
|
*.appx
|
||||||
|
*.appxbundle
|
||||||
|
*.appxupload
|
||||||
|
|
||||||
|
# Visual Studio cache files
|
||||||
|
# files ending in .cache can be ignored
|
||||||
|
*.[Cc]ache
|
||||||
|
# but keep track of directories ending in .cache
|
||||||
|
!?*.[Cc]ache/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
ClientBin/
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.dbproj.schemaview
|
||||||
|
*.jfm
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
orleans.codegen.cs
|
||||||
|
|
||||||
|
# Including strong name files can present a security risk
|
||||||
|
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||||
|
#*.snk
|
||||||
|
|
||||||
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
|
#bower_components/
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file
|
||||||
|
# to a newer Visual Studio version. Backup files are not needed,
|
||||||
|
# because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
ServiceFabricBackup/
|
||||||
|
*.rptproj.bak
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
*.mdf
|
||||||
|
*.ldf
|
||||||
|
*.ndf
|
||||||
|
|
||||||
|
# Business Intelligence projects
|
||||||
|
*.rdl.data
|
||||||
|
*.bim.layout
|
||||||
|
*.bim_*.settings
|
||||||
|
*.rptproj.rsuser
|
||||||
|
*- [Bb]ackup.rdl
|
||||||
|
*- [Bb]ackup ([0-9]).rdl
|
||||||
|
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||||
|
|
||||||
|
# Microsoft Fakes
|
||||||
|
FakesAssemblies/
|
||||||
|
|
||||||
|
# GhostDoc plugin setting file
|
||||||
|
*.GhostDoc.xml
|
||||||
|
|
||||||
|
# Node.js Tools for Visual Studio
|
||||||
|
.ntvs_analysis.dat
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Visual Studio 6 build log
|
||||||
|
*.plg
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace options file
|
||||||
|
*.opt
|
||||||
|
|
||||||
|
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||||
|
*.vbw
|
||||||
|
|
||||||
|
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
|
||||||
|
*.vbp
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
|
||||||
|
*.dsw
|
||||||
|
*.dsp
|
||||||
|
|
||||||
|
# Visual Studio 6 technical files
|
||||||
|
*.ncb
|
||||||
|
*.aps
|
||||||
|
|
||||||
|
# Visual Studio LightSwitch build output
|
||||||
|
**/*.HTMLClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/ModelManifest.xml
|
||||||
|
**/*.Server/GeneratedArtifacts
|
||||||
|
**/*.Server/ModelManifest.xml
|
||||||
|
_Pvt_Extensions
|
||||||
|
|
||||||
|
# Paket dependency manager
|
||||||
|
.paket/paket.exe
|
||||||
|
paket-files/
|
||||||
|
|
||||||
|
# FAKE - F# Make
|
||||||
|
.fake/
|
||||||
|
|
||||||
|
# CodeRush personal settings
|
||||||
|
.cr/personal
|
||||||
|
|
||||||
|
# Python Tools for Visual Studio (PTVS)
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
# Cake - Uncomment if you are using it
|
||||||
|
# tools/**
|
||||||
|
# !tools/packages.config
|
||||||
|
|
||||||
|
# Tabs Studio
|
||||||
|
*.tss
|
||||||
|
|
||||||
|
# Telerik's JustMock configuration file
|
||||||
|
*.jmconfig
|
||||||
|
|
||||||
|
# BizTalk build output
|
||||||
|
*.btp.cs
|
||||||
|
*.btm.cs
|
||||||
|
*.odx.cs
|
||||||
|
*.xsd.cs
|
||||||
|
|
||||||
|
# OpenCover UI analysis results
|
||||||
|
OpenCover/
|
||||||
|
|
||||||
|
# Azure Stream Analytics local run output
|
||||||
|
ASALocalRun/
|
||||||
|
|
||||||
|
# MSBuild Binary and Structured Log
|
||||||
|
*.binlog
|
||||||
|
|
||||||
|
# NVidia Nsight GPU debugger configuration file
|
||||||
|
*.nvuser
|
||||||
|
|
||||||
|
# MFractors (Xamarin productivity tool) working folder
|
||||||
|
.mfractor/
|
||||||
|
|
||||||
|
# Local History for Visual Studio
|
||||||
|
.localhistory/
|
||||||
|
|
||||||
|
# Visual Studio History (VSHistory) files
|
||||||
|
.vshistory/
|
||||||
|
|
||||||
|
# BeatPulse healthcheck temp database
|
||||||
|
healthchecksdb
|
||||||
|
|
||||||
|
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||||
|
MigrationBackup/
|
||||||
|
|
||||||
|
# Ionide (cross platform F# VS Code tools) working folder
|
||||||
|
.ionide/
|
||||||
|
|
||||||
|
# Fody - auto-generated XML schema
|
||||||
|
FodyWeavers.xsd
|
||||||
|
|
||||||
|
# VS Code files for those working on multiple tools
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
*.code-workspace
|
||||||
|
|
||||||
|
# Local History for Visual Studio Code
|
||||||
|
.history/
|
||||||
|
|
||||||
|
# Windows Installer files from build outputs
|
||||||
|
*.cab
|
||||||
|
*.msi
|
||||||
|
*.msix
|
||||||
|
*.msm
|
||||||
|
*.msp
|
||||||
|
|
||||||
|
# JetBrains Rider
|
||||||
|
*.sln.iml
|
|
@ -1,8 +0,0 @@
|
||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# Editor-based HTTP Client requests
|
|
||||||
/httpRequests/
|
|
||||||
# Datasource local storage ignored files
|
|
||||||
/dataSources/
|
|
||||||
/dataSources.local.xml
|
|
|
@ -1,2 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/XPKeygen.iml" filepath="$PROJECT_DIR$/.idea/XPKeygen.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,15 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 3.24)
|
|
||||||
project(Keygen)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
|
||||||
|
|
||||||
add_executable(
|
|
||||||
Keygen
|
|
||||||
main.cpp
|
|
||||||
xp.cpp
|
|
||||||
server.cpp
|
|
||||||
header.h
|
|
||||||
utilities.cpp
|
|
||||||
key.cpp
|
|
||||||
)
|
|
||||||
target_link_libraries(Keygen ${CMAKE_CURRENT_SOURCE_DIR}/lib/libcrypto.lib -static)
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.5.33516.290
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Keygen", "Keygen.vcxproj", "{BDEA17F1-9D47-31CE-B733-4C1AE77CB243}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{BDEA17F1-9D47-31CE-B733-4C1AE77CB243}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{BDEA17F1-9D47-31CE-B733-4C1AE77CB243}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{BDEA17F1-9D47-31CE-B733-4C1AE77CB243}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{BDEA17F1-9D47-31CE-B733-4C1AE77CB243}.Release|x64.Build.0 = Release|x64
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {85A3BCED-00B4-3BD6-8AE4-A20F291658B0}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
|
@ -0,0 +1,176 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="17.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<PreferredToolArchitecture>
|
||||||
|
</PreferredToolArchitecture>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{BDEA17F1-9D47-31CE-B733-4C1AE77CB243}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
<ProjectName>Keygen</ProjectName>
|
||||||
|
<VCProjectUpgraderObjectName>NoUpgrade</VCProjectUpgraderObjectName>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<_ProjectFileVersion>10.0.20506.1</_ProjectFileVersion>
|
||||||
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||||
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Configuration)\</IntDir>
|
||||||
|
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)</TargetName>
|
||||||
|
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.exe</TargetExt>
|
||||||
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
||||||
|
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</GenerateManifest>
|
||||||
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||||
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Configuration)\</IntDir>
|
||||||
|
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectName)</TargetName>
|
||||||
|
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.exe</TargetExt>
|
||||||
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||||
|
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</GenerateManifest>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||||
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
|
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||||
|
<ExceptionHandling>Sync</ExceptionHandling>
|
||||||
|
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
<UseFullPaths>true</UseFullPaths>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||||
|
<AdditionalIncludeDirectories>C:\Program Files\OpenSSL\include</AdditionalIncludeDirectories>
|
||||||
|
<SDLCheck>false</SDLCheck>
|
||||||
|
<ConformanceMode>false</ConformanceMode>
|
||||||
|
<CallingConvention>StdCall</CallingConvention>
|
||||||
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
|
</ClCompile>
|
||||||
|
<ResourceCompile>
|
||||||
|
<PreprocessorDefinitions>%(PreprocessorDefinitions);WIN32;_DEBUG;_WINDOWS;CMAKE_INTDIR=\"Debug\"</PreprocessorDefinitions>
|
||||||
|
</ResourceCompile>
|
||||||
|
<Midl>
|
||||||
|
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<OutputDirectory>$(ProjectDir)/$(IntDir)</OutputDirectory>
|
||||||
|
<HeaderFileName>%(Filename).h</HeaderFileName>
|
||||||
|
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
|
||||||
|
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
|
||||||
|
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
|
||||||
|
</Midl>
|
||||||
|
<Link>
|
||||||
|
<AdditionalDependencies>lib\libcrypto.lib;comctl32.lib;uxtheme.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalOptions>%(AdditionalOptions) /machine:x64</AdditionalOptions>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<IgnoreSpecificDefaultLibraries>
|
||||||
|
</IgnoreSpecificDefaultLibraries>
|
||||||
|
<ImportLibrary>
|
||||||
|
</ImportLibrary>
|
||||||
|
<ProgramDataBaseFile>$(OutDir)$(TargetName).pdb</ProgramDataBaseFile>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<AdditionalManifestDependencies>"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'"</AdditionalManifestDependencies>
|
||||||
|
</Link>
|
||||||
|
<ProjectReference>
|
||||||
|
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||||
|
<ExceptionHandling>Sync</ExceptionHandling>
|
||||||
|
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
|
<UseFullPaths>false</UseFullPaths>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||||
|
<DebugInformationFormat>
|
||||||
|
</DebugInformationFormat>
|
||||||
|
<AdditionalIncludeDirectories>C:\Program Files\OpenSSL\include</AdditionalIncludeDirectories>
|
||||||
|
<CallingConvention>StdCall</CallingConvention>
|
||||||
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
|
</ClCompile>
|
||||||
|
<ResourceCompile>
|
||||||
|
<PreprocessorDefinitions>%(PreprocessorDefinitions);WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR=\"Release\"</PreprocessorDefinitions>
|
||||||
|
</ResourceCompile>
|
||||||
|
<Midl>
|
||||||
|
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<OutputDirectory>$(ProjectDir)/$(IntDir)</OutputDirectory>
|
||||||
|
<HeaderFileName>%(Filename).h</HeaderFileName>
|
||||||
|
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
|
||||||
|
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
|
||||||
|
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
|
||||||
|
</Midl>
|
||||||
|
<Link>
|
||||||
|
<AdditionalDependencies>lib\libcrypto.lib;comctl32.lib;uxtheme.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalOptions>%(AdditionalOptions) /machine:x64</AdditionalOptions>
|
||||||
|
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||||
|
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||||
|
<ImportLibrary>
|
||||||
|
</ImportLibrary>
|
||||||
|
<ProgramDataBaseFile>$(OutDir)$(TargetName).pdb</ProgramDataBaseFile>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<AdditionalManifestDependencies>"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'"</AdditionalManifestDependencies>
|
||||||
|
</Link>
|
||||||
|
<ProjectReference>
|
||||||
|
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="D:\Software\Development\XPKeygen\main.cpp" />
|
||||||
|
<ClCompile Include="D:\Software\Development\XPKeygen\xp.cpp" />
|
||||||
|
<ClCompile Include="D:\Software\Development\XPKeygen\server.cpp" />
|
||||||
|
<ClCompile Include="windows.cpp" />
|
||||||
|
<ClInclude Include="D:\Software\Development\XPKeygen\header.h" />
|
||||||
|
<ClCompile Include="D:\Software\Development\XPKeygen\utilities.cpp" />
|
||||||
|
<ClCompile Include="D:\Software\Development\XPKeygen\key.cpp" />
|
||||||
|
<ClInclude Include="resource.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="resource.rc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Media Include="resources\neon.wav" />
|
||||||
|
<Media Include="resources\pxiii.wav" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Image Include="resources\ender.bmp" />
|
||||||
|
<Image Include="resources\icon.ico" />
|
||||||
|
<Image Include="resources\logo.bmp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="17.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="D:\Software\Development\XPKeygen\main.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="D:\Software\Development\XPKeygen\xp.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="D:\Software\Development\XPKeygen\server.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="D:\Software\Development\XPKeygen\utilities.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="D:\Software\Development\XPKeygen\key.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="windows.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="D:\Software\Development\XPKeygen\header.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="resource.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{174FAF7A-E150-316A-8FA9-DCB2D9FA4C51}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{DD359385-3E10-39A8-BDBE-E651CB1745C6}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="resource.rc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Media Include="resources\neon.wav" />
|
||||||
|
<Media Include="resources\pxiii.wav" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Image Include="resources\icon.ico" />
|
||||||
|
<Image Include="resources\ender.bmp" />
|
||||||
|
<Image Include="resources\logo.bmp" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
25
header.h
25
header.h
|
@ -25,6 +25,21 @@
|
||||||
#define PK_LENGTH 25
|
#define PK_LENGTH 25
|
||||||
#define NULL_TERMINATOR 1
|
#define NULL_TERMINATOR 1
|
||||||
|
|
||||||
|
#define IDC_BUTTON1 1000
|
||||||
|
#define IDC_BUTTON2 1001
|
||||||
|
#define IDC_BUTTON3 1002
|
||||||
|
#define IDC_BUTTON4 1003
|
||||||
|
|
||||||
|
#define IDC_RADIO1 1005
|
||||||
|
#define IDC_RADIO2 1006
|
||||||
|
|
||||||
|
#define IDC_EDIT1 1010
|
||||||
|
|
||||||
|
#define IDC_INPUT1 1020
|
||||||
|
#define IDC_INPUT2 1021
|
||||||
|
|
||||||
|
#define IDC_IMAGE1 1050
|
||||||
|
|
||||||
typedef unsigned long ul32;
|
typedef unsigned long ul32;
|
||||||
|
|
||||||
extern HANDLE hConsole;
|
extern HANDLE hConsole;
|
||||||
|
@ -35,6 +50,13 @@ extern const long aXP;
|
||||||
extern const long bXP;
|
extern const long bXP;
|
||||||
|
|
||||||
// xp.cpp
|
// xp.cpp
|
||||||
|
int keyXP(
|
||||||
|
char *pKey,
|
||||||
|
ul32 *hash,
|
||||||
|
ul32 *sig,
|
||||||
|
ul32 nRaw
|
||||||
|
);
|
||||||
|
|
||||||
void unpackXP(
|
void unpackXP(
|
||||||
ul32 *serial,
|
ul32 *serial,
|
||||||
ul32 *hash,
|
ul32 *hash,
|
||||||
|
@ -123,4 +145,7 @@ void base24(byte *cdKey, ul32 *byteSeq);
|
||||||
void printProductKey(const char *pKey);
|
void printProductKey(const char *pKey);
|
||||||
void printProductID(const ul32 *pRaw);
|
void printProductID(const ul32 *pRaw);
|
||||||
|
|
||||||
|
// windows.cpp
|
||||||
|
bool InitializeWindow(HINSTANCE hInstance);
|
||||||
|
|
||||||
#endif //KEYGEN_HEADER_H
|
#endif //KEYGEN_HEADER_H
|
||||||
|
|
5
key.cpp
5
key.cpp
|
@ -75,7 +75,7 @@ void printProductID(const ul32 *pRaw) {
|
||||||
char b[6], c[8];
|
char b[6], c[8];
|
||||||
|
|
||||||
// Cut away last bit of the product key and convert it to an ASCII-number (=raw)
|
// Cut away last bit of the product key and convert it to an ASCII-number (=raw)
|
||||||
sprintf(raw, "%lu", pRaw[0] >> 1);
|
sprintf(raw, "%09lu", pRaw[0] >> 1);
|
||||||
|
|
||||||
// Make B-part {...-640-...} -> most significant 3 digits of Raw Product Key
|
// Make B-part {...-640-...} -> most significant 3 digits of Raw Product Key
|
||||||
strncpy(b, raw, 3);
|
strncpy(b, raw, 3);
|
||||||
|
@ -84,9 +84,6 @@ void printProductID(const ul32 *pRaw) {
|
||||||
// Make C-part {...-123456X-...} -> least significant 6 digits of Raw Product Key
|
// Make C-part {...-123456X-...} -> least significant 6 digits of Raw Product Key
|
||||||
strcpy(c, raw + 3);
|
strcpy(c, raw + 3);
|
||||||
|
|
||||||
// Make checksum digit-part {...56X-}
|
|
||||||
assert(strlen(c) == 6);
|
|
||||||
|
|
||||||
int digit = 0;
|
int digit = 0;
|
||||||
|
|
||||||
// Reverse sum algorithm to find a check digit that would add to the rest to form a sum divisible by 7.
|
// Reverse sum algorithm to find a check digit that would add to the rest to form a sum divisible by 7.
|
||||||
|
|
84
main.cpp
84
main.cpp
|
@ -8,24 +8,6 @@
|
||||||
HANDLE hConsole;
|
HANDLE hConsole;
|
||||||
byte charset[] = "BCDFGHJKMPQRTVWXY2346789";
|
byte charset[] = "BCDFGHJKMPQRTVWXY2346789";
|
||||||
|
|
||||||
const char pXP[] = "92ddcf14cb9e71f4489a2e9ba350ae29454d98cb93bdbcc07d62b502ea12238ee904a8b20d017197aae0c103b32713a9";
|
|
||||||
const long aXP = 1;
|
|
||||||
const long bXP = 0;
|
|
||||||
|
|
||||||
// Base point G (Generator)
|
|
||||||
const char genXXP[] = "46E3775ECE21B0898D39BEA57050D422A0AF989E497962BAEE2CB17E0A28D5360D5476B8DC966443E37A14F1AEF37742";
|
|
||||||
const char genYXP[] = "7C8E741D2C34F4478E325469CD491603D807222C9C4AC09DDB2B31B3CE3F7CC191B3580079932BC6BEF70BE27604F65E";
|
|
||||||
|
|
||||||
// Inverse of the public key
|
|
||||||
const char pubXXP[] = "5D8DBE75198015EC41C45AAB6143542EB098F6A5CC9CE4178A1B8A1E7ABBB5BC64DF64FAF6177DC1B0988AB00BA94BF8";
|
|
||||||
const char pubYXP[] = "23A2909A0B4803C89F910C7191758B48746CEA4D5FF07667444ACDB9512080DBCA55E6EBF30433672B894F44ACE92BFA";
|
|
||||||
|
|
||||||
// The order of G was computed in 18 hours using a Pentium III 450
|
|
||||||
const char genOrderXP[] = "DB6B4C58EFBAFD";
|
|
||||||
|
|
||||||
// The private key was computed in 10 hours using a Pentium III 450
|
|
||||||
const char privateKeyXP[] = "565B0DFF8496C8";
|
|
||||||
|
|
||||||
int mainServer() {
|
int mainServer() {
|
||||||
BIGNUM *a, *b, *p, *generatorX, *generatorY, *publicKeyX, *publicKeyY, *genOrder, *privateKey;
|
BIGNUM *a, *b, *p, *generatorX, *generatorY, *publicKeyX, *publicKeyY, *genOrder, *privateKey;
|
||||||
BN_CTX *context = BN_CTX_new();
|
BN_CTX *context = BN_CTX_new();
|
||||||
|
@ -157,11 +139,14 @@ int mainServer() {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
char pKey[PK_LENGTH + NULL_TERMINATOR]{};
|
ul32 nAmount = 1;
|
||||||
ul32 pRaw[1]{}, nAmount = 1;
|
|
||||||
|
|
||||||
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
|
|
||||||
|
HINSTANCE hInstance = GetModuleHandleW(nullptr);
|
||||||
|
|
||||||
|
int p = InitializeWindow(hInstance);
|
||||||
|
|
||||||
SetConsoleTitleA("Windows XP VLK Keygen");
|
SetConsoleTitleA("Windows XP VLK Keygen");
|
||||||
|
|
||||||
system("cls");
|
system("cls");
|
||||||
|
@ -190,61 +175,4 @@ int main() {
|
||||||
printf("Finally, we pack these components together, convert them to Base24 and get a valid Windows XP key.\n");
|
printf("Finally, we pack these components together, convert them to Base24 and get a valid Windows XP key.\n");
|
||||||
|
|
||||||
cprintf("Input Raw Product Key BBB-CCCCCC WITHOUT DASHES in range [100-000000; 999-999999]: ", 0x0E);
|
cprintf("Input Raw Product Key BBB-CCCCCC WITHOUT DASHES in range [100-000000; 999-999999]: ", 0x0E);
|
||||||
scanf_s("%lu", pRaw);
|
}
|
||||||
|
|
||||||
system("cls");
|
|
||||||
|
|
||||||
printf("Raw Product Key: ");
|
|
||||||
cprintf("%d-%d\n", 0x0E, pRaw[0] / 1'000'000, pRaw[0] % 1'000'000);
|
|
||||||
printf("How many keys would you like to generate? ");
|
|
||||||
scanf_s("%lu", &nAmount);
|
|
||||||
|
|
||||||
printf("\n");
|
|
||||||
|
|
||||||
// We cannot produce a valid key without knowing the private key k. The reason for this is that
|
|
||||||
// we need the result of the function K(x; y) = kG(x; y).
|
|
||||||
BIGNUM *privateKey = BN_new();
|
|
||||||
|
|
||||||
// We can, however, validate any given key using the available public key: {p, a, b, G, K}.
|
|
||||||
// genOrder the order of the generator G, a value we have to reverse -> Schoof's Algorithm.
|
|
||||||
BIGNUM *genOrder = BN_new();
|
|
||||||
|
|
||||||
/* Computed data */
|
|
||||||
BN_hex2bn(&genOrder, genOrderXP);
|
|
||||||
BN_hex2bn(&privateKey, privateKeyXP);
|
|
||||||
|
|
||||||
EC_POINT *genPoint, *pubPoint;
|
|
||||||
EC_GROUP *eCurve = initializeEllipticCurve(
|
|
||||||
pXP,
|
|
||||||
aXP,
|
|
||||||
bXP,
|
|
||||||
genXXP,
|
|
||||||
genYXP,
|
|
||||||
pubXXP,
|
|
||||||
pubYXP,
|
|
||||||
genOrder,
|
|
||||||
privateKey,
|
|
||||||
&genPoint,
|
|
||||||
&pubPoint
|
|
||||||
);
|
|
||||||
|
|
||||||
// Shift left once.
|
|
||||||
pRaw[0] <<= 1;
|
|
||||||
|
|
||||||
for (int i = 0; i < nAmount; i++) {
|
|
||||||
cprintf("Product Key %d:\n", 0x08, i + 1);
|
|
||||||
|
|
||||||
// Generate the key.
|
|
||||||
generateXPKey((byte *)pKey, eCurve, genPoint, genOrder, privateKey, pRaw);
|
|
||||||
printProductKey(pKey);
|
|
||||||
|
|
||||||
printf("\n\n");
|
|
||||||
|
|
||||||
// Verify the key.
|
|
||||||
verifyXPKey(eCurve, genPoint, pubPoint, pKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
system("pause");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,584 @@
|
||||||
|
/*
|
||||||
|
* Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
|
||||||
|
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||||
|
* this file except in compliance with the License. You can obtain a copy
|
||||||
|
* in the file LICENSE in the source distribution or at
|
||||||
|
* https://www.openssl.org/source/license.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_BN_H
|
||||||
|
# define OPENSSL_BN_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define HEADER_BN_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/e_os2.h>
|
||||||
|
# ifndef OPENSSL_NO_STDIO
|
||||||
|
# include <stdio.h>
|
||||||
|
# endif
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/types.h>
|
||||||
|
# include <openssl/crypto.h>
|
||||||
|
# include <openssl/bnerr.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 64-bit processor with LP64 ABI
|
||||||
|
*/
|
||||||
|
# ifdef SIXTY_FOUR_BIT_LONG
|
||||||
|
# define BN_ULONG unsigned long
|
||||||
|
# define BN_BYTES 8
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 64-bit processor other than LP64 ABI
|
||||||
|
*/
|
||||||
|
# ifdef SIXTY_FOUR_BIT
|
||||||
|
# define BN_ULONG unsigned long long
|
||||||
|
# define BN_BYTES 8
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef THIRTY_TWO_BIT
|
||||||
|
# define BN_ULONG unsigned int
|
||||||
|
# define BN_BYTES 4
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# define BN_BITS2 (BN_BYTES * 8)
|
||||||
|
# define BN_BITS (BN_BITS2 * 2)
|
||||||
|
# define BN_TBIT ((BN_ULONG)1 << (BN_BITS2 - 1))
|
||||||
|
|
||||||
|
# define BN_FLG_MALLOCED 0x01
|
||||||
|
# define BN_FLG_STATIC_DATA 0x02
|
||||||
|
|
||||||
|
/*
|
||||||
|
* avoid leaking exponent information through timing,
|
||||||
|
* BN_mod_exp_mont() will call BN_mod_exp_mont_consttime,
|
||||||
|
* BN_div() will call BN_div_no_branch,
|
||||||
|
* BN_mod_inverse() will call bn_mod_inverse_no_branch.
|
||||||
|
*/
|
||||||
|
# define BN_FLG_CONSTTIME 0x04
|
||||||
|
# define BN_FLG_SECURE 0x08
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_0_9_8
|
||||||
|
/* deprecated name for the flag */
|
||||||
|
# define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME
|
||||||
|
# define BN_FLG_FREE 0x8000 /* used for debugging */
|
||||||
|
# endif
|
||||||
|
|
||||||
|
void BN_set_flags(BIGNUM *b, int n);
|
||||||
|
int BN_get_flags(const BIGNUM *b, int n);
|
||||||
|
|
||||||
|
/* Values for |top| in BN_rand() */
|
||||||
|
#define BN_RAND_TOP_ANY -1
|
||||||
|
#define BN_RAND_TOP_ONE 0
|
||||||
|
#define BN_RAND_TOP_TWO 1
|
||||||
|
|
||||||
|
/* Values for |bottom| in BN_rand() */
|
||||||
|
#define BN_RAND_BOTTOM_ANY 0
|
||||||
|
#define BN_RAND_BOTTOM_ODD 1
|
||||||
|
|
||||||
|
/*
|
||||||
|
* get a clone of a BIGNUM with changed flags, for *temporary* use only (the
|
||||||
|
* two BIGNUMs cannot be used in parallel!). Also only for *read only* use. The
|
||||||
|
* value |dest| should be a newly allocated BIGNUM obtained via BN_new() that
|
||||||
|
* has not been otherwise initialised or used.
|
||||||
|
*/
|
||||||
|
void BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags);
|
||||||
|
|
||||||
|
/* Wrapper function to make using BN_GENCB easier */
|
||||||
|
int BN_GENCB_call(BN_GENCB *cb, int a, int b);
|
||||||
|
|
||||||
|
BN_GENCB *BN_GENCB_new(void);
|
||||||
|
void BN_GENCB_free(BN_GENCB *cb);
|
||||||
|
|
||||||
|
/* Populate a BN_GENCB structure with an "old"-style callback */
|
||||||
|
void BN_GENCB_set_old(BN_GENCB *gencb, void (*callback) (int, int, void *),
|
||||||
|
void *cb_arg);
|
||||||
|
|
||||||
|
/* Populate a BN_GENCB structure with a "new"-style callback */
|
||||||
|
void BN_GENCB_set(BN_GENCB *gencb, int (*callback) (int, int, BN_GENCB *),
|
||||||
|
void *cb_arg);
|
||||||
|
|
||||||
|
void *BN_GENCB_get_arg(BN_GENCB *cb);
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define BN_prime_checks 0 /* default: select number of iterations based
|
||||||
|
* on the size of the number */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* BN_prime_checks_for_size() returns the number of Miller-Rabin iterations
|
||||||
|
* that will be done for checking that a random number is probably prime. The
|
||||||
|
* error rate for accepting a composite number as prime depends on the size of
|
||||||
|
* the prime |b|. The error rates used are for calculating an RSA key with 2 primes,
|
||||||
|
* and so the level is what you would expect for a key of double the size of the
|
||||||
|
* prime.
|
||||||
|
*
|
||||||
|
* This table is generated using the algorithm of FIPS PUB 186-4
|
||||||
|
* Digital Signature Standard (DSS), section F.1, page 117.
|
||||||
|
* (https://dx.doi.org/10.6028/NIST.FIPS.186-4)
|
||||||
|
*
|
||||||
|
* The following magma script was used to generate the output:
|
||||||
|
* securitybits:=125;
|
||||||
|
* k:=1024;
|
||||||
|
* for t:=1 to 65 do
|
||||||
|
* for M:=3 to Floor(2*Sqrt(k-1)-1) do
|
||||||
|
* S:=0;
|
||||||
|
* // Sum over m
|
||||||
|
* for m:=3 to M do
|
||||||
|
* s:=0;
|
||||||
|
* // Sum over j
|
||||||
|
* for j:=2 to m do
|
||||||
|
* s+:=(RealField(32)!2)^-(j+(k-1)/j);
|
||||||
|
* end for;
|
||||||
|
* S+:=2^(m-(m-1)*t)*s;
|
||||||
|
* end for;
|
||||||
|
* A:=2^(k-2-M*t);
|
||||||
|
* B:=8*(Pi(RealField(32))^2-6)/3*2^(k-2)*S;
|
||||||
|
* pkt:=2.00743*Log(2)*k*2^-k*(A+B);
|
||||||
|
* seclevel:=Floor(-Log(2,pkt));
|
||||||
|
* if seclevel ge securitybits then
|
||||||
|
* printf "k: %5o, security: %o bits (t: %o, M: %o)\n",k,seclevel,t,M;
|
||||||
|
* break;
|
||||||
|
* end if;
|
||||||
|
* end for;
|
||||||
|
* if seclevel ge securitybits then break; end if;
|
||||||
|
* end for;
|
||||||
|
*
|
||||||
|
* It can be run online at:
|
||||||
|
* http://magma.maths.usyd.edu.au/calc
|
||||||
|
*
|
||||||
|
* And will output:
|
||||||
|
* k: 1024, security: 129 bits (t: 6, M: 23)
|
||||||
|
*
|
||||||
|
* k is the number of bits of the prime, securitybits is the level we want to
|
||||||
|
* reach.
|
||||||
|
*
|
||||||
|
* prime length | RSA key size | # MR tests | security level
|
||||||
|
* -------------+--------------|------------+---------------
|
||||||
|
* (b) >= 6394 | >= 12788 | 3 | 256 bit
|
||||||
|
* (b) >= 3747 | >= 7494 | 3 | 192 bit
|
||||||
|
* (b) >= 1345 | >= 2690 | 4 | 128 bit
|
||||||
|
* (b) >= 1080 | >= 2160 | 5 | 128 bit
|
||||||
|
* (b) >= 852 | >= 1704 | 5 | 112 bit
|
||||||
|
* (b) >= 476 | >= 952 | 5 | 80 bit
|
||||||
|
* (b) >= 400 | >= 800 | 6 | 80 bit
|
||||||
|
* (b) >= 347 | >= 694 | 7 | 80 bit
|
||||||
|
* (b) >= 308 | >= 616 | 8 | 80 bit
|
||||||
|
* (b) >= 55 | >= 110 | 27 | 64 bit
|
||||||
|
* (b) >= 6 | >= 12 | 34 | 64 bit
|
||||||
|
*/
|
||||||
|
|
||||||
|
# define BN_prime_checks_for_size(b) ((b) >= 3747 ? 3 : \
|
||||||
|
(b) >= 1345 ? 4 : \
|
||||||
|
(b) >= 476 ? 5 : \
|
||||||
|
(b) >= 400 ? 6 : \
|
||||||
|
(b) >= 347 ? 7 : \
|
||||||
|
(b) >= 308 ? 8 : \
|
||||||
|
(b) >= 55 ? 27 : \
|
||||||
|
/* b >= 6 */ 34)
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
|
||||||
|
|
||||||
|
int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w);
|
||||||
|
int BN_is_zero(const BIGNUM *a);
|
||||||
|
int BN_is_one(const BIGNUM *a);
|
||||||
|
int BN_is_word(const BIGNUM *a, const BN_ULONG w);
|
||||||
|
int BN_is_odd(const BIGNUM *a);
|
||||||
|
|
||||||
|
# define BN_one(a) (BN_set_word((a),1))
|
||||||
|
|
||||||
|
void BN_zero_ex(BIGNUM *a);
|
||||||
|
|
||||||
|
# if OPENSSL_API_LEVEL > 908
|
||||||
|
# define BN_zero(a) BN_zero_ex(a)
|
||||||
|
# else
|
||||||
|
# define BN_zero(a) (BN_set_word((a),0))
|
||||||
|
# endif
|
||||||
|
|
||||||
|
const BIGNUM *BN_value_one(void);
|
||||||
|
char *BN_options(void);
|
||||||
|
BN_CTX *BN_CTX_new_ex(OSSL_LIB_CTX *ctx);
|
||||||
|
BN_CTX *BN_CTX_new(void);
|
||||||
|
BN_CTX *BN_CTX_secure_new_ex(OSSL_LIB_CTX *ctx);
|
||||||
|
BN_CTX *BN_CTX_secure_new(void);
|
||||||
|
void BN_CTX_free(BN_CTX *c);
|
||||||
|
void BN_CTX_start(BN_CTX *ctx);
|
||||||
|
BIGNUM *BN_CTX_get(BN_CTX *ctx);
|
||||||
|
void BN_CTX_end(BN_CTX *ctx);
|
||||||
|
int BN_rand_ex(BIGNUM *rnd, int bits, int top, int bottom,
|
||||||
|
unsigned int strength, BN_CTX *ctx);
|
||||||
|
int BN_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||||
|
int BN_priv_rand_ex(BIGNUM *rnd, int bits, int top, int bottom,
|
||||||
|
unsigned int strength, BN_CTX *ctx);
|
||||||
|
int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||||
|
int BN_rand_range_ex(BIGNUM *r, const BIGNUM *range, unsigned int strength,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
int BN_rand_range(BIGNUM *rnd, const BIGNUM *range);
|
||||||
|
int BN_priv_rand_range_ex(BIGNUM *r, const BIGNUM *range,
|
||||||
|
unsigned int strength, BN_CTX *ctx);
|
||||||
|
int BN_priv_rand_range(BIGNUM *rnd, const BIGNUM *range);
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range);
|
||||||
|
# endif
|
||||||
|
int BN_num_bits(const BIGNUM *a);
|
||||||
|
int BN_num_bits_word(BN_ULONG l);
|
||||||
|
int BN_security_bits(int L, int N);
|
||||||
|
BIGNUM *BN_new(void);
|
||||||
|
BIGNUM *BN_secure_new(void);
|
||||||
|
void BN_clear_free(BIGNUM *a);
|
||||||
|
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b);
|
||||||
|
void BN_swap(BIGNUM *a, BIGNUM *b);
|
||||||
|
BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||||
|
int BN_bn2bin(const BIGNUM *a, unsigned char *to);
|
||||||
|
int BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen);
|
||||||
|
BIGNUM *BN_lebin2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||||
|
int BN_bn2lebinpad(const BIGNUM *a, unsigned char *to, int tolen);
|
||||||
|
BIGNUM *BN_native2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||||
|
int BN_bn2nativepad(const BIGNUM *a, unsigned char *to, int tolen);
|
||||||
|
BIGNUM *BN_mpi2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||||
|
int BN_bn2mpi(const BIGNUM *a, unsigned char *to);
|
||||||
|
int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||||
|
int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||||
|
int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||||
|
int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||||
|
int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
|
||||||
|
int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx);
|
||||||
|
/** BN_set_negative sets sign of a BIGNUM
|
||||||
|
* \param b pointer to the BIGNUM object
|
||||||
|
* \param n 0 if the BIGNUM b should be positive and a value != 0 otherwise
|
||||||
|
*/
|
||||||
|
void BN_set_negative(BIGNUM *b, int n);
|
||||||
|
/** BN_is_negative returns 1 if the BIGNUM is negative
|
||||||
|
* \param b pointer to the BIGNUM object
|
||||||
|
* \return 1 if a < 0 and 0 otherwise
|
||||||
|
*/
|
||||||
|
int BN_is_negative(const BIGNUM *b);
|
||||||
|
|
||||||
|
int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))
|
||||||
|
int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx);
|
||||||
|
int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||||
|
const BIGNUM *m);
|
||||||
|
int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||||
|
const BIGNUM *m);
|
||||||
|
int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
|
||||||
|
int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
|
||||||
|
int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m);
|
||||||
|
int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m);
|
||||||
|
|
||||||
|
BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w);
|
||||||
|
BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w);
|
||||||
|
int BN_mul_word(BIGNUM *a, BN_ULONG w);
|
||||||
|
int BN_add_word(BIGNUM *a, BN_ULONG w);
|
||||||
|
int BN_sub_word(BIGNUM *a, BN_ULONG w);
|
||||||
|
int BN_set_word(BIGNUM *a, BN_ULONG w);
|
||||||
|
BN_ULONG BN_get_word(const BIGNUM *a);
|
||||||
|
|
||||||
|
int BN_cmp(const BIGNUM *a, const BIGNUM *b);
|
||||||
|
void BN_free(BIGNUM *a);
|
||||||
|
int BN_is_bit_set(const BIGNUM *a, int n);
|
||||||
|
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n);
|
||||||
|
int BN_lshift1(BIGNUM *r, const BIGNUM *a);
|
||||||
|
int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||||
|
|
||||||
|
int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||||
|
const BIGNUM *m, BN_CTX *ctx);
|
||||||
|
int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||||
|
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
|
||||||
|
int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
||||||
|
const BIGNUM *m, BN_CTX *ctx,
|
||||||
|
BN_MONT_CTX *in_mont);
|
||||||
|
int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p,
|
||||||
|
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
|
||||||
|
int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1,
|
||||||
|
const BIGNUM *a2, const BIGNUM *p2, const BIGNUM *m,
|
||||||
|
BN_CTX *ctx, BN_MONT_CTX *m_ctx);
|
||||||
|
int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||||
|
const BIGNUM *m, BN_CTX *ctx);
|
||||||
|
int BN_mod_exp_mont_consttime_x2(BIGNUM *rr1, const BIGNUM *a1, const BIGNUM *p1,
|
||||||
|
const BIGNUM *m1, BN_MONT_CTX *in_mont1,
|
||||||
|
BIGNUM *rr2, const BIGNUM *a2, const BIGNUM *p2,
|
||||||
|
const BIGNUM *m2, BN_MONT_CTX *in_mont2,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
|
||||||
|
int BN_mask_bits(BIGNUM *a, int n);
|
||||||
|
# ifndef OPENSSL_NO_STDIO
|
||||||
|
int BN_print_fp(FILE *fp, const BIGNUM *a);
|
||||||
|
# endif
|
||||||
|
int BN_print(BIO *bio, const BIGNUM *a);
|
||||||
|
int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx);
|
||||||
|
int BN_rshift(BIGNUM *r, const BIGNUM *a, int n);
|
||||||
|
int BN_rshift1(BIGNUM *r, const BIGNUM *a);
|
||||||
|
void BN_clear(BIGNUM *a);
|
||||||
|
BIGNUM *BN_dup(const BIGNUM *a);
|
||||||
|
int BN_ucmp(const BIGNUM *a, const BIGNUM *b);
|
||||||
|
int BN_set_bit(BIGNUM *a, int n);
|
||||||
|
int BN_clear_bit(BIGNUM *a, int n);
|
||||||
|
char *BN_bn2hex(const BIGNUM *a);
|
||||||
|
char *BN_bn2dec(const BIGNUM *a);
|
||||||
|
int BN_hex2bn(BIGNUM **a, const char *str);
|
||||||
|
int BN_dec2bn(BIGNUM **a, const char *str);
|
||||||
|
int BN_asc2bn(BIGNUM **a, const char *str);
|
||||||
|
int BN_gcd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
|
||||||
|
int BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); /* returns
|
||||||
|
* -2 for
|
||||||
|
* error */
|
||||||
|
int BN_are_coprime(BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
|
||||||
|
BIGNUM *BN_mod_inverse(BIGNUM *ret,
|
||||||
|
const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);
|
||||||
|
BIGNUM *BN_mod_sqrt(BIGNUM *ret,
|
||||||
|
const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);
|
||||||
|
|
||||||
|
void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords);
|
||||||
|
|
||||||
|
/* Deprecated versions */
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_0_9_8
|
||||||
|
OSSL_DEPRECATEDIN_0_9_8
|
||||||
|
BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe,
|
||||||
|
const BIGNUM *add, const BIGNUM *rem,
|
||||||
|
void (*callback) (int, int, void *),
|
||||||
|
void *cb_arg);
|
||||||
|
OSSL_DEPRECATEDIN_0_9_8
|
||||||
|
int BN_is_prime(const BIGNUM *p, int nchecks,
|
||||||
|
void (*callback) (int, int, void *),
|
||||||
|
BN_CTX *ctx, void *cb_arg);
|
||||||
|
OSSL_DEPRECATEDIN_0_9_8
|
||||||
|
int BN_is_prime_fasttest(const BIGNUM *p, int nchecks,
|
||||||
|
void (*callback) (int, int, void *),
|
||||||
|
BN_CTX *ctx, void *cb_arg,
|
||||||
|
int do_trial_division);
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int BN_is_prime_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, BN_GENCB *cb);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int BN_is_prime_fasttest_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx,
|
||||||
|
int do_trial_division, BN_GENCB *cb);
|
||||||
|
# endif
|
||||||
|
/* Newer versions */
|
||||||
|
int BN_generate_prime_ex2(BIGNUM *ret, int bits, int safe,
|
||||||
|
const BIGNUM *add, const BIGNUM *rem, BN_GENCB *cb,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add,
|
||||||
|
const BIGNUM *rem, BN_GENCB *cb);
|
||||||
|
int BN_check_prime(const BIGNUM *p, BN_CTX *ctx, BN_GENCB *cb);
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx);
|
||||||
|
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2,
|
||||||
|
const BIGNUM *Xp, const BIGNUM *Xp1,
|
||||||
|
const BIGNUM *Xp2, const BIGNUM *e, BN_CTX *ctx,
|
||||||
|
BN_GENCB *cb);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, BIGNUM *Xp1,
|
||||||
|
BIGNUM *Xp2, const BIGNUM *Xp, const BIGNUM *e,
|
||||||
|
BN_CTX *ctx, BN_GENCB *cb);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
BN_MONT_CTX *BN_MONT_CTX_new(void);
|
||||||
|
int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||||
|
BN_MONT_CTX *mont, BN_CTX *ctx);
|
||||||
|
int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
int BN_from_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
void BN_MONT_CTX_free(BN_MONT_CTX *mont);
|
||||||
|
int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx);
|
||||||
|
BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from);
|
||||||
|
BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock,
|
||||||
|
const BIGNUM *mod, BN_CTX *ctx);
|
||||||
|
|
||||||
|
/* BN_BLINDING flags */
|
||||||
|
# define BN_BLINDING_NO_UPDATE 0x00000001
|
||||||
|
# define BN_BLINDING_NO_RECREATE 0x00000002
|
||||||
|
|
||||||
|
BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod);
|
||||||
|
void BN_BLINDING_free(BN_BLINDING *b);
|
||||||
|
int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx);
|
||||||
|
int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
|
||||||
|
int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
|
||||||
|
int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *);
|
||||||
|
int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b,
|
||||||
|
BN_CTX *);
|
||||||
|
|
||||||
|
int BN_BLINDING_is_current_thread(BN_BLINDING *b);
|
||||||
|
void BN_BLINDING_set_current_thread(BN_BLINDING *b);
|
||||||
|
int BN_BLINDING_lock(BN_BLINDING *b);
|
||||||
|
int BN_BLINDING_unlock(BN_BLINDING *b);
|
||||||
|
|
||||||
|
unsigned long BN_BLINDING_get_flags(const BN_BLINDING *);
|
||||||
|
void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long);
|
||||||
|
BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
|
||||||
|
const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
|
||||||
|
int (*bn_mod_exp) (BIGNUM *r,
|
||||||
|
const BIGNUM *a,
|
||||||
|
const BIGNUM *p,
|
||||||
|
const BIGNUM *m,
|
||||||
|
BN_CTX *ctx,
|
||||||
|
BN_MONT_CTX *m_ctx),
|
||||||
|
BN_MONT_CTX *m_ctx);
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_0_9_8
|
||||||
|
OSSL_DEPRECATEDIN_0_9_8
|
||||||
|
void BN_set_params(int mul, int high, int low, int mont);
|
||||||
|
OSSL_DEPRECATEDIN_0_9_8
|
||||||
|
int BN_get_params(int which); /* 0, mul, 1 high, 2 low, 3 mont */
|
||||||
|
# endif
|
||||||
|
|
||||||
|
BN_RECP_CTX *BN_RECP_CTX_new(void);
|
||||||
|
void BN_RECP_CTX_free(BN_RECP_CTX *recp);
|
||||||
|
int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *rdiv, BN_CTX *ctx);
|
||||||
|
int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y,
|
||||||
|
BN_RECP_CTX *recp, BN_CTX *ctx);
|
||||||
|
int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||||
|
const BIGNUM *m, BN_CTX *ctx);
|
||||||
|
int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
|
||||||
|
BN_RECP_CTX *recp, BN_CTX *ctx);
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_EC2M
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Functions for arithmetic over binary polynomials represented by BIGNUMs.
|
||||||
|
* The BIGNUM::neg property of BIGNUMs representing binary polynomials is
|
||||||
|
* ignored. Note that input arguments are not const so that their bit arrays
|
||||||
|
* can be expanded to the appropriate size if needed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* r = a + b
|
||||||
|
*/
|
||||||
|
int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||||
|
# define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b)
|
||||||
|
/*
|
||||||
|
* r=a mod p
|
||||||
|
*/
|
||||||
|
int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p);
|
||||||
|
/* r = (a * b) mod p */
|
||||||
|
int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||||
|
const BIGNUM *p, BN_CTX *ctx);
|
||||||
|
/* r = (a * a) mod p */
|
||||||
|
int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||||
|
/* r = (1 / b) mod p */
|
||||||
|
int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx);
|
||||||
|
/* r = (a / b) mod p */
|
||||||
|
int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||||
|
const BIGNUM *p, BN_CTX *ctx);
|
||||||
|
/* r = (a ^ b) mod p */
|
||||||
|
int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||||
|
const BIGNUM *p, BN_CTX *ctx);
|
||||||
|
/* r = sqrt(a) mod p */
|
||||||
|
int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
/* r^2 + r = a mod p */
|
||||||
|
int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
# define BN_GF2m_cmp(a, b) BN_ucmp((a), (b))
|
||||||
|
/*-
|
||||||
|
* Some functions allow for representation of the irreducible polynomials
|
||||||
|
* as an unsigned int[], say p. The irreducible f(t) is then of the form:
|
||||||
|
* t^p[0] + t^p[1] + ... + t^p[k]
|
||||||
|
* where m = p[0] > p[1] > ... > p[k] = 0.
|
||||||
|
*/
|
||||||
|
/* r = a mod p */
|
||||||
|
int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]);
|
||||||
|
/* r = (a * b) mod p */
|
||||||
|
int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||||
|
const int p[], BN_CTX *ctx);
|
||||||
|
/* r = (a * a) mod p */
|
||||||
|
int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[],
|
||||||
|
BN_CTX *ctx);
|
||||||
|
/* r = (1 / b) mod p */
|
||||||
|
int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const int p[],
|
||||||
|
BN_CTX *ctx);
|
||||||
|
/* r = (a / b) mod p */
|
||||||
|
int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||||
|
const int p[], BN_CTX *ctx);
|
||||||
|
/* r = (a ^ b) mod p */
|
||||||
|
int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||||
|
const int p[], BN_CTX *ctx);
|
||||||
|
/* r = sqrt(a) mod p */
|
||||||
|
int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a,
|
||||||
|
const int p[], BN_CTX *ctx);
|
||||||
|
/* r^2 + r = a mod p */
|
||||||
|
int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a,
|
||||||
|
const int p[], BN_CTX *ctx);
|
||||||
|
int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max);
|
||||||
|
int BN_GF2m_arr2poly(const int p[], BIGNUM *a);
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* faster mod functions for the 'NIST primes' 0 <= a < p^2
|
||||||
|
*/
|
||||||
|
int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||||
|
int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||||
|
int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||||
|
int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||||
|
int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||||
|
|
||||||
|
const BIGNUM *BN_get0_nist_prime_192(void);
|
||||||
|
const BIGNUM *BN_get0_nist_prime_224(void);
|
||||||
|
const BIGNUM *BN_get0_nist_prime_256(void);
|
||||||
|
const BIGNUM *BN_get0_nist_prime_384(void);
|
||||||
|
const BIGNUM *BN_get0_nist_prime_521(void);
|
||||||
|
|
||||||
|
int (*BN_nist_mod_func(const BIGNUM *p)) (BIGNUM *r, const BIGNUM *a,
|
||||||
|
const BIGNUM *field, BN_CTX *ctx);
|
||||||
|
|
||||||
|
int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range,
|
||||||
|
const BIGNUM *priv, const unsigned char *message,
|
||||||
|
size_t message_len, BN_CTX *ctx);
|
||||||
|
|
||||||
|
/* Primes from RFC 2409 */
|
||||||
|
BIGNUM *BN_get_rfc2409_prime_768(BIGNUM *bn);
|
||||||
|
BIGNUM *BN_get_rfc2409_prime_1024(BIGNUM *bn);
|
||||||
|
|
||||||
|
/* Primes from RFC 3526 */
|
||||||
|
BIGNUM *BN_get_rfc3526_prime_1536(BIGNUM *bn);
|
||||||
|
BIGNUM *BN_get_rfc3526_prime_2048(BIGNUM *bn);
|
||||||
|
BIGNUM *BN_get_rfc3526_prime_3072(BIGNUM *bn);
|
||||||
|
BIGNUM *BN_get_rfc3526_prime_4096(BIGNUM *bn);
|
||||||
|
BIGNUM *BN_get_rfc3526_prime_6144(BIGNUM *bn);
|
||||||
|
BIGNUM *BN_get_rfc3526_prime_8192(BIGNUM *bn);
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||||
|
# define get_rfc2409_prime_768 BN_get_rfc2409_prime_768
|
||||||
|
# define get_rfc2409_prime_1024 BN_get_rfc2409_prime_1024
|
||||||
|
# define get_rfc3526_prime_1536 BN_get_rfc3526_prime_1536
|
||||||
|
# define get_rfc3526_prime_2048 BN_get_rfc3526_prime_2048
|
||||||
|
# define get_rfc3526_prime_3072 BN_get_rfc3526_prime_3072
|
||||||
|
# define get_rfc3526_prime_4096 BN_get_rfc3526_prime_4096
|
||||||
|
# define get_rfc3526_prime_6144 BN_get_rfc3526_prime_6144
|
||||||
|
# define get_rfc3526_prime_8192 BN_get_rfc3526_prime_8192
|
||||||
|
# endif
|
||||||
|
|
||||||
|
int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||||
|
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif
|
|
@ -0,0 +1,19 @@
|
||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Visual C++ generated include file.
|
||||||
|
// Used by resource.rc
|
||||||
|
//
|
||||||
|
#define IDI_ICON1 101
|
||||||
|
#define IDR_WAVE1 102
|
||||||
|
#define IDB_BITMAP1 103
|
||||||
|
#define IDB_BITMAP2 104
|
||||||
|
|
||||||
|
// Next default values for new objects
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 105
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
|
#endif
|
||||||
|
#endif
|
Binary file not shown.
|
@ -0,0 +1,4 @@
|
||||||
|
[ViewState]
|
||||||
|
Mode=
|
||||||
|
Vid=
|
||||||
|
FolderType=Generic
|
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
Binary file not shown.
After Width: | Height: | Size: 9.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 253 KiB |
Binary file not shown.
After Width: | Height: | Size: 352 KiB |
Binary file not shown.
|
@ -0,0 +1,448 @@
|
||||||
|
//
|
||||||
|
// Created by Andrew on 10/04/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <commctrl.h>
|
||||||
|
#include <mmsystem.h>
|
||||||
|
#include <objidl.h>
|
||||||
|
#include <gdiplus.h>
|
||||||
|
|
||||||
|
#include "header.h"
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
HWND hMainWindow;
|
||||||
|
|
||||||
|
const WCHAR *pAboutLink = L"http://github.com/Endermanch/XPKeygen";
|
||||||
|
|
||||||
|
void InitializeFonts(HFONT *hLabelFont, HFONT *hSmolFont, HFONT *hBoldFont, HFONT *hCaptionFont) {
|
||||||
|
NONCLIENTMETRICSW nonClientMetrics;
|
||||||
|
|
||||||
|
// Get information about the default system font.
|
||||||
|
nonClientMetrics.cbSize = sizeof(NONCLIENTMETRICSW);
|
||||||
|
SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSW), &nonClientMetrics, 0);
|
||||||
|
|
||||||
|
ULONG defaultHeight = nonClientMetrics.lfMessageFont.lfHeight;
|
||||||
|
|
||||||
|
// Create default font.
|
||||||
|
*hLabelFont = CreateFontIndirectW(&nonClientMetrics.lfMessageFont);
|
||||||
|
|
||||||
|
// Create smol font.
|
||||||
|
nonClientMetrics.lfMessageFont.lfHeight = 12;
|
||||||
|
*hSmolFont = CreateFontIndirectW(&nonClientMetrics.lfMessageFont);
|
||||||
|
|
||||||
|
// Create bold font.
|
||||||
|
nonClientMetrics.lfMessageFont.lfWeight = 700;
|
||||||
|
nonClientMetrics.lfMessageFont.lfHeight = defaultHeight;
|
||||||
|
*hBoldFont = CreateFontIndirectW(&nonClientMetrics.lfMessageFont);
|
||||||
|
|
||||||
|
// Create caption font.
|
||||||
|
nonClientMetrics.lfMessageFont.lfHeight = 30;
|
||||||
|
*hCaptionFont = CreateFontIndirectW(&nonClientMetrics.lfMessageFont);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PlayAudio(HINSTANCE hInstance, WCHAR *lpName, UINT bFlags) {
|
||||||
|
HANDLE hResInfo = FindResourceW(hInstance, lpName, L"WAVE");
|
||||||
|
|
||||||
|
if (hResInfo == nullptr)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
HANDLE hRes = LoadResource(hInstance, (HRSRC)hResInfo);
|
||||||
|
|
||||||
|
if (hRes == nullptr)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
WCHAR *lpRes = (WCHAR *)LockResource(hRes);
|
||||||
|
FreeResource(hRes);
|
||||||
|
|
||||||
|
return sndPlaySoundW(lpRes, SND_MEMORY | bFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CALLBACK WNDProc(HWND hWindow, UINT uMessage, WPARAM wParam, LPARAM lParam) {
|
||||||
|
|
||||||
|
switch (uMessage) {
|
||||||
|
case WM_CREATE:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_CTLCOLORSTATIC:
|
||||||
|
if ((HWND)lParam == GetDlgItem(hWindow, IDC_EDIT1)) {
|
||||||
|
SetBkMode((HDC)wParam, TRANSPARENT);
|
||||||
|
SetTextColor((HDC)wParam, RGB(255, 255, 0));
|
||||||
|
return (LRESULT)((HBRUSH)GetStockObject(BLACK_BRUSH));
|
||||||
|
}
|
||||||
|
else goto execute;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_CHAR:
|
||||||
|
if (LOWORD(wParam) == VK_TAB)
|
||||||
|
SetFocus(GetNextDlgTabItem(hWindow, NULL, FALSE));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_COMMAND:
|
||||||
|
switch (LOWORD(wParam)) {
|
||||||
|
case IDC_BUTTON1: {
|
||||||
|
ShellExecuteW(hWindow, L"open", pAboutLink, nullptr, nullptr, SW_SHOWNORMAL);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case IDC_BUTTON2: {
|
||||||
|
HWND hEdit = GetDlgItem(hMainWindow, IDC_EDIT1);
|
||||||
|
HWND hInput1 = GetDlgItem(hMainWindow, IDC_INPUT1);
|
||||||
|
HWND hInput2 = GetDlgItem(hMainWindow, IDC_INPUT2);
|
||||||
|
|
||||||
|
WCHAR pBSection[4]{}, pCSection[8]{}, pFPK[32]{};
|
||||||
|
|
||||||
|
SendMessageW(hInput1, WM_GETTEXT, 3 + NULL_TERMINATOR, (LPARAM)pBSection);
|
||||||
|
SendMessageW(hInput2, WM_GETTEXT, 6 + NULL_TERMINATOR, (LPARAM)pCSection);
|
||||||
|
|
||||||
|
int pSSection = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < 6; i++)
|
||||||
|
pSSection -= pCSection[i] - '0';
|
||||||
|
|
||||||
|
while (pSSection < 0)
|
||||||
|
pSSection += 7;
|
||||||
|
|
||||||
|
ul32 msDigits = _wtoi(pBSection),
|
||||||
|
lsDigits = _wtoi(pCSection);
|
||||||
|
|
||||||
|
ul32 nRPK = msDigits * 1'000'000 + lsDigits,
|
||||||
|
hash = 0,
|
||||||
|
sig[2]{};
|
||||||
|
|
||||||
|
CHAR pKey[PK_LENGTH + NULL_TERMINATOR]{};
|
||||||
|
|
||||||
|
keyXP(pKey, &hash, sig, nRPK);
|
||||||
|
|
||||||
|
for (int i = 0; i < 5; i++)
|
||||||
|
wsprintfW(pFPK, L"%s%s%.5S", pFPK, i != 0 ? L"-" : L"", &pKey[5 * i]);
|
||||||
|
|
||||||
|
WCHAR *pText = (WCHAR *)calloc(512 + 4 + 9 + 5 * NULL_TERMINATOR, sizeof(WCHAR));
|
||||||
|
|
||||||
|
wsprintfW(
|
||||||
|
pText,
|
||||||
|
L"%s%sProduct ID: PPPPP-%03d-%06d%d-23XXX\r\nHash: %08lX\r\nSignature: %08lX-%08lX\r\n\r\n%s\r\n",
|
||||||
|
pText,
|
||||||
|
wcslen(pText) ? L"\r\n" : L"",
|
||||||
|
nRPK / 1'000'000,
|
||||||
|
nRPK % 1'000'000,
|
||||||
|
pSSection,
|
||||||
|
hash,
|
||||||
|
sig[1], sig[0],
|
||||||
|
pFPK
|
||||||
|
);
|
||||||
|
|
||||||
|
SendMessageW(hEdit, WM_SETTEXT, 0, (LPARAM)pText);
|
||||||
|
|
||||||
|
free(pText);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
case IDC_BUTTON3: {
|
||||||
|
DestroyWindow(hWindow);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
case IDC_BUTTON4: {
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_CLOSE:
|
||||||
|
DestroyWindow(hWindow);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_DESTROY:
|
||||||
|
PostQuitMessage(0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
execute:
|
||||||
|
default:
|
||||||
|
return DefWindowProc(hWindow, uMessage, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool InitializeWindow(HINSTANCE hInstance) {
|
||||||
|
HFONT hLabelFont,
|
||||||
|
hSmolFont,
|
||||||
|
hCaptionFont,
|
||||||
|
hBoldFont;
|
||||||
|
|
||||||
|
WNDCLASSEX wndClass{};
|
||||||
|
|
||||||
|
// Register the main window class.
|
||||||
|
wndClass.cbSize = sizeof(WNDCLASSEX);
|
||||||
|
wndClass.hInstance = hInstance;
|
||||||
|
wndClass.lpfnWndProc = (WNDPROC)WNDProc;
|
||||||
|
wndClass.lpszClassName = L"XPKeygen";
|
||||||
|
wndClass.hbrBackground = (HBRUSH)COLOR_WINDOW;
|
||||||
|
wndClass.style = CS_HREDRAW | CS_VREDRAW;
|
||||||
|
wndClass.hIcon = LoadIconW(nullptr, MAKEINTRESOURCEW(IDI_ICON1));
|
||||||
|
wndClass.hIconSm = LoadIconW(hInstance, MAKEINTRESOURCEW(IDI_ICON1));
|
||||||
|
wndClass.hCursor = LoadCursorW(nullptr, IDC_ARROW);
|
||||||
|
|
||||||
|
if (!RegisterClassExW(&wndClass))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
InitializeFonts(&hLabelFont, &hSmolFont, &hBoldFont, &hCaptionFont);
|
||||||
|
|
||||||
|
const int w = 615,
|
||||||
|
h = 480,
|
||||||
|
x = (GetSystemMetrics(SM_CXSCREEN) - w) / 2,
|
||||||
|
y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2;
|
||||||
|
|
||||||
|
hMainWindow = CreateWindowExW(
|
||||||
|
0,
|
||||||
|
L"XPKeygen",
|
||||||
|
L"Windows XP VLK // Server 2003 - Enderman[ch]",
|
||||||
|
WS_SYSMENU,
|
||||||
|
x, y,
|
||||||
|
w, h,
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
hInstance,
|
||||||
|
nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
HDC hMainDC = GetDC(hMainWindow);
|
||||||
|
|
||||||
|
// Select the default font.
|
||||||
|
SelectObject(hMainDC, hLabelFont);
|
||||||
|
|
||||||
|
HBITMAP hBitmap = (HBITMAP)LoadImageW(hInstance, MAKEINTRESOURCEW(IDB_BITMAP2), IMAGE_BITMAP, 0, 0, 0);
|
||||||
|
|
||||||
|
HWND hLogo = CreateWindowExW(
|
||||||
|
0,
|
||||||
|
L"Static", nullptr,
|
||||||
|
WS_CHILD | WS_VISIBLE |
|
||||||
|
SS_BITMAP | SS_REALSIZEIMAGE,
|
||||||
|
0, 0,
|
||||||
|
600, 0,
|
||||||
|
hMainWindow, (HMENU)IDC_IMAGE1,
|
||||||
|
hInstance, nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
SendMessageW(hLogo, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap);
|
||||||
|
|
||||||
|
HWND hGroupBox = CreateWindowExW(
|
||||||
|
0,
|
||||||
|
L"Button", L"Windows XP Pro VLK x86 // Server 2003 + SP2 x64",
|
||||||
|
WS_CHILD | WS_VISIBLE |
|
||||||
|
BS_GROUPBOX,
|
||||||
|
10, 150,
|
||||||
|
w - 36, h - 200,
|
||||||
|
hMainWindow, nullptr,
|
||||||
|
hInstance, nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
SendMessageW(hGroupBox, WM_SETFONT, (WPARAM)hCaptionFont, 0);
|
||||||
|
|
||||||
|
HWND hRPKLabel = CreateWindowExW(
|
||||||
|
0,
|
||||||
|
L"Static", L"Raw Product Key:",
|
||||||
|
WS_CHILD | WS_VISIBLE,
|
||||||
|
20, 190,
|
||||||
|
100, 16,
|
||||||
|
hMainWindow, nullptr,
|
||||||
|
hInstance, nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
SendMessageW(hRPKLabel, WM_SETFONT, (WPARAM)hBoldFont, 0);
|
||||||
|
|
||||||
|
HWND hInput1 = CreateWindowExW(
|
||||||
|
0,
|
||||||
|
L"Edit",
|
||||||
|
L"",
|
||||||
|
WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP |
|
||||||
|
ES_LEFT | ES_NUMBER,
|
||||||
|
130, 189,
|
||||||
|
40, 20,
|
||||||
|
hMainWindow,
|
||||||
|
(HMENU)IDC_INPUT1,
|
||||||
|
hInstance,
|
||||||
|
nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
SendMessageW(hInput1, EM_SETCUEBANNER, 0, (LPARAM)L"BBB");
|
||||||
|
SendMessageW(hInput1, WM_SETFONT, (WPARAM)hLabelFont, 0);
|
||||||
|
|
||||||
|
SendMessageW(hInput1, EM_SETLIMITTEXT, (WPARAM)3, 0);
|
||||||
|
|
||||||
|
HWND hRPKDash = CreateWindowExW(
|
||||||
|
0,
|
||||||
|
L"Static", L"-",
|
||||||
|
WS_CHILD | WS_VISIBLE,
|
||||||
|
173, 190,
|
||||||
|
10, 16,
|
||||||
|
hMainWindow, nullptr,
|
||||||
|
hInstance, nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
SendMessageW(hRPKDash, WM_SETFONT, (WPARAM)hBoldFont, 0);
|
||||||
|
|
||||||
|
HWND hInput2 = CreateWindowExW(
|
||||||
|
0,
|
||||||
|
L"Edit",
|
||||||
|
L"",
|
||||||
|
WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP |
|
||||||
|
ES_LEFT | ES_NUMBER,
|
||||||
|
181, 189,
|
||||||
|
70, 20,
|
||||||
|
hMainWindow,
|
||||||
|
(HMENU)IDC_INPUT2,
|
||||||
|
hInstance,
|
||||||
|
nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
SendMessageW(hInput2, EM_SETCUEBANNER, 0, (LPARAM)L"CCCCCC");
|
||||||
|
SendMessageW(hInput2, WM_SETFONT, (WPARAM)hLabelFont, 0);
|
||||||
|
|
||||||
|
SendMessageW(hInput2, EM_SETLIMITTEXT, (WPARAM)6, 0);
|
||||||
|
|
||||||
|
HWND hRandomize = CreateWindowExW(
|
||||||
|
0,
|
||||||
|
L"Button",
|
||||||
|
L"Randomize",
|
||||||
|
WS_CHILD | WS_VISIBLE | WS_TABSTOP,
|
||||||
|
260, 188,
|
||||||
|
75, 22,
|
||||||
|
hMainWindow,
|
||||||
|
(HMENU)IDC_BUTTON4,
|
||||||
|
hInstance,
|
||||||
|
nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
SendMessageW(hRandomize, WM_SETFONT, (WPARAM)hLabelFont, 0);
|
||||||
|
|
||||||
|
HWND hVersionLabel = CreateWindowExW(
|
||||||
|
0,
|
||||||
|
L"Static", L"Version:",
|
||||||
|
WS_CHILD | WS_VISIBLE,
|
||||||
|
20, 220,
|
||||||
|
100, 16,
|
||||||
|
hMainWindow, nullptr,
|
||||||
|
hInstance, nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
SendMessageW(hVersionLabel, WM_SETFONT, (WPARAM)hBoldFont, 0);
|
||||||
|
|
||||||
|
HWND hRadio1 = CreateWindowExW(
|
||||||
|
WS_EX_WINDOWEDGE,
|
||||||
|
L"Button",
|
||||||
|
L"Windows XP VLK",
|
||||||
|
WS_VISIBLE | WS_CHILD | WS_GROUP |
|
||||||
|
BS_AUTORADIOBUTTON,
|
||||||
|
70, 219,
|
||||||
|
120, 20,
|
||||||
|
hMainWindow,
|
||||||
|
(HMENU)IDC_RADIO1,
|
||||||
|
hInstance, NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
SendMessageW(hRadio1, BM_SETCHECK, 1, 0);
|
||||||
|
SendMessageW(hRadio1, WM_SETFONT, (WPARAM)hLabelFont, 0);
|
||||||
|
|
||||||
|
HWND hRadio2 = CreateWindowExW(
|
||||||
|
WS_EX_WINDOWEDGE,
|
||||||
|
L"Button",
|
||||||
|
L"Windows Server 2003 / SP2 x64",
|
||||||
|
WS_VISIBLE | WS_CHILD |
|
||||||
|
BS_AUTORADIOBUTTON,
|
||||||
|
200, 219,
|
||||||
|
180, 20,
|
||||||
|
hMainWindow,
|
||||||
|
(HMENU)IDC_RADIO2,
|
||||||
|
hInstance, NULL);
|
||||||
|
|
||||||
|
SendMessageW(hRadio2, WM_SETFONT, (WPARAM)hLabelFont, 0);
|
||||||
|
|
||||||
|
HWND hEdit = CreateWindowExW(
|
||||||
|
0,
|
||||||
|
L"Edit",
|
||||||
|
L"",
|
||||||
|
WS_CHILD | WS_VISIBLE | WS_BORDER |
|
||||||
|
ES_MULTILINE | ES_READONLY |
|
||||||
|
ES_LEFT | ES_UPPERCASE,
|
||||||
|
20, 250,
|
||||||
|
w - 57, h - 350,
|
||||||
|
hMainWindow,
|
||||||
|
(HMENU)IDC_EDIT1,
|
||||||
|
hInstance,
|
||||||
|
nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
SendMessageW(hEdit, WM_SETFONT, (WPARAM)hBoldFont, 0);
|
||||||
|
|
||||||
|
HWND hInfo = CreateWindowExW(
|
||||||
|
0,
|
||||||
|
L"Button",
|
||||||
|
L"About",
|
||||||
|
WS_CHILD | WS_VISIBLE | WS_TABSTOP,
|
||||||
|
44, h - 90,
|
||||||
|
100, 27,
|
||||||
|
hMainWindow,
|
||||||
|
(HMENU)IDC_BUTTON1,
|
||||||
|
hInstance,
|
||||||
|
nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
SendMessageW(hInfo, WM_SETFONT, (WPARAM)hLabelFont, 0);
|
||||||
|
|
||||||
|
HWND hGenerate = CreateWindowExW(
|
||||||
|
0,
|
||||||
|
L"Button",
|
||||||
|
L"Generate",
|
||||||
|
WS_CHILD | WS_VISIBLE | WS_TABSTOP |
|
||||||
|
BS_PUSHBUTTON,
|
||||||
|
250, h - 90,
|
||||||
|
100, 27,
|
||||||
|
hMainWindow,
|
||||||
|
(HMENU)IDC_BUTTON2,
|
||||||
|
hInstance,
|
||||||
|
nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
SendMessageW(hGenerate, WM_SETFONT, (WPARAM)hLabelFont, 0);
|
||||||
|
|
||||||
|
HWND hQuit = CreateWindowExW(
|
||||||
|
0,
|
||||||
|
L"Button",
|
||||||
|
L"Quit",
|
||||||
|
WS_CHILD | WS_VISIBLE | WS_TABSTOP,
|
||||||
|
w - 160, h - 90,
|
||||||
|
100, 27,
|
||||||
|
hMainWindow,
|
||||||
|
(HMENU)IDC_BUTTON3,
|
||||||
|
hInstance,
|
||||||
|
nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
SendMessageW(hQuit, WM_SETFONT, (WPARAM)hLabelFont, 0);
|
||||||
|
|
||||||
|
ShowWindow(hMainWindow, SW_SHOW);
|
||||||
|
UpdateWindow(hMainWindow);
|
||||||
|
|
||||||
|
PlayAudio(hInstance, MAKEINTRESOURCEW(IDR_WAVE1), SND_ASYNC | SND_LOOP | SND_NODEFAULT);
|
||||||
|
|
||||||
|
MSG uMessage;
|
||||||
|
|
||||||
|
while(GetMessageW(&uMessage, nullptr, 0, 0)) {
|
||||||
|
TranslateMessage(&uMessage);
|
||||||
|
DispatchMessageW(&uMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
ReleaseDC(hMainWindow, hMainDC);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
78
xp.cpp
78
xp.cpp
|
@ -4,6 +4,24 @@
|
||||||
|
|
||||||
#include "header.h"
|
#include "header.h"
|
||||||
|
|
||||||
|
const char pXP[] = "92ddcf14cb9e71f4489a2e9ba350ae29454d98cb93bdbcc07d62b502ea12238ee904a8b20d017197aae0c103b32713a9";
|
||||||
|
const long aXP = 1;
|
||||||
|
const long bXP = 0;
|
||||||
|
|
||||||
|
// Base point G (Generator)
|
||||||
|
const char genXXP[] = "46E3775ECE21B0898D39BEA57050D422A0AF989E497962BAEE2CB17E0A28D5360D5476B8DC966443E37A14F1AEF37742";
|
||||||
|
const char genYXP[] = "7C8E741D2C34F4478E325469CD491603D807222C9C4AC09DDB2B31B3CE3F7CC191B3580079932BC6BEF70BE27604F65E";
|
||||||
|
|
||||||
|
// Inverse of the public key
|
||||||
|
const char pubXXP[] = "5D8DBE75198015EC41C45AAB6143542EB098F6A5CC9CE4178A1B8A1E7ABBB5BC64DF64FAF6177DC1B0988AB00BA94BF8";
|
||||||
|
const char pubYXP[] = "23A2909A0B4803C89F910C7191758B48746CEA4D5FF07667444ACDB9512080DBCA55E6EBF30433672B894F44ACE92BFA";
|
||||||
|
|
||||||
|
// The order of G was computed in 18 hours using a Pentium III 450
|
||||||
|
const char genOrderXP[] = "DB6B4C58EFBAFD";
|
||||||
|
|
||||||
|
// The private key was computed in 10 hours using a Pentium III 450
|
||||||
|
const char privateKeyXP[] = "565B0DFF8496C8";
|
||||||
|
|
||||||
/* Unpacks the Product Key. */
|
/* Unpacks the Product Key. */
|
||||||
void unpackXP(ul32 *serial, ul32 *hash, ul32 *sig, ul32 *raw) {
|
void unpackXP(ul32 *serial, ul32 *hash, ul32 *sig, ul32 *raw) {
|
||||||
|
|
||||||
|
@ -159,7 +177,7 @@ void verifyXPKey(EC_GROUP *eCurve, EC_POINT *generator, EC_POINT *publicKey, cha
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generate a valid Product Key. */
|
/* Generate a valid Product Key. */
|
||||||
void generateXPKey(byte *pKey, EC_GROUP *eCurve, EC_POINT *generator, BIGNUM *order, BIGNUM *privateKey, ul32 *pRaw) {
|
void generateXPKey(byte *pKey, EC_GROUP *eCurve, EC_POINT *generator, BIGNUM *order, BIGNUM *privateKey, ul32 *pRaw, ul32 *hash, ul32 *sig) {
|
||||||
EC_POINT *r = EC_POINT_new(eCurve);
|
EC_POINT *r = EC_POINT_new(eCurve);
|
||||||
BN_CTX *ctx = BN_CTX_new();
|
BN_CTX *ctx = BN_CTX_new();
|
||||||
|
|
||||||
|
@ -184,7 +202,6 @@ void generateXPKey(byte *pKey, EC_GROUP *eCurve, EC_POINT *generator, BIGNUM *or
|
||||||
|
|
||||||
SHA_CTX hContext;
|
SHA_CTX hContext;
|
||||||
byte md[SHA_DIGEST_LENGTH], buf[FIELD_BYTES], t[4];
|
byte md[SHA_DIGEST_LENGTH], buf[FIELD_BYTES], t[4];
|
||||||
ul32 hash[1];
|
|
||||||
|
|
||||||
// h = (First-32(SHA1(pRaw, r.x, r.y)) >> 4
|
// h = (First-32(SHA1(pRaw, r.x, r.y)) >> 4
|
||||||
SHA1_Init(&hContext);
|
SHA1_Init(&hContext);
|
||||||
|
@ -218,30 +235,28 @@ void generateXPKey(byte *pKey, EC_GROUP *eCurve, EC_POINT *generator, BIGNUM *or
|
||||||
SHA1_Final(md, &hContext);
|
SHA1_Final(md, &hContext);
|
||||||
|
|
||||||
// h = (First-32(SHA1(pRaw, r.x, r.y)) >> 4
|
// h = (First-32(SHA1(pRaw, r.x, r.y)) >> 4
|
||||||
hash[0] = (md[0] | (md[1] << 8) | (md[2] << 16) | (md[3] << 24)) >> 4;
|
*hash = (md[0] | (md[1] << 8) | (md[2] << 16) | (md[3] << 24)) >> 4;
|
||||||
hash[0] &= 0xfffffff;
|
*hash &= 0xfffffff;
|
||||||
|
|
||||||
/* s = privateKey * hash + c; */
|
/* s = privateKey * hash + c; */
|
||||||
// s = privateKey;
|
// s = privateKey;
|
||||||
BN_copy(s, privateKey);
|
BN_copy(s, privateKey);
|
||||||
|
|
||||||
// s *= hash;
|
// s *= hash;
|
||||||
BN_mul_word(s, hash[0]);
|
BN_mul_word(s, *hash);
|
||||||
|
|
||||||
// BN_mod_add() adds a to b % m and places the non-negative result in r.
|
// BN_mod_add() adds a to b % m and places the non-negative result in r.
|
||||||
// s = |s + c % order|;
|
// s = |s + c % order|;
|
||||||
BN_mod_add(s, s, c, order, ctx);
|
BN_mod_add(s, s, c, order, ctx);
|
||||||
|
|
||||||
// Convert s from BigNum back to bytecode and reverse the endianness.
|
// Convert s from BigNum back to bytecode and reverse the endianness.
|
||||||
ul32 sig[2]{};
|
|
||||||
|
|
||||||
BN_bn2bin(s, (byte *)sig);
|
BN_bn2bin(s, (byte *)sig);
|
||||||
endiannessConvert((byte *) sig, BN_num_bytes(s));
|
endiannessConvert((byte *) sig, BN_num_bytes(s));
|
||||||
|
|
||||||
// Pack product key.
|
// Pack product key.
|
||||||
packXP(bKey, pRaw, hash, sig);
|
packXP(bKey, pRaw, hash, sig);
|
||||||
|
|
||||||
printf("PID: %.8lX\nHash: %.8lX\nSignature: %.8lX %.8lX\n\n", pRaw[0], hash[0], sig[1], sig[0]);
|
printf("PID: %.8lX\nHash: %.8lX\nSignature: %.8lX %.8lX\n\n", pRaw[0], *hash, sig[1], sig[0]);
|
||||||
} while (bKey[3] >= 0x40000);
|
} while (bKey[3] >= 0x40000);
|
||||||
// ↑ ↑ ↑
|
// ↑ ↑ ↑
|
||||||
// bKey[3] can't be longer than 18 bits, else the signature part will make
|
// bKey[3] can't be longer than 18 bits, else the signature part will make
|
||||||
|
@ -257,4 +272,51 @@ void generateXPKey(byte *pKey, EC_GROUP *eCurve, EC_POINT *generator, BIGNUM *or
|
||||||
|
|
||||||
BN_CTX_free(ctx);
|
BN_CTX_free(ctx);
|
||||||
EC_POINT_free(r);
|
EC_POINT_free(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
int keyXP(char *pKey, ul32 *hash, ul32 *sig, ul32 nRaw) {
|
||||||
|
assert(nRaw <= 1'000'000'000);
|
||||||
|
|
||||||
|
// We cannot produce a valid key without knowing the private key k. The reason for this is that
|
||||||
|
// we need the result of the function K(x; y) = kG(x; y).
|
||||||
|
BIGNUM *privateKey = BN_new();
|
||||||
|
|
||||||
|
// We can, however, validate any given key using the available public key: {p, a, b, G, K}.
|
||||||
|
// genOrder the order of the generator G, a value we have to reverse -> Schoof's Algorithm.
|
||||||
|
BIGNUM *genOrder = BN_new();
|
||||||
|
|
||||||
|
/* Computed data */
|
||||||
|
BN_hex2bn(&genOrder, genOrderXP);
|
||||||
|
BN_hex2bn(&privateKey, privateKeyXP);
|
||||||
|
|
||||||
|
EC_POINT *genPoint, *pubPoint;
|
||||||
|
EC_GROUP *eCurve = initializeEllipticCurve(
|
||||||
|
pXP,
|
||||||
|
aXP,
|
||||||
|
bXP,
|
||||||
|
genXXP,
|
||||||
|
genYXP,
|
||||||
|
pubXXP,
|
||||||
|
pubYXP,
|
||||||
|
genOrder,
|
||||||
|
privateKey,
|
||||||
|
&genPoint,
|
||||||
|
&pubPoint
|
||||||
|
);
|
||||||
|
|
||||||
|
// Shift left once.
|
||||||
|
nRaw <<= 1;
|
||||||
|
|
||||||
|
cprintf("Product Key:", 0x0A);
|
||||||
|
|
||||||
|
// Generate the key.
|
||||||
|
generateXPKey((byte *)pKey, eCurve, genPoint, genOrder, privateKey, &nRaw, hash, sig);
|
||||||
|
printProductKey(pKey);
|
||||||
|
|
||||||
|
printf("\n\n");
|
||||||
|
|
||||||
|
// Verify the key.
|
||||||
|
verifyXPKey(eCurve, genPoint, pubPoint, pKey);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in New Issue