# FKeyPair -how to generate a valid key pair for pak signing?

**URL:** <https://forums.unrealengine.com/t/fkeypair-how-to-generate-a-valid-key-pair-for-pak-signing/388551>\
**Category:** Platform & Builds\
**Tags:** pak, unreal-engine, question\
**Created:** [March 21, 2017, 11:56am UTC](https://forums.unrealengine.com/t/fkeypair-how-to-generate-a-valid-key-pair-for-pak-signing/388551 "2017-03-21T11:56:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Muzaheed](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/muzaheed/32/778940_2.png) [@Muzaheed](https://forums.unrealengine.com/u/Muzaheed)\
**Post date:** [March 21, 2017, 11:56am UTC](https://forums.unrealengine.com/t/fkeypair-how-to-generate-a-valid-key-pair-for-pak-signing/388551/1 "2017-03-21T11:56:59Z")

</div>

here are the 3 keys i have put inside:

**C:\0.ue4\UnrealEngine\MyApp\Build\NoRedist\Keys.txt**

> 0x123456789abcdef 0x1234567 0x12345abc

but i am always getting this:

> Loading key pair from  
> C:\0.ue4\UnrealEngine\MyApp\Build\NoRedist\Keys.txt  
> UATHelper: Packaging (Windows  
> (64-bit)): UnrealPak:  
> LogPakFile:Display: Testing signature  
> keys. UATHelper: Packaging (Windows  
> (64-bit)): UnrealPak:  
> LogPakFile:Error: Keys do not properly  
> encrypt/decrypt data (failed test with  
> 11) UATHelper: Packaging (Windows  
> (64-bit)): UnrealPak:  
> LogPakFile:Error: Unable to create a  
> signed pak writer.

i tried to follow :

> **[RSA algorithm](https://simple.wikipedia.org/wiki/RSA_(algorithm))**
>
> RSA (Rivest–Shamir–Adleman) is an algorithm used by modern computers to encrypt and decrypt messages. It is an asymmetric cryptographic algorithm. Asymmetric means that there are two different keys. This is also called public key cryptography, because one of the keys can be given to anyone. RSA uses a public key and private key. The public key can be known to everyone- it is used to encrypt messages. Messages encrypted using the public key can only be decrypted with the private key. The private k...

to generate key pairs. but failed to generate private key exponent.

any idea on how to generate valid keys

---

<div class="post-metadata">

**Author:** ![Muzaheed](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/muzaheed/32/778940_2.png) [@Muzaheed](https://forums.unrealengine.com/u/Muzaheed)\
**Post date:** [March 22, 2017, 8:57am UTC](https://forums.unrealengine.com/t/fkeypair-how-to-generate-a-valid-key-pair-for-pak-signing/388551/2 "2017-03-22T08:57:19Z")

</div>

![131168-capture.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/6/6/5661ca5b4ee061cc5fd0e888b04f66cd5dd81e5d.jpeg)

I have found -GenerateKeys argument of unrealPak.exe.  
i tried to run it with

> “C:\0.ue4\UnrealEngine\Engine\Binaries\Win64"  
> UnrealPak.exe  
> -GenerateKeys=“C:\0.ue4\4.14.3\_cpp\android\_bp1\pass.txt”  
> -P=317 -P=337”

it is runnning for almost 2 hour. still nothing.  
Does it actually work?  
and it is using 100% of my cpu. so ue4 editor is useless bcz of this.  
Can anybody provide a sample password to check the system, before wasiting time on it ?

---

<div class="post-metadata">

**Author:** ![NLEBEDENCO](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NLEBEDENCO](https://forums.unrealengine.com/u/NLEBEDENCO)\
**Post date:** [January 28, 2018, 8:05pm UTC](https://forums.unrealengine.com/t/fkeypair-how-to-generate-a-valid-key-pair-for-pak-signing/388551/3 "2018-01-28T20:05:05Z")

</div>

The prime number arguments must be -P= and -Q=, you’re repeating P twice. And by looking at the source code, the numbers must be given in hexadecimal (the 0x prefix is optional but the string is still treated as hexadecimal). This will prevent the executable from searching for large primes by itself which can take a really long time but it may still try to validate if they are primes indeed which can also take some time, so if you know for sure P and Q to be primes you can skip the checks completely by specifying -NoVerifyPrimes.
