Find Jobs
Hire Freelancers

Encapsulate C++ call to a C# class

$10-30 USD

Closed
Posted almost 9 years ago

$10-30 USD

Paid on delivery
This is the C++ code: #include "stdafx.h" #include <Windows.h> #include <wincrypt.h> #include <iostream> int _tmain(int argc, _TCHAR* argv[]) { HCERTSTORE mystore = CertOpenStore(CERT_STORE_PROV_SYSTEM, 0, NULL, CERT_SYSTEM_STORE_CURRENT_USER, L"My"); if (!mystore) { std::cout << "Failed to open store" << std::endl; return -1; } TCHAR pszNameString[256] = { 0 }; PCCERT_CONTEXT pcert = nullptr; while (pcert = CertEnumCertificatesInStore(mystore, pcert)) { auto res = CertGetNameString(pcert, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0, nullptr, pszNameString, 128); if (res) { std::wcout << "Found certificate: " << pszNameString << std::endl; DWORD usage_size = 0; PCERT_ENHKEY_USAGE usage = nullptr; (void)CertGetEnhancedKeyUsage(pcert, CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG, NULL, &usage_size); usage = (PCERT_ENHKEY_USAGE)new char[usage_size]; BOOL got_usages = CertGetEnhancedKeyUsage(pcert, CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG, usage, &usage_size); if (got_usages) { BOOL set_usages = CertSetEnhancedKeyUsage(pcert, usage); if (!set_usages) { std::cout << "Failed to set key usages: " << std::hex << GetLastError() << std::endl; } BOOL removed = CertRemoveEnhancedKeyUsageIdentifier(pcert, "1.3.6.1.4.1.[login to view URL]"); if (!removed) { std::cout << "Error: " << std::hex << GetLastError() << std::endl; } } } }; CertCloseStore(mystore, 0); return 0; } The code sets first set all purposes for a certificate and then removes one of the purposes (= 1.3.6.1.4.1.[login to view URL]) I want to call this from a C# program with functions To set all purposes for Certificate bool SetAllPurposesForCertificate( X509Certificate2 cert) {...} To remove one type of purpose from a Certificate bool RemovePurposeFromCertificate(X509Certificate2 cert, string keyUsageIdentifier) { ... }
Project ID: 7961409

About the project

6 proposals
Remote project
Active 9 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
6 freelancers are bidding on average $31 USD for this job
User Avatar
Ready !Ready !Ready !Ready !Ready !Ready !Ready !Ready !Ready !Ready !Ready !Ready !Ready !Ready !Ready !Ready !Ready !Ready !Ready !Ready !
$50 USD in 1 day
4.8 (55 reviews)
6.3
6.3
User Avatar
A proposal has not yet been provided
$14 USD in 1 day
5.0 (7 reviews)
3.0
3.0
User Avatar
Hello I have read your requirements and decide to work with you. I am PHP developer since last 5 year . I have already worked with 5 big projects in php if you interested then i will show you. I'll give you the good design and functionality. I`ll provide you daily status reports of your project. My criteria is to give high quality work to my client. Thank you.
$35 USD in 3 days
0.0 (0 reviews)
0.0
0.0
User Avatar
hi there i think its possible tocompile c++ file into dll and then call dll file in c# and use the functions
$25 USD in 0 day
0.0 (0 reviews)
0.0
0.0
User Avatar
Hello, I can complete this task by creating a c++ dll with the function. You will then be able to call the function from c# using [DllImport].
$30 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
I already made C# wrappers for C++ operations, and judging by the code I think I can do this quite quickly.
$30 USD in 1 day
0.0 (0 reviews)
0.0
0.0

About the client

Flag of SWEDEN
Västerås, Sweden
4.9
87
Payment method verified
Member since Mar 18, 2009

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.