src/excrypt_bn_sig.c
void ExCryptBnQwBeSigFormat(EXCRYPT_SIG* sig, const uint8_t* hash, const uint8_t* salt)
{
  EXCRYPT_SIG output;

  memset(output.padding, 0, 28 * sizeof(uint64_t));
  output.one = 1;
  memcpy(output.salt, salt, 10);
  output.end = 0xBC;

  // Create hash value inside signature
  ExCryptSha((uint8_t*)&output, 8, hash, 20, salt, 10, output.hash, 20);

  // RC4 encrypt signature contents
  ExCryptRc4(output.hash, 20, (uint8_t*)&output, 0xEB);

  // Clear high bit of signature
  *(uint8_t*)&output = (*(uint8_t*)&output) & 0x7F;

  // Swap signature, every 8 bytes
  uint64_t* in64 = (uint64_t*)&output;
  uint64_t* out64 = (uint64_t*)sig;
  for (int c = 0; c < 0x20; c++)
    out64[0x1F - c] = in64[c];
}
// BnQwBeSig seems to be a custom XeCrypt signature format, so we have to implement code for it ourselves :(
// AFAIK console-signing (eg. thru XeKeysConsolePrivateKeySign) use PKCS1 instead, so hopefully we can use some existing codebase for those.
BnQwBeSig seems to be a custom XeCrypt signature format, so we have to implement code for it ourselves :(
AFAIK console-signing  use PKCS1 instead, so hopefully we can use some existing codebase for those.
BnQwBeSig seems to be a custom XeCrypt signature format so we have to implement code for it ourselves : ( AFAIK console - signing use PKCS1 instead so hopefully we can use some existing codebase for those .
void ExCryptBnQwBeSigFormat(EXCRYPT_SIG* sig, const uint8_t* hash, const uint8_t* salt)
{
  EXCRYPT_SIG output;
  memset(output.padding, 0, 28 * sizeof(uint64_t));
  output.one = 1;
  memcpy(output.salt, salt, 10);
  output.end = 0xBC;
  ExCryptSha((uint8_t*)&output, 8, hash, 20, salt, 10, output.hash, 20);
  ExCryptRc4(output.hash, 20, (uint8_t*)&output, 0xEB);
  *(uint8_t*)&output = (*(uint8_t*)&output) & 0x7F;
  uint64_t* in64 = (uint64_t*)&output;
  uint64_t* out64 = (uint64_t*)sig;
  for (int c = 0; c < 0x20; c++)
    out64[0x1F - c] = in64[c];
}
void ExCryptBnQwBeSigFormat ( EXCRYPT_SIG * sig , const uint8_t * hash , const uint8_t * salt ) { EXCRYPT_SIG output ; memset ( output . padding , 0 , 28 * sizeof ( uint64_t ) ) ; output . one = 1 ; memcpy ( output . salt , salt , 10 ) ; output . end = 0xBC ; ExCryptSha ( ( uint8_t * ) & output , 8 , hash , 20 , salt , 10 , output . hash , 20 ) ; ExCryptRc4 ( output . hash , 20 , ( uint8_t * ) & output , 0xEB ) ; * ( uint8_t * ) & output = ( * ( uint8_t * ) & output ) & 0x7F ; uint64_t * in64 = ( uint64_t * ) & output ; uint64_t * out64 = ( uint64_t * ) sig ; for ( int c = 0 ; c < 0x20 ; c ++ ) out64 [ 0x1F - c ] = in64 [ c ] ; }
BnQwBeSig seems to be a custom XeCrypt signature format, so we have to implement code for it ourselves :(
AFAIK console-signing (eg.
BnQwBeSig seems to be a custom XeCrypt signature format so we have to implement code for it ourselves : ( AFAIK console - signing ( eg .
// Create hash value inside signature // RC4 encrypt signature contents // Clear high bit of signature // Swap signature, every 8 bytes