Added crypto alg conversion helper

This commit is contained in:
Benjamin Höglinger-Stelzer 2023-07-01 06:04:58 +02:00
parent 91cf973a26
commit e930f829ca
3 changed files with 42 additions and 14 deletions

View File

@ -1,4 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=BCRYPT/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=CALG/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=CALG/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Domito/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Domito/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=LPWIN/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=LPWIN/@EntryIndexedValue">True</s:Boolean>

View File

@ -1,5 +1,7 @@
#pragma once #pragma once
#include <ci.h>
/******************************************************************************** /********************************************************************************
* Memory management, misc. * * Memory management, misc. *
@ -64,6 +66,30 @@ typedef struct _WIN_CERTIFICATE {
#endif #endif
//
// Converts a WinCrypt CALG_ID to a BCRYPT_ALGORITHM identifier
//
PCWSTR
FORCEINLINE
DOMITO_CALG_TO_BCRYPT_ALGORITHM(
_In_ UINT32 Calg
)
{
switch (Calg)
{
case CALG_SHA1:
return BCRYPT_SHA1_ALGORITHM;
case CALG_SHA256:
return BCRYPT_SHA256_ALGORITHM;
case CALG_SHA384:
return BCRYPT_SHA384_ALGORITHM;
case CALG_SHA512:
return BCRYPT_SHA512_ALGORITHM;
default:
return L"Unknown";
}
}
/******************************************************************************** /********************************************************************************
* Library functions * * Library functions *
********************************************************************************/ ********************************************************************************/

View File

@ -1,6 +1,7 @@
#include <ntifs.h> #include <ntifs.h>
#include <ntintsafe.h> #include <ntintsafe.h>
#include <ntimage.h> #include <ntimage.h>
#include <bcrypt.h>
#include "Domito.h" #include "Domito.h"
#include "ci.h" #include "ci.h"