Skip to content

Instantly share code, notes, and snippets.

@lowleveldesign
Created March 6, 2017 19:42
Show Gist options
  • Save lowleveldesign/9daf5cb413caa7301229010d501d1ed2 to your computer and use it in GitHub Desktop.
Save lowleveldesign/9daf5cb413caa7301229010d501d1ed2 to your computer and use it in GitHub Desktop.
StrongNameKey (.snk) file template for 010 editor
//------------------------------------------------
//--- 010 Editor v7.0.2 Binary Template
//
// File:
// Authors: Sebastian Solnica (@lowleveldesign)
// Version:
// Purpose: .snk files
// Category:
// File Mask: *.snk
// ID Bytes:
// History:
//------------------------------------------------
/*
* Links:
* - http://msdn.microsoft.com/en-us/library/cc250013%28v=prot.20%29.aspx
* - http://msdn.microsoft.com/en-us/library/windows/desktop/aa387689%28v=vs.85%29.aspx
*/
// from https://msdn.microsoft.com/en-us/library/windows/desktop/aa375549(v=vs.85).aspx
typedef enum <DWORD> {
CALG_3DES = 0x00006603,
CALG_RSA_KEYX = 0x0000A400,
CALG_RSA_SIGN = 0x00002400
} ALG_ID;
typedef struct _PUBLICKEYSTRUC {
BYTE bType;
BYTE bVersion;
WORD reserved;
ALG_ID aiKeyAlg <format=hex>;
} BLOBHEADER, PUBLICKEYSTRUC;
typedef struct _RSAPUBKEY {
DWORD magic;
DWORD bitlen;
DWORD pubexp;
} RSAPUBKEY;
PUBLICKEYSTRUC publicKeyStruc;
RSAPUBKEY rsaPubKey;
BYTE modulus[rsaPubKey.bitlen / 8];
BYTE prime1[rsaPubKey.bitlen / 16]; // aka P
BYTE prime2[rsaPubKey.bitlen / 16]; // aka Q
BYTE exponent1[rsaPubKey.bitlen / 16]; // aka DP
BYTE exponent2[rsaPubKey.bitlen / 16]; // aka DQ
BYTE coefficient[rsaPubKey.bitlen / 16]; // aka IQ
BYTE privateExponent[rsaPubKey.bitlen / 8]; // aka D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment