Merge pull request #32 from nagachaitanyalokam/master

Deleting Old Spartan Sample codes
This commit is contained in:
Reezaali 2022-06-28 13:35:24 -07:00 коммит произвёл GitHub
Родитель 6f0298bb0c 6d0281d6f7
Коммит 3b04b0dad3
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
185 изменённых файлов: 0 добавлений и 100171 удалений

Просмотреть файл

@ -1,145 +0,0 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
#include "stdafx.h"
#include "SignHash.h"
using namespace std;
using namespace concurrency;
using namespace Platform;
using namespace Windows::ApplicationModel::AppService;
using namespace Windows::ApplicationModel::DataTransfer;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::Storage;
using namespace Windows::Security::Cryptography;
using namespace Windows::Storage::Streams;
HANDLE _terminateHandle;
AppServiceConnection^ _connection = nullptr;
void RequestReceived(AppServiceConnection^ connection, AppServiceRequestReceivedEventArgs^ args);
void ServiceClosed(AppServiceConnection^ connection, AppServiceClosedEventArgs^ args);
/// <summary>
/// Creates the app service connection
/// </summary>
IAsyncAction^ ConnectToAppServiceAsync()
{
return create_async([]
{
// Get the package family name
Windows::ApplicationModel::Package^ package = Windows::ApplicationModel::Package::Current;
Platform::String^ packageFamilyName = package->Id->FamilyName;
// Create and set the connection
auto connection = ref new AppServiceConnection();
connection->PackageFamilyName = packageFamilyName;
connection->AppServiceName = "NativeMessagingHostInProcessService"; // Change to "NativeMessagingHostOutOfProcessService" for out-of-proc AppService model
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), (FOREGROUND_GREEN));
cout << "Opening connection..." << endl;
// Open the connection
create_task(connection->OpenAsync()).then([connection](AppServiceConnectionStatus status)
{
if (status == AppServiceConnectionStatus::Success)
{
_connection = connection;
wcout << "Successfully opened connection." << endl;
_connection->RequestReceived += ref new TypedEventHandler<AppServiceConnection^, AppServiceRequestReceivedEventArgs^>(RequestReceived);
_connection->ServiceClosed += ref new TypedEventHandler<AppServiceConnection^, AppServiceClosedEventArgs^>(ServiceClosed);
}
else if (status == AppServiceConnectionStatus::AppUnavailable || status == AppServiceConnectionStatus::AppServiceUnavailable)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), (FOREGROUND_RED));
cout << "AppService Unavailable" << endl;
}
});
});
}
/// <summary>
/// Creates an app service thread
/// </summary>
int main(Platform::Array<Platform::String^>^ args)
{
_terminateHandle = CreateEvent(NULL, TRUE, FALSE, NULL);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), (FOREGROUND_RED | FOREGROUND_GREEN));
wcout << "*********************************" << endl;
wcout << "**** Classic desktop C++ app ****" << endl;
wcout << "*********************************" << endl << endl;
wcout << L"Creating app service connection" << endl << endl;
ConnectToAppServiceAsync();
WaitForSingleObject(_terminateHandle, INFINITE);
CloseHandle(_terminateHandle);
return 0;
}
std::string wstos(std::wstring ws)
{
std::string s(ws.begin(), ws.end());
return s;
}
std::string pstos(String^ ps)
{
return wstos(std::wstring(ps->Data()));
}
/// <summary>
/// Receives message from UWP app and sends a response back
/// </summary>
void RequestReceived(AppServiceConnection^ connection, AppServiceRequestReceivedEventArgs^ args)
{
auto deferral = args->GetDeferral();
auto message = args->Request->Message;
auto method = message->Lookup(L"message")->ToString();
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), (FOREGROUND_RED | FOREGROUND_GREEN));
wcout << method->Data();
wcout << L" - request received" << endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), (FOREGROUND_GREEN));
std::string transactionText = pstos(method);
BYTE* pszBase64P1 = nullptr;
DWORD length = 0;
create_task([transactionText, &pszBase64P1, &length]
{
SignMessage(transactionText.c_str(), &pszBase64P1, &length);
return *pszBase64P1;
}).get();
Array<BYTE>^ arr = ref new Array<BYTE>(pszBase64P1, length);
IBuffer^ buffer = CryptographicBuffer::CreateFromByteArray(arr);
String^ signature = CryptographicBuffer::EncodeToBase64String(buffer);
auto response = ref new ValueSet();
response->Insert("message", signature);
wcout << L"Sending response: " << signature->Data() << endl;
create_task(args->Request->SendResponseAsync(response)).then([deferral](AppServiceResponseStatus status)
{
deferral->Complete();
});
}
/// <summary>
/// Occurs when the other endpoint closes the connection to the app service
/// </summary>
void ServiceClosed(AppServiceConnection^ connection, AppServiceClosedEventArgs^ args)
{
cout << "ServiceClosed..." << endl;
SetEvent(_terminateHandle);
}

Просмотреть файл

@ -1,205 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{CF6580E8-1EF8-4055-8FE0-77EC6D9974C4}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>DigitalSigning</RootNamespace>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
<ProjectName>DigitalSigning</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<LibraryPath>$(SystemDrive)\Program Files (x86)\Windows Kits\10\UnionMetadata;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalUsingDirectories>$(SystemDrive)\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\vcpackages;$(SystemDrive)\Program Files (x86)\Windows Kits\10\UnionMetadata;$(SystemDrive)\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.UniversalApiContract\1.0.0.0;$(SystemDrive)\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.FoundationContract\1.0.0.0;%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<CompileAsWinRT>true</CompileAsWinRT>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OutputFile>$(SolutionDir)$(Configuration)\$(TargetName)$(TargetExt)</OutputFile>
<ProgramDatabaseFile>$(SolutionDir)$(Configuration)\$(TargetName).pdb</ProgramDatabaseFile>
</Link>
<PostBuildEvent>
<!--Change "NativeMessagingHostInProcess" to "NativeMessagingHostOutOfProcess" while switching to out-of-proc AppService model-->
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<CompileAsWinRT>true</CompileAsWinRT>
<MinimalRebuild>false</MinimalRebuild>
<AdditionalUsingDirectories>$(SystemDrive)\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\vcpackages;$(SystemDrive)\Program Files (x86)\Windows Kits\10\UnionMetadata;$(SystemDrive)\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.UniversalApiContract\1.0.0.0;$(SystemDrive)\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.FoundationContract\1.0.0.0;%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OutputFile>$(SolutionDir)$(Configuration)\$(TargetName)$(TargetExt)</OutputFile>
<ProgramDatabaseFile>$(SolutionDir)$(Configuration)\$(TargetName).pdb</ProgramDatabaseFile>
</Link>
<PostBuildEvent>
<!--Change "NativeMessagingHostInProcess" to "NativeMessagingHostOutOfProcess" while switching to out-of-proc AppService model-->
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalUsingDirectories>$(SystemDrive)\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\vcpackages;$(SystemDrive)\Program Files (x86)\Windows Kits\10\UnionMetadata;$(SystemDrive)\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.UniversalApiContract\1.0.0.0;$(SystemDrive)\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.FoundationContract\1.0.0.0;%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OutputFile>$(SolutionDir)$(Configuration)\$(TargetName)$(TargetExt)</OutputFile>
<ProgramDatabaseFile>$(SolutionDir)$(Configuration)\$(TargetName).pdb</ProgramDatabaseFile>
</Link>
<PostBuildEvent>
<!--Change "NativeMessagingHostInProcess" to "NativeMessagingHostOutOfProcess" while switching to out-of-proc AppService model-->
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalUsingDirectories>$(SystemDrive)\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\vcpackages;$(SystemDrive)\Program Files (x86)\Windows Kits\10\UnionMetadata;$(SystemDrive)\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.UniversalApiContract\1.0.0.0;$(SystemDrive)\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.FoundationContract\1.0.0.0;%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<CompileAsWinRT>true</CompileAsWinRT>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OutputFile>$(SolutionDir)$(Configuration)\$(TargetName)$(TargetExt)</OutputFile>
<ProgramDatabaseFile>$(SolutionDir)$(Configuration)\$(TargetName).pdb</ProgramDatabaseFile>
</Link>
<PostBuildEvent>
<!--Change "NativeMessagingHostInProcess" to "NativeMessagingHostOutOfProcess" while switching to out-of-proc AppService model-->
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="SignHash.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="SignHash.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="DigitalSigning.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

Просмотреть файл

@ -1,40 +0,0 @@
========================================================================
CONSOLE APPLICATION : Win32Process_CPP Project Overview
========================================================================
AppWizard has created this Win32Process_CPP application for you.
This file contains a summary of what you will find in each of the files that
make up your Win32Process_CPP application.
Win32Process_CPP.vcxproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.
Win32Process_CPP.vcxproj.filters
This is the filters file for VC++ projects generated using an Application Wizard.
It contains information about the association between the files in your project
and the filters. This association is used in the IDE to show grouping of files with
similar extensions under a specific node (for e.g. ".cpp" files are associated with the
"Source Files" filter).
Win32Process_CPP.cpp
This is the main application source file.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named Win32Process_CPP.pch and a precompiled types file named StdAfx.obj.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" comments to indicate parts of the source code you
should add to or customize.
/////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -1,251 +0,0 @@
//--------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Example of signing a hash
#include "stdafx.h"
#include <stdio.h>
#include <windows.h>
#include <Wincrypt.h>
#include <cryptuiapi.h>
#include "SignHash.h"
#pragma comment(lib, "crypt32.lib")
#pragma comment(lib, "cryptui.lib")
#define MY_ENCODING_TYPE (PKCS_7_ASN_ENCODING | X509_ASN_ENCODING)
void MyHandleError(char *s);
//----------------------------------------------------------------------------
// FindCertificateBySubjectName
//
//----------------------------------------------------------------------------
HRESULT FindCertificateBySubjectName(
LPCWSTR wszStore,
LPCWSTR wszSubject,
PCCERT_CONTEXT *ppcCert
)
{
HRESULT hr = S_OK;
HCERTSTORE hStoreHandle = NULL; // The system store handle.
*ppcCert = NULL;
//-------------------------------------------------------------------
// Open the certificate store to be searched.
hStoreHandle = CertOpenStore(
CERT_STORE_PROV_SYSTEM, // the store provider type
0, // the encoding type is not needed
NULL, // use the default HCRYPTPROV
CERT_SYSTEM_STORE_CURRENT_USER, // set the store location in a
// registry location
wszStore // the store name
);
if (NULL == hStoreHandle)
{
hr = HRESULT_FROM_WIN32(GetLastError());
goto CleanUp;
}
//-------------------------------------------------------------------
// Get a certificate that has the specified Subject Name
*ppcCert = CertFindCertificateInStore(
hStoreHandle,
X509_ASN_ENCODING, // Use X509_ASN_ENCODING
0, // No dwFlags needed
CERT_FIND_SUBJECT_STR, // Find a certificate with a
// subject that matches the
// string in the next parameter
wszSubject, // The Unicode string to be found
// in a certificate's subject
NULL); // NULL for the first call to the
// function; In all subsequent
// calls, it is the last pointer
// returned by the function
if (NULL == *ppcCert)
{
hr = HRESULT_FROM_WIN32(GetLastError());
goto CleanUp;
}
CleanUp:
if (NULL != hStoreHandle)
{
CertCloseStore(hStoreHandle, 0);
}
return hr;
}
void SignMessage(const char* pszMsg,
BYTE ** ppszSignature, DWORD* pLength)
{
//-------------------------------------------------------------------
// Declare and initialize variables.
HCRYPTPROV hProv;
HCRYPTHASH hHash;
BYTE *pbSignature;
DWORD dwSigLen;
// Certificate to be used to sign data
PCCERT_CONTEXT pCertContext = NULL;
LPCWSTR pwszStoreName = L"MY"; // by default, MY
// Subject name string of certificate to be used in signing
// change it to match your own certificate
LPCWSTR pwszCName = L"test";
// Key spec; will be used to determine key type
DWORD dwKeySpec = 0;
//-------------------------------------------------------------------
// Find the test certificate to be validated and obtain a pointer to it
if (S_OK != FindCertificateBySubjectName(
pwszStoreName,
pwszCName,
&pCertContext
))
{
MyHandleError("Error during FindCertificateBySubjectName.");
}
if (CryptAcquireCertificatePrivateKey(
pCertContext,
CRYPT_ACQUIRE_ALLOW_NCRYPT_KEY_FLAG,
NULL, // Reserved for future use and must be NULL
&hProv,
&dwKeySpec,
NULL))
{
printf("Certificate PrivateKey acquired. \n");
}
else
{
MyHandleError("Error during CryptAcquireCertificatePrivateKey.");
}
//-------------------------------------------------------------------
// Create the hash object.
if (CryptCreateHash(
hProv,
CALG_MD5,
0,
0,
&hHash))
{
printf("Hash object created. \n");
}
else
{
MyHandleError("Error during CryptCreateHash.");
}
//-------------------------------------------------------------------
// Compute the cryptographic hash of the buffer.
if (CryptHashData(
hHash,
(BYTE*)pszMsg,
strlen(pszMsg) + 1,
0))
{
printf("The data buffer has been hashed.\n");
}
else
{
MyHandleError("Error during CryptHashData.");
}
//-------------------------------------------------------------------
// Determine the size of the signature and allocate memory.
dwSigLen = 0;
if (CryptSignHash(
hHash,
dwKeySpec,
NULL,
0,
NULL,
&dwSigLen))
{
printf("Signature length %d found.\n", dwSigLen);
}
else
{
MyHandleError("Error during CryptSignHash.");
}
//-------------------------------------------------------------------
// Allocate memory for the signature buffer.
if (pbSignature = (BYTE *)malloc(dwSigLen))
{
printf("Memory allocated for the signature.\n");
}
else
{
MyHandleError("Out of memory.");
}
//-------------------------------------------------------------------
// Sign the hash object.
if (CryptSignHash(
hHash,
dwKeySpec,
NULL,
0,
pbSignature,
&dwSigLen))
{
printf("pbSignature is the hash signature.\n");
}
else
{
MyHandleError("Error during CryptSignHash.");
}
*ppszSignature = pbSignature;
//-------------------------------------------------------------------
// Destroy the hash object.
if (hHash)
{
CryptDestroyHash(hHash);
}
printf("The hash object has been destroyed.\n");
printf("The signing phase of this program is completed.\n\n");
//-------------------------------------------------------------------
// Release the provider handle.
if (hProv)
{
CryptReleaseContext(hProv, 0);
}
if (pCertContext)
{
CertFreeCertificateContext(pCertContext);
}
*pLength = dwSigLen;
return;
} // End of SignMessage
//-------------------------------------------------------------------
// This example uses the function MyHandleError, a simple error
// handling function, to print an error message to the
// standard error (stderr) file and exit the program.
// For most applications, replace this function with one
// that does more extensive error reporting.
void MyHandleError(char *s)
{
fprintf(stderr, "An error occurred in running the program. \n");
fprintf(stderr, "%s\n", s);
fprintf(stderr, "Error number %x.\n", GetLastError());
fprintf(stderr, "Program terminating. \n");
exit(1);
} // End of MyHandleError

Просмотреть файл

@ -1,4 +0,0 @@
#pragma once
// Sign a hash
void SignMessage(const char* pszMsg, BYTE** ppszSignature, DWORD* pLength);

Просмотреть файл

@ -1,12 +0,0 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
#include "stdafx.h"

Просмотреть файл

@ -1,30 +0,0 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
#using <Windows.winmd>
#include <iostream>
#include <string>
#include <ppltasks.h>
#include <windows.h>
#include <appmodel.h>
#include <malloc.h>
#include <stdio.h>
#include <assert.h>

Просмотреть файл

@ -1,19 +0,0 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
#pragma once
// Including SDKDDKVer.h defines the highest available Windows platform.
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
#include <SDKDDKVer.h>

Просмотреть файл

@ -1,84 +0,0 @@
// Store port for native messaging connections
var portDict = {};
browser.runtime.onMessage.addListener(
function (request, sender, sendResponse) {
try {
if (request.type == "connect") {
connect(sender.tab);
sendResponse({ success: true })
} else if (request.type == "disconnect") {
disconnect(sender.tab);
sendResponse({ success: true })
} else {
sendNativeMessage(request.message, sender.tab);
document.addEventListener('nativeMessage',
function handleNativeMessage(e) {
sendResponse(e.detail);
document.removeEventListener(e.type, handleNativeMessage);
}, false);
}
return true;
}
catch (e) {
sendResponse({ success: false, message: e.message })
return true;
}
});
function onDisconnected() {
// Query current active window
browser.tabs.query({ active: true, currentWindow: true }, function (tabs) {
var lastTabId = tabs[0].id;
browser.tabs.sendMessage(lastTabId, "disconnected");
});
}
function onNativeMessage(message) {
if ((message.length == 1) || (message == "delete")) // Handle intercepted key event from native app
{
// Query current active window
browser.tabs.query({ active: true, currentWindow: true }, function (tabs) {
var lastTabId = tabs[0].id;
browser.tabs.sendMessage(lastTabId, message);
})
}
else // Handle encrypted password
{
var event = new CustomEvent('nativeMessage', { 'detail': message });
document.dispatchEvent(event);
}
}
// Connect to native app and get the communication port
function connect(tab) {
var port = null;
// Connect the App Service in Native App, change to "NativeMessagingHostOutOfProcessService"
// while switching to App Service out-of-proc model
port = browser.runtime.connectNative("NativeMessagingHostInProcessService");
port.onMessage.addListener(onNativeMessage);
port.onDisconnect.addListener(onDisconnected);
var id = tab.id;
portDict[id] = port;
}
// Disconnect from native app
function disconnect(tab) {
var id = tab.id;
portDict[id].disconnect();
delete portDict[id];
}
// Send message to native app
function sendNativeMessage(message, tab) {
var id = tab.id;
try {
portDict[id].postMessage(message);
}
catch (e) {
throw e;
}
}

Просмотреть файл

@ -1,72 +0,0 @@
// Connect native app automatically when page loading
window.onload = connectNativeApp;
// Disconnect native app automatically when page unloading
window.onbeforeunload = disconnectNativeApp;
function updateUiState(connected) {
if (connected) {
document.getElementById('ConnectButton').disabled = true;
document.getElementById('DisconnectButton').disabled = false;
document.getElementById('SignButton').disabled = false;
} else {
document.getElementById('ConnectButton').disabled = false;
document.getElementById('DisconnectButton').disabled = true;
document.getElementById('SignButton').disabled = true;
}
}
function connectNativeApp() {
var request = new Object();
request.type = "connect";
browser.runtime.sendMessage(request,
function (response) {
if (response.success) {
updateUiState(true);
} else {
console.error(response.message);
}
});
}
function disconnectNativeApp() {
var request = new Object();
request.type = "disconnect";
browser.runtime.sendMessage(request,
function (response) {
if (response.success) {
updateUiState(false);
} else {
console.error(response.message);
}
});
}
// Sign message
function SignMessage(message) {
var request = new Object();
request.type = "SignMessage";
request.message = message;
browser.runtime.sendMessage(request,
function (response) {
var event = new CustomEvent('SignResponse', { 'detail': response });
document.dispatchEvent(event);
});
}
browser.runtime.onMessage.addListener(function (message) {
if (message == "disconnected") {
updateUiState(false);
}
});
document.getElementById('ConnectButton').onclick = connectNativeApp;
document.getElementById('DisconnectButton').onclick = disconnectNativeApp;
document.addEventListener('SignRequest',
function (e) {
SignMessage(e.detail);
}, false);

Двоичные данные
DigitalSigning/Extension/icon_128.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.7 KiB

Двоичные данные
DigitalSigning/Extension/icon_16.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 325 B

Двоичные данные
DigitalSigning/Extension/icon_48.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 828 B

Просмотреть файл

@ -1,33 +0,0 @@
{
"name" : "DigitalSigning",
"version" : "1.0.0.0",
"description" : "China online banking digital signing reference implementation",
"author": "msft",
"background": {
"scripts": [ "background.js" ],
"persistent": true
},
"default_locale": "en_US",
"content_scripts": [
{
"matches": ["*://*/*sign*"],
"js": ["content.js"],
"run_at": "document_end"
}
],
"permissions": [
"*://*/*sign*",
"nativeMessaging",
"activeTab"
],
"icons": {
"16": "icon_16.png",
"48": "icon_48.png",
"128": "icon_128.png"
}
}

Просмотреть файл

@ -1,8 +0,0 @@
<Application
x:Class="NativeMessagingHostInProcess.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:NativeMessagingHostInProcess"
RequestedTheme="Light">
</Application>

Просмотреть файл

@ -1,337 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.ApplicationModel.AppService;
using Windows.ApplicationModel.Background;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace NativeMessagingHostInProcess
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
private BackgroundTaskDeferral appServiceDeferral = null;
private AppServiceConnection connection = null;
private BackgroundTaskDeferral centennialAppServiceDeferral = null;
private AppServiceConnection centennialConnection = null;
private bool centennialAppLaunched = true;
private int currentConnectionIndex = 0;
static int connectionIndex = 0;
static int centennialConnectionIndex = 0;
static Dictionary<int, AppServiceConnection> connections = new Dictionary<int, AppServiceConnection>();
static Dictionary<int, AppServiceConnection> centennialConnections = new Dictionary<int, AppServiceConnection>();
static Dictionary<int, BackgroundTaskDeferral> appServiceDeferrals = new Dictionary<int, BackgroundTaskDeferral>();
static Dictionary<int, BackgroundTaskDeferral> centennialAppServiceDeferrals = new Dictionary<int, BackgroundTaskDeferral>();
static Object thisLock = new Object();
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
}
/// <summary>
/// Initializes the app service on the host process
/// </summary>
protected async override void OnBackgroundActivated(BackgroundActivatedEventArgs args)
{
base.OnBackgroundActivated(args);
IBackgroundTaskInstance taskInstance = args.TaskInstance;
if (taskInstance.TriggerDetails is AppServiceTriggerDetails)
{
AppServiceTriggerDetails appService = taskInstance.TriggerDetails as AppServiceTriggerDetails;
if (appService.CallerPackageFamilyName == Windows.ApplicationModel.Package.Current.Id.FamilyName) // App service connection from Centennial App
{
this.centennialAppServiceDeferral = taskInstance.GetDeferral(); // Get a deferral so that the service isn't terminated.
taskInstance.Canceled += OnCentennialAppServicesCanceled; // Associate a cancellation handler with the background task.
this.centennialConnection = appService.AppServiceConnection;
this.centennialConnection.RequestReceived += OnCentennialAppServiceRequestReceived;
this.centennialConnection.ServiceClosed += CentennialAppServiceConnection_ServiceClosed;
lock (thisLock)
{
this.centennialConnection.AppServiceName = centennialConnectionIndex.ToString();
centennialConnections.Add(centennialConnectionIndex, this.centennialConnection);
centennialAppServiceDeferrals.Add(centennialConnectionIndex, this.centennialAppServiceDeferral);
centennialConnectionIndex++;
}
}
else // App service connection from Edge browser
{
this.appServiceDeferral = taskInstance.GetDeferral(); // Get a deferral so that the service isn't terminated.
taskInstance.Canceled += OnAppServicesCanceled; // Associate a cancellation handler with the background task.
this.connection = appService.AppServiceConnection;
this.connection.RequestReceived += OnAppServiceRequestReceived;
this.connection.ServiceClosed += AppServiceConnection_ServiceClosed;
lock (thisLock)
{
this.connection.AppServiceName = connectionIndex.ToString();
connections.Add(connectionIndex, this.connection);
appServiceDeferrals.Add(connectionIndex, this.appServiceDeferral);
connectionIndex++;
}
try
{
// Make sure the BackgroundProcess is in your AppX folder, if not rebuild the solution
await Windows.ApplicationModel.FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
}
catch (Exception)
{
this.centennialAppLaunched = false;
MessageDialog dialog = new MessageDialog("Rebuild the solution and make sure the BackgroundProcess is in your AppX folder");
await dialog.ShowAsync();
}
}
}
}
/// <summary>
/// Receives message from Extension (via Edge)
/// </summary>
private async void OnAppServiceRequestReceived(AppServiceConnection sender, AppServiceRequestReceivedEventArgs args)
{
AppServiceDeferral messageDeferral = args.GetDeferral();
try
{
if (this.centennialAppLaunched)
{
this.currentConnectionIndex = Int32.Parse(sender.AppServiceName);
this.centennialConnection = centennialConnections[this.currentConnectionIndex];
// Send message to the Centennial component and wait for response
AppServiceResponse centennialResponse = await this.centennialConnection.SendMessageAsync(args.Request.Message);
await args.Request.SendResponseAsync(centennialResponse.Message);
}
else
{
throw new Exception("Failed to launch Centennial App!");
}
}
finally
{
messageDeferral.Complete();
}
}
/// <summary>
/// Associate the cancellation handler with the background task
/// </summary>
private void OnAppServicesCanceled(IBackgroundTaskInstance sender, BackgroundTaskCancellationReason reason)
{
AppServiceTriggerDetails appService = sender.TriggerDetails as AppServiceTriggerDetails;
this.currentConnectionIndex = Int32.Parse(appService.AppServiceConnection.AppServiceName);
this.centennialConnection = centennialConnections[this.currentConnectionIndex];
this.centennialConnection.Dispose();
centennialConnections.Remove(this.currentConnectionIndex);
this.appServiceDeferral = appServiceDeferrals[this.currentConnectionIndex];
appServiceDeferrals.Remove(this.currentConnectionIndex);
this.centennialAppServiceDeferral = centennialAppServiceDeferrals[this.currentConnectionIndex];
centennialAppServiceDeferrals.Remove(this.currentConnectionIndex);
if (this.appServiceDeferral != null)
{
this.appServiceDeferral.Complete();
this.appServiceDeferral = null;
}
if (this.centennialAppServiceDeferral != null)
{
this.centennialAppServiceDeferral.Complete();
this.centennialAppServiceDeferral = null;
}
}
/// <summary>
/// Occurs when the other endpoint closes the connection to the app service
/// </summary>
private void AppServiceConnection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
{
this.currentConnectionIndex = Int32.Parse(sender.AppServiceName);
this.centennialConnection = centennialConnections[this.currentConnectionIndex];
this.centennialConnection.Dispose();
centennialConnections.Remove(this.currentConnectionIndex);
this.appServiceDeferral = appServiceDeferrals[this.currentConnectionIndex];
appServiceDeferrals.Remove(this.currentConnectionIndex);
this.centennialAppServiceDeferral = centennialAppServiceDeferrals[this.currentConnectionIndex];
centennialAppServiceDeferrals.Remove(this.currentConnectionIndex);
if (this.appServiceDeferral != null)
{
this.appServiceDeferral.Complete();
this.appServiceDeferral = null;
}
if (this.centennialAppServiceDeferral != null)
{
this.centennialAppServiceDeferral.Complete();
this.centennialAppServiceDeferral = null;
}
}
/// <summary>
/// Receives message from Centennial App
/// </summary>
private async void OnCentennialAppServiceRequestReceived(AppServiceConnection sender, AppServiceRequestReceivedEventArgs args)
{
AppServiceDeferral messageDeferral = args.GetDeferral();
try
{
this.currentConnectionIndex = Int32.Parse(sender.AppServiceName);
this.connection = connections[this.currentConnectionIndex];
await this.connection.SendMessageAsync(args.Request.Message);
}
finally
{
messageDeferral.Complete();
}
}
/// <summary>
/// Associate the cancellation handler with the background task
/// </summary>
private void OnCentennialAppServicesCanceled(IBackgroundTaskInstance sender, BackgroundTaskCancellationReason reason)
{
AppServiceTriggerDetails appService = sender.TriggerDetails as AppServiceTriggerDetails;
this.currentConnectionIndex = Int32.Parse(appService.AppServiceConnection.AppServiceName);
this.connection = connections[this.currentConnectionIndex];
this.connection.Dispose();
connections.Remove(this.currentConnectionIndex);
this.appServiceDeferral = appServiceDeferrals[this.currentConnectionIndex];
appServiceDeferrals.Remove(this.currentConnectionIndex);
this.centennialAppServiceDeferral = centennialAppServiceDeferrals[this.currentConnectionIndex];
centennialAppServiceDeferrals.Remove(this.currentConnectionIndex);
if (this.appServiceDeferral != null)
{
this.appServiceDeferral.Complete();
this.appServiceDeferral = null;
}
if (this.centennialAppServiceDeferral != null)
{
this.centennialAppServiceDeferral.Complete();
this.centennialAppServiceDeferral = null;
}
}
/// <summary>
/// Occurs when the other endpoint closes the connection to the app service
/// </summary>
private void CentennialAppServiceConnection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
{
this.currentConnectionIndex = Int32.Parse(sender.AppServiceName);
this.connection = connections[this.currentConnectionIndex];
this.connection.Dispose();
connections.Remove(this.currentConnectionIndex);
this.appServiceDeferral = appServiceDeferrals[this.currentConnectionIndex];
appServiceDeferrals.Remove(this.currentConnectionIndex);
this.centennialAppServiceDeferral = centennialAppServiceDeferrals[this.currentConnectionIndex];
centennialAppServiceDeferrals.Remove(this.currentConnectionIndex);
if (this.appServiceDeferral != null)
{
this.appServiceDeferral.Complete();
this.appServiceDeferral = null;
}
if (this.centennialAppServiceDeferral != null)
{
this.centennialAppServiceDeferral.Complete();
this.centennialAppServiceDeferral = null;
}
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached)
{
this.DebugSettings.EnableFrameRateCounter = true;
}
#endif
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (e.PrelaunchActivated == false)
{
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
// Ensure the current window is active
Window.Current.Activate();
}
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 7.5 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.9 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 5.5 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.4 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.1 KiB

Просмотреть файл

@ -1,13 +0,0 @@
<Page
x:Class="NativeMessagingHostInProcess.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:NativeMessagingHostInProcess"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
</Grid>
</Page>

Просмотреть файл

@ -1,30 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
namespace NativeMessagingHostInProcess
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
}
}

Просмотреть файл

@ -1,180 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{4270BC09-426E-49B6-A680-F0640F3A8AB2}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NativeMessagingHostInProcess</RootNamespace>
<AssemblyName>NativeMessagingHostInProcess</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.15063.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.15063.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PackageCertificateKeyFile>NativeMessagingHostInProcess_TemporaryKey.pfx</PackageCertificateKeyFile>
<PackageCertificateThumbprint>722BEB0AB1F8F860B68EB492744CC4AB2173A16B</PackageCertificateThumbprint>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
<Content Include="..\Extension\manifest.json">
<Link>Extension\manifest.json</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Win32\DigitalSigning.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Win32\DigitalSigning.pdb">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Include="NativeMessagingHostInProcess_TemporaryKey.pfx" />
<None Include="project.json" />
</ItemGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<ItemGroup>
<Content Include="..\Extension\background.js">
<Link>Extension\background.js</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\Extension\content.js">
<Link>Extension\content.js</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\Extension\icon_128.png">
<Link>Extension\icon_128.png</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\Extension\icon_16.png">
<Link>Extension\icon_16.png</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\Extension\icon_48.png">
<Link>Extension\icon_48.png</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Properties\Default.rd.xml" />
<Content Include="Assets\LockScreenLogo.scale-200.png" />
<Content Include="Assets\SplashScreen.scale-200.png" />
<Content Include="Assets\Square150x150Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Assets\StoreLogo.png" />
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<SDKReference Include="WindowsDesktop, Version=10.0.15063.0">
<Name>Windows Desktop Extensions for the UWP</Name>
</SDKReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<Target Name="AfterBuild">
<Copy SourceFiles="..\$(Configuration)\DigitalSigning.exe" DestinationFolder="win32" />
<Copy SourceFiles="..\$(Configuration)\DigitalSigning.pdb" DestinationFolder="win32" />
</Target>
</Project>

Двоичный файл не отображается.

Просмотреть файл

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" IgnorableNamespaces="uap uap3 mp rescap">
<Identity Name="c7c68d8f-2e31-432e-aca1-d482be4b181f" Publisher="CN=msft" Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="c7c68d8f-2e31-432e-aca1-d482be4b181f" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>NativeMessagingHostInProcess</DisplayName>
<PublisherDisplayName>msft</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="NativeMessagingHostInProcess.App">
<uap:VisualElements DisplayName="NativeMessagingHostInProcess" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="NativeMessagingHostInProcess" BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png">
</uap:DefaultTile>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
<Extensions>
<uap:Extension Category="windows.appService">
<uap:AppService Name="NativeMessagingHostInProcessService" />
</uap:Extension>
<uap:Extension Category="windows.protocol">
<uap:Protocol Name="msghost1" />
</uap:Extension>
<uap3:Extension Category="windows.appExtension">
<uap3:AppExtension Name="com.microsoft.edge.extension" Id="EdgeExtension" PublicFolder="Extension" DisplayName="ms-resource:DisplayName">
<uap3:Properties>
<Capabilities>
<Capability Name="websiteContent" />
<Capability Name="websiteInfo" />
<Capability Name="browserStorage" />
</Capabilities>
</uap3:Properties>
</uap3:AppExtension>
</uap3:Extension>
<desktop:Extension Category="windows.fullTrustProcess" Executable="Win32\DigitalSigning.exe" xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10" />
</Extensions>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<rescap:Capability Name="runFullTrust" />
</Capabilities>
</Package>

Просмотреть файл

@ -1,29 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NativeMessagingHostInProcess")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NativeMessagingHostInProcess")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]

Просмотреть файл

@ -1,31 +0,0 @@
<!--
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most
developers. However, you can modify these parameters to modify the behavior of the .NET Native
optimizer.
Runtime Directives are documented at http://go.microsoft.com/fwlink/?LinkID=391919
To fully enable reflection for App1.MyClass and all of its public/private members
<Type Name="App1.MyClass" Dynamic="Required All"/>
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32
<TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" />
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
<Namespace Name="DataClasses.ViewModels" Seralize="All" />
-->
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Application>
<!--
An Assembly element with Name="*Application*" applies to all assemblies in
the application package. The asterisks are not wildcards.
-->
<Assembly Name="*Application*" Dynamic="Required All" />
<!-- Add your application specific runtime directives here. -->
</Application>
</Directives>

Двоичный файл не отображается.

Двоичный файл не отображается.

Просмотреть файл

@ -1,16 +0,0 @@
{
"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0"
},
"frameworks": {
"uap10.0": {}
},
"runtimes": {
"win10-arm": {},
"win10-arm-aot": {},
"win10-x86": {},
"win10-x86-aot": {},
"win10-x64": {},
"win10-x64-aot": {}
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,8 +0,0 @@
<Application
x:Class="NativeMessagingHostOutOfProcess.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:NativeMessagingHostOutOfProcess"
RequestedTheme="Light">
</Application>

Просмотреть файл

@ -1,106 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace NativeMessagingHostOutOfProcess
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached)
{
this.DebugSettings.EnableFrameRateCounter = true;
}
#endif
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (e.PrelaunchActivated == false)
{
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
// Ensure the current window is active
Window.Current.Activate();
}
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 7.5 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.9 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 5.5 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.4 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.1 KiB

Просмотреть файл

@ -1,13 +0,0 @@
<Page
x:Class="NativeMessagingHostOutOfProcess.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:NativeMessagingHostOutOfProcess"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
</Grid>
</Page>

Просмотреть файл

@ -1,30 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
namespace NativeMessagingHostOutOfProcess
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
}
}

Просмотреть файл

@ -1,182 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{E1418F0E-0B32-40D9-8B38-AF22CC102232}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NativeMessagingHostOutOfProcess</RootNamespace>
<AssemblyName>NativeMessagingHostOutOfProcess</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.15063.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.15063.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PackageCertificateKeyFile>NativeMessagingHostOutOfProcess_TemporaryKey.pfx</PackageCertificateKeyFile>
<PackageCertificateThumbprint>62926DBE42F541BC497532B8468EE819C531BFC9</PackageCertificateThumbprint>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
<Content Include="..\Extension\manifest.json">
<Link>Extension\manifest.json</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Win32\DigitalSigning.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Win32\DigitalSigning.pdb">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Include="NativeMessagingHostOutOfProcess_TemporaryKey.pfx" />
<None Include="project.json" />
</ItemGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<ItemGroup>
<Content Include="..\Extension\background.js">
<Link>Extension\background.js</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\Extension\content.js">
<Link>Extension\content.js</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\Extension\icon_128.png">
<Link>Extension\icon_128.png</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\Extension\icon_16.png">
<Link>Extension\icon_16.png</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\Extension\icon_48.png">
<Link>Extension\icon_48.png</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Properties\Default.rd.xml" />
<Content Include="Assets\LockScreenLogo.scale-200.png" />
<Content Include="Assets\SplashScreen.scale-200.png" />
<Content Include="Assets\Square150x150Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Assets\StoreLogo.png" />
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NativeMessagingHostOutOfProcessAppService\NativeMessagingHostOutOfProcessAppService.csproj">
<Project>{c7cf7a6b-1394-425a-a340-e50afb19b884}</Project>
<Name>NativeMessagingHostOutOfProcessAppService</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<Target Name="AfterBuild">
<Copy SourceFiles="..\$(Configuration)\DigitalSigning.exe" DestinationFolder="win32" />
<Copy SourceFiles="..\$(Configuration)\DigitalSigning.pdb" DestinationFolder="win32" />
</Target>
</Project>

Двоичный файл не отображается.

Просмотреть файл

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" IgnorableNamespaces="uap uap3 mp rescap">
<Identity Name="C98EF00E-6D26-4256-9495-2E77B75C306E" Publisher="CN=msft" Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="091D2A1D-3CBE-4128-80A6-7DE5E6C56F22" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>NativeMessagingHostOutOfProcess</DisplayName>
<PublisherDisplayName>msft</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="NativeMessagingHostOutOfProcess.App">
<uap:VisualElements AppListEntry="none" DisplayName="NativeMessagingHostOutOfProcess" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="NativeMessagingHostOutOfProcess" BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png">
</uap:DefaultTile>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
<Extensions>
<uap:Extension Category="windows.appService" EntryPoint="NativeMessagingHostOutOfProcessAppService.Task">
<uap:AppService Name="NativeMessagingHostOutOfProcessService" />
</uap:Extension>
<uap:Extension Category="windows.protocol">
<uap:Protocol Name="msghost2" />
</uap:Extension>
<uap3:Extension Category="windows.appExtension">
<uap3:AppExtension Name="com.microsoft.edge.extension" Id="EdgeExtension" PublicFolder="Extension" DisplayName="ms-resource:DisplayName">
<uap3:Properties>
<Capabilities>
<Capability Name="websiteContent" />
<Capability Name="websiteInfo" />
<Capability Name="browserStorage" />
</Capabilities>
</uap3:Properties>
</uap3:AppExtension>
</uap3:Extension>
<desktop:Extension Category="windows.fullTrustProcess" Executable="Win32\DigitalSigning.exe" xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10" />
</Extensions>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<rescap:Capability Name="runFullTrust" />
</Capabilities>
</Package>

Просмотреть файл

@ -1,29 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NativeMessagingHostOutOfProcess")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NativeMessagingHostOutOfProcess")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]

Просмотреть файл

@ -1,31 +0,0 @@
<!--
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most
developers. However, you can modify these parameters to modify the behavior of the .NET Native
optimizer.
Runtime Directives are documented at http://go.microsoft.com/fwlink/?LinkID=391919
To fully enable reflection for App1.MyClass and all of its public/private members
<Type Name="App1.MyClass" Dynamic="Required All"/>
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32
<TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" />
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
<Namespace Name="DataClasses.ViewModels" Seralize="All" />
-->
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Application>
<!--
An Assembly element with Name="*Application*" applies to all assemblies in
the application package. The asterisks are not wildcards.
-->
<Assembly Name="*Application*" Dynamic="Required All" />
<!-- Add your application specific runtime directives here. -->
</Application>
</Directives>

Двоичный файл не отображается.

Двоичный файл не отображается.

Просмотреть файл

@ -1,16 +0,0 @@
{
"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0"
},
"frameworks": {
"uap10.0": {}
},
"runtimes": {
"win10-arm": {},
"win10-arm-aot": {},
"win10-x86": {},
"win10-x86-aot": {},
"win10-x64": {},
"win10-x64-aot": {}
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,130 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C7CF7A6B-1394-425A-A340-E50AFB19B884}</ProjectGuid>
<OutputType>winmdobj</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NativeMessagingHostOutOfProcessAppService</RootNamespace>
<AssemblyName>NativeMessagingHostOutOfProcessAppService</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.15063.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.15063.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<AllowCrossPlatformRetargeting>false</AllowCrossPlatformRetargeting>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<PlatformTarget>x86</PlatformTarget>
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<PlatformTarget>ARM</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<PlatformTarget>ARM</PlatformTarget>
<OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<PlatformTarget>x64</PlatformTarget>
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
<None Include="project.json" />
</ItemGroup>
<ItemGroup>
<Compile Include="Task.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<SDKReference Include="WindowsDesktop, Version=10.0.15063.0">
<Name>Windows Desktop Extensions for the UWP</Name>
</SDKReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

@ -1,29 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NativeMessagingHostOutOfProcessAppService")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NativeMessagingHostOutOfProcessAppService")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]

Просмотреть файл

@ -1,229 +0,0 @@
using System;
using System.Collections.Generic;
using Windows.ApplicationModel.AppService;
using Windows.ApplicationModel.Background;
using Windows.Foundation.Collections;
using Windows.Data.Json;
using Windows.UI.Popups;
namespace NativeMessagingHostOutOfProcessAppService
{
public sealed class Task : IBackgroundTask
{
private BackgroundTaskDeferral appServiceDeferral = null;
private AppServiceConnection connection = null;
private BackgroundTaskDeferral centennialAppServiceDeferral = null;
private AppServiceConnection centennialConnection = null;
private bool centennialAppLaunched = true;
private int currentConnectionIndex = 0;
static int connectionIndex = 0;
static int centennialConnectionIndex = 0;
static Dictionary<int, AppServiceConnection> connections = new Dictionary<int, AppServiceConnection>();
static Dictionary<int, AppServiceConnection> centennialConnections = new Dictionary<int, AppServiceConnection>();
static Dictionary<int, BackgroundTaskDeferral> appServiceDeferrals = new Dictionary<int, BackgroundTaskDeferral>();
static Dictionary<int, BackgroundTaskDeferral> centennialAppServiceDeferrals = new Dictionary<int, BackgroundTaskDeferral>();
static Object thisLock = new Object();
public async void Run(IBackgroundTaskInstance taskInstance)
{
if (taskInstance.TriggerDetails is AppServiceTriggerDetails)
{
AppServiceTriggerDetails appService = taskInstance.TriggerDetails as AppServiceTriggerDetails;
if (appService.CallerPackageFamilyName == Windows.ApplicationModel.Package.Current.Id.FamilyName) // App service connection from Centennial App
{
this.centennialAppServiceDeferral = taskInstance.GetDeferral(); // Get a deferral so that the service isn't terminated.
taskInstance.Canceled += OnCentennialAppServicesCanceled; // Associate a cancellation handler with the background task.
this.centennialConnection = appService.AppServiceConnection;
this.centennialConnection.RequestReceived += OnCentennialAppServiceRequestReceived;
this.centennialConnection.ServiceClosed += CentennialAppServiceConnection_ServiceClosed;
this.centennialConnection.AppServiceName = centennialConnectionIndex.ToString();
centennialConnections.Add(centennialConnectionIndex, this.centennialConnection);
centennialAppServiceDeferrals.Add(centennialConnectionIndex, this.centennialAppServiceDeferral);
centennialConnectionIndex++;
}
else // App service connection from Edge browser
{
this.appServiceDeferral = taskInstance.GetDeferral(); // Get a deferral so that the service isn't terminated.
taskInstance.Canceled += OnAppServicesCanceled; // Associate a cancellation handler with the background task.
this.connection = appService.AppServiceConnection;
this.connection.RequestReceived += OnAppServiceRequestReceived;
this.connection.ServiceClosed += AppServiceConnection_ServiceClosed;
this.connection.AppServiceName = connectionIndex.ToString();
connections.Add(connectionIndex, this.connection);
appServiceDeferrals.Add(connectionIndex, this.appServiceDeferral);
connectionIndex++;
try
{
// Make sure the BackgroundProcess is in your AppX folder, if not rebuild the solution
await Windows.ApplicationModel.FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
}
catch (Exception)
{
this.centennialAppLaunched = false;
MessageDialog dialog = new MessageDialog("Rebuild the solution and make sure the BackgroundProcess is in your AppX folder");
await dialog.ShowAsync();
}
}
}
}
/// <summary>
/// Receives message from Extension (via Edge)
/// </summary>
private async void OnAppServiceRequestReceived(AppServiceConnection sender, AppServiceRequestReceivedEventArgs args)
{
AppServiceDeferral messageDeferral = args.GetDeferral();
try
{
if (this.centennialAppLaunched)
{
this.currentConnectionIndex = Int32.Parse(sender.AppServiceName);
this.centennialConnection = centennialConnections[this.currentConnectionIndex];
// Send message to the Centennial component and wait for response
AppServiceResponse centennialResponse = await this.centennialConnection.SendMessageAsync(args.Request.Message);
await args.Request.SendResponseAsync(centennialResponse.Message);
}
else
{
throw new Exception("Failed to launch Centennial App!");
}
}
finally
{
messageDeferral.Complete();
}
}
/// <summary>
/// Associate the cancellation handler with the background task
/// </summary>
private void OnAppServicesCanceled(IBackgroundTaskInstance sender, BackgroundTaskCancellationReason reason)
{
AppServiceTriggerDetails appService = sender.TriggerDetails as AppServiceTriggerDetails;
this.currentConnectionIndex = Int32.Parse(appService.AppServiceConnection.AppServiceName);
this.centennialConnection = centennialConnections[this.currentConnectionIndex];
this.centennialConnection.Dispose();
centennialConnections.Remove(this.currentConnectionIndex);
this.appServiceDeferral = appServiceDeferrals[this.currentConnectionIndex];
appServiceDeferrals.Remove(this.currentConnectionIndex);
this.centennialAppServiceDeferral = centennialAppServiceDeferrals[this.currentConnectionIndex];
centennialAppServiceDeferrals.Remove(this.currentConnectionIndex);
if (this.appServiceDeferral != null)
{
this.appServiceDeferral.Complete();
this.appServiceDeferral = null;
}
if (this.centennialAppServiceDeferral != null)
{
this.centennialAppServiceDeferral.Complete();
this.centennialAppServiceDeferral = null;
}
}
/// <summary>
/// Occurs when the other endpoint closes the connection to the app service
/// </summary>
private void AppServiceConnection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
{
this.currentConnectionIndex = Int32.Parse(sender.AppServiceName);
this.centennialConnection = centennialConnections[this.currentConnectionIndex];
this.centennialConnection.Dispose();
centennialConnections.Remove(this.currentConnectionIndex);
this.appServiceDeferral = appServiceDeferrals[this.currentConnectionIndex];
appServiceDeferrals.Remove(this.currentConnectionIndex);
this.centennialAppServiceDeferral = centennialAppServiceDeferrals[this.currentConnectionIndex];
centennialAppServiceDeferrals.Remove(this.currentConnectionIndex);
if (this.appServiceDeferral != null)
{
this.appServiceDeferral.Complete();
this.appServiceDeferral = null;
}
if (this.centennialAppServiceDeferral != null)
{
this.centennialAppServiceDeferral.Complete();
this.centennialAppServiceDeferral = null;
}
}
/// <summary>
/// Receives message from Centennial App
/// </summary>
private async void OnCentennialAppServiceRequestReceived(AppServiceConnection sender, AppServiceRequestReceivedEventArgs args)
{
AppServiceDeferral messageDeferral = args.GetDeferral();
try
{
this.currentConnectionIndex = Int32.Parse(sender.AppServiceName);
this.connection = connections[this.currentConnectionIndex];
await this.connection.SendMessageAsync(args.Request.Message);
}
finally
{
messageDeferral.Complete();
}
}
/// <summary>
/// Associate the cancellation handler with the background task
/// </summary>
private void OnCentennialAppServicesCanceled(IBackgroundTaskInstance sender, BackgroundTaskCancellationReason reason)
{
AppServiceTriggerDetails appService = sender.TriggerDetails as AppServiceTriggerDetails;
this.currentConnectionIndex = Int32.Parse(appService.AppServiceConnection.AppServiceName);
this.connection = connections[this.currentConnectionIndex];
this.connection.Dispose();
connections.Remove(this.currentConnectionIndex);
this.appServiceDeferral = appServiceDeferrals[this.currentConnectionIndex];
appServiceDeferrals.Remove(this.currentConnectionIndex);
this.centennialAppServiceDeferral = centennialAppServiceDeferrals[this.currentConnectionIndex];
centennialAppServiceDeferrals.Remove(this.currentConnectionIndex);
if (this.appServiceDeferral != null)
{
this.appServiceDeferral.Complete();
this.appServiceDeferral = null;
}
if (this.centennialAppServiceDeferral != null)
{
this.centennialAppServiceDeferral.Complete();
this.centennialAppServiceDeferral = null;
}
}
/// <summary>
/// Occurs when the other endpoint closes the connection to the app service
/// </summary>
private void CentennialAppServiceConnection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
{
this.currentConnectionIndex = Int32.Parse(sender.AppServiceName);
this.connection = connections[this.currentConnectionIndex];
this.connection.Dispose();
connections.Remove(this.currentConnectionIndex);
this.appServiceDeferral = appServiceDeferrals[this.currentConnectionIndex];
appServiceDeferrals.Remove(this.currentConnectionIndex);
this.centennialAppServiceDeferral = centennialAppServiceDeferrals[this.currentConnectionIndex];
centennialAppServiceDeferrals.Remove(this.currentConnectionIndex);
if (this.appServiceDeferral != null)
{
this.appServiceDeferral.Complete();
this.appServiceDeferral = null;
}
if (this.centennialAppServiceDeferral != null)
{
this.centennialAppServiceDeferral.Complete();
this.centennialAppServiceDeferral = null;
}
}
}
}

Просмотреть файл

@ -1,16 +0,0 @@
{
"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0"
},
"frameworks": {
"uap10.0": {}
},
"runtimes": {
"win10-arm": {},
"win10-arm-aot": {},
"win10-x86": {},
"win10-x86-aot": {},
"win10-x64": {},
"win10-x64-aot": {}
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,130 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26403.7
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NativeMessagingHostInProcess", "NativeMessagingHostInProcess\NativeMessagingHostInProcess.csproj", "{4270BC09-426E-49B6-A680-F0640F3A8AB2}"
ProjectSection(ProjectDependencies) = postProject
{CF6580E8-1EF8-4055-8FE0-77EC6D9974C4} = {CF6580E8-1EF8-4055-8FE0-77EC6D9974C4}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DigitalSigning", "DigitalSigning\DigitalSigning.vcxproj", "{CF6580E8-1EF8-4055-8FE0-77EC6D9974C4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NativeMessagingHostOutOfProcessAppService", "NativeMessagingHostOutOfProcessAppService\NativeMessagingHostOutOfProcessAppService.csproj", "{C7CF7A6B-1394-425A-A340-E50AFB19B884}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NativeMessagingHostOutOfProcess", "NativeMessagingHostOutOfProcess\NativeMessagingHostOutOfProcess.csproj", "{E1418F0E-0B32-40D9-8B38-AF22CC102232}"
ProjectSection(ProjectDependencies) = postProject
{CF6580E8-1EF8-4055-8FE0-77EC6D9974C4} = {CF6580E8-1EF8-4055-8FE0-77EC6D9974C4}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extension", "Extension", "{DF7D2DF6-818B-4413-9678-B804C63D4447}"
ProjectSection(SolutionItems) = preProject
Extension\background.js = Extension\background.js
Extension\content.js = Extension\content.js
Extension\icon_128.png = Extension\icon_128.png
Extension\icon_16.png = Extension\icon_16.png
Extension\icon_48.png = Extension\icon_48.png
Extension\manifest.json = Extension\manifest.json
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9D455785-71A4-4875-A29C-D305DF12F0D6}"
ProjectSection(SolutionItems) = preProject
test_oca21_client_password11111111.pfx = test_oca21_client_password11111111.pfx
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM = Debug|ARM
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Debug|Any CPU.ActiveCfg = Debug|x86
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Debug|Any CPU.Build.0 = Debug|x86
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Debug|Any CPU.Deploy.0 = Debug|x86
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Debug|ARM.ActiveCfg = Debug|ARM
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Debug|ARM.Build.0 = Debug|ARM
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Debug|ARM.Deploy.0 = Debug|ARM
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Debug|x64.ActiveCfg = Debug|x64
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Debug|x64.Build.0 = Debug|x64
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Debug|x64.Deploy.0 = Debug|x64
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Debug|x86.ActiveCfg = Debug|x86
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Debug|x86.Build.0 = Debug|x86
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Debug|x86.Deploy.0 = Debug|x86
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Release|Any CPU.ActiveCfg = Release|x86
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Release|Any CPU.Build.0 = Release|x86
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Release|Any CPU.Deploy.0 = Release|x86
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Release|ARM.ActiveCfg = Release|ARM
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Release|ARM.Build.0 = Release|ARM
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Release|ARM.Deploy.0 = Release|ARM
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Release|x64.ActiveCfg = Release|x64
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Release|x64.Build.0 = Release|x64
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Release|x64.Deploy.0 = Release|x64
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Release|x86.ActiveCfg = Release|x86
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Release|x86.Build.0 = Release|x86
{4270BC09-426E-49B6-A680-F0640F3A8AB2}.Release|x86.Deploy.0 = Release|x86
{CF6580E8-1EF8-4055-8FE0-77EC6D9974C4}.Debug|Any CPU.ActiveCfg = Debug|Win32
{CF6580E8-1EF8-4055-8FE0-77EC6D9974C4}.Debug|Any CPU.Build.0 = Debug|Win32
{CF6580E8-1EF8-4055-8FE0-77EC6D9974C4}.Debug|Any CPU.Deploy.0 = Debug|Win32
{CF6580E8-1EF8-4055-8FE0-77EC6D9974C4}.Debug|ARM.ActiveCfg = Debug|Win32
{CF6580E8-1EF8-4055-8FE0-77EC6D9974C4}.Debug|x64.ActiveCfg = Debug|x64
{CF6580E8-1EF8-4055-8FE0-77EC6D9974C4}.Debug|x64.Build.0 = Debug|x64
{CF6580E8-1EF8-4055-8FE0-77EC6D9974C4}.Debug|x86.ActiveCfg = Debug|Win32
{CF6580E8-1EF8-4055-8FE0-77EC6D9974C4}.Debug|x86.Build.0 = Debug|Win32
{CF6580E8-1EF8-4055-8FE0-77EC6D9974C4}.Release|Any CPU.ActiveCfg = Release|Win32
{CF6580E8-1EF8-4055-8FE0-77EC6D9974C4}.Release|Any CPU.Build.0 = Release|Win32
{CF6580E8-1EF8-4055-8FE0-77EC6D9974C4}.Release|ARM.ActiveCfg = Release|Win32
{CF6580E8-1EF8-4055-8FE0-77EC6D9974C4}.Release|x64.ActiveCfg = Release|x64
{CF6580E8-1EF8-4055-8FE0-77EC6D9974C4}.Release|x64.Build.0 = Release|x64
{CF6580E8-1EF8-4055-8FE0-77EC6D9974C4}.Release|x86.ActiveCfg = Release|Win32
{CF6580E8-1EF8-4055-8FE0-77EC6D9974C4}.Release|x86.Build.0 = Release|Win32
{C7CF7A6B-1394-425A-A340-E50AFB19B884}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C7CF7A6B-1394-425A-A340-E50AFB19B884}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C7CF7A6B-1394-425A-A340-E50AFB19B884}.Debug|ARM.ActiveCfg = Debug|ARM
{C7CF7A6B-1394-425A-A340-E50AFB19B884}.Debug|ARM.Build.0 = Debug|ARM
{C7CF7A6B-1394-425A-A340-E50AFB19B884}.Debug|x64.ActiveCfg = Debug|x64
{C7CF7A6B-1394-425A-A340-E50AFB19B884}.Debug|x64.Build.0 = Debug|x64
{C7CF7A6B-1394-425A-A340-E50AFB19B884}.Debug|x86.ActiveCfg = Debug|x86
{C7CF7A6B-1394-425A-A340-E50AFB19B884}.Debug|x86.Build.0 = Debug|x86
{C7CF7A6B-1394-425A-A340-E50AFB19B884}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C7CF7A6B-1394-425A-A340-E50AFB19B884}.Release|Any CPU.Build.0 = Release|Any CPU
{C7CF7A6B-1394-425A-A340-E50AFB19B884}.Release|ARM.ActiveCfg = Release|ARM
{C7CF7A6B-1394-425A-A340-E50AFB19B884}.Release|ARM.Build.0 = Release|ARM
{C7CF7A6B-1394-425A-A340-E50AFB19B884}.Release|x64.ActiveCfg = Release|x64
{C7CF7A6B-1394-425A-A340-E50AFB19B884}.Release|x64.Build.0 = Release|x64
{C7CF7A6B-1394-425A-A340-E50AFB19B884}.Release|x86.ActiveCfg = Release|x86
{C7CF7A6B-1394-425A-A340-E50AFB19B884}.Release|x86.Build.0 = Release|x86
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Debug|Any CPU.ActiveCfg = Debug|x86
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Debug|Any CPU.Build.0 = Debug|x86
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Debug|Any CPU.Deploy.0 = Debug|x86
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Debug|ARM.ActiveCfg = Debug|ARM
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Debug|ARM.Build.0 = Debug|ARM
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Debug|ARM.Deploy.0 = Debug|ARM
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Debug|x64.ActiveCfg = Debug|x64
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Debug|x64.Build.0 = Debug|x64
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Debug|x64.Deploy.0 = Debug|x64
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Debug|x86.ActiveCfg = Debug|x86
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Debug|x86.Build.0 = Debug|x86
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Debug|x86.Deploy.0 = Debug|x86
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Release|Any CPU.ActiveCfg = Release|x86
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Release|Any CPU.Build.0 = Release|x86
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Release|Any CPU.Deploy.0 = Release|x86
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Release|ARM.ActiveCfg = Release|ARM
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Release|ARM.Build.0 = Release|ARM
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Release|ARM.Deploy.0 = Release|ARM
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Release|x64.ActiveCfg = Release|x64
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Release|x64.Build.0 = Release|x64
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Release|x64.Deploy.0 = Release|x64
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Release|x86.ActiveCfg = Release|x86
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Release|x86.Build.0 = Release|x86
{E1418F0E-0B32-40D9-8B38-AF22CC102232}.Release|x86.Deploy.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Просмотреть файл

@ -1,125 +0,0 @@
# DigitalSigning
## About the sample
The DigitalSigning sample illustrates the use of Native Messaging APIs that allows a Microsoft Edge extension to communicate with a companion Universal Windows Platform (UWP) application. It also include a [Desktop Bridge](https://developer.microsoft.com/windows/bridges/desktop) (Win32) component, which is written in C++ to access functionality that isn't available to the extension or the UWP app.
Once the sample is deployed and the user has established the connection between the extension and the UWP app by selecting "connect", they'll be able to sign a text with a certificate that was installed on the machine.
![website running that has a user enter a password and then become encrypted](../media/digitalsigningsamplerunning.PNG)
This sample has five main components:
1. Test web page
2. Microsoft Edge extension
2. UWP hosting `AppService` in the main app
3. UWP hosting `AppService` as a background task
4. Desktop Bridge exe
### Test web page
The test web page ([**msgsign.html**](./msgsign.html)) illustrates how to configure a website to interact with the content script of an extension. By using custom events, the web page can pass and receive messages from the content script of the extension, thereby allowing user input to be encrypted via the extension.
To test this example, you'll need to host this file in IIS. You'll also need to add the certificate ([**test_oca21_client_password11111111.pfx**](./test_oca21_client_password11111111.pfx)) to your certificate store, with the following password :
`11111111`
### Microsoft Edge extension
The extension is a basic extension that uses both a background and content script. The content script's main functionality is to detect when the user is entering data that needs to be secured. The extension communicates this to the Desktop Bridge component via native messaging. When the user is ready to submit the data, the extension will return an encrypted value back to the website.
### UWP hosting AppService in the main app
By default this sample is setup to have the native messaging host run in the main app. This is implemented in the project's `NativeMessagingHostInProcess` component. Native messaging on Microsoft Edge is supported via [`AppService`](https://msdn.microsoft.com/windows/uwp/launch-resume/how-to-create-and-consume-an-app-service), a mechanism that allows a UWP app to provide service to another UWP app. In this case, Microsoft Edge, as the host of the extension, is brokering the `AppService` call to the companion UWP that is packaged with the extension.
Note the registration of the `AppService` in the **package.appxmanifest** file that is part of the project. The `AppService Name` specified in the manifest `"NativeMessagingHostInProcessService"` has to match the parameter that is used in the extension's call to [`runtime.connectNative`](https://developer.mozilla.org/Add-ons/WebExtensions/API/runtime/connectNative) or [`runtime.sendNativeMessage`](https://developer.mozilla.org/Add-ons/WebExtensions/API/runtime/sendNativeMessage).
JSON messages from the extension are stringified as a value in the first [KeyValue pair](https://msdn.microsoft.com//library/windows/apps/5tbh8a42) of the [ValueSet](https://msdn.microsoft.com/library/windows/apps/dn636131) object.
### UWP hosting AppService in the background task
The only difference between hosting `AppService` in the main app and in the background task is that a background task has a few restrictions. See [Guidelines for background tasks](https://msdn.microsoft.com/windows/uwp/launch-resume/guidelines-for-background-tasks) to determine which option is ideal for your scenario.
To see the background task implementation of the native messaging host, you'll need to edit the extension's background script by changing the string within
`port = browser.runtime.connectNative("NativeMessagingHostInProcessService");` to `"NativeMessagingHostOutOfProcess"`.
You will also need to modify the **DigitalSigning.cpp** in the `DigitalSigning` project to connect to `NativeMessagingHostOutOfProcessService` instead of `NativeMessagingHostInProcessService`.
### Desktop Bridge
This component implements the core functionality that uses Win32 APIs to access functionality that are not available to UWP applications. However, because the executable is packaged in an AppX package, it will be able to communicate using `AppService` with the companion UWP application.
To get started with converting a Win32 to Desktop Bridge app, head [here](https://msdn.microsoft.com/windows/uwp/porting/desktop-to-uwp-run-desktop-app-converter).
## Deploying
The solution is currently configured with `NativeMessagingHostInProcess` as the companion UWP.
The goal of the deployment is to make sure that the extension and Win32 files are copied to the relevant folders in the packaging location.
This can be done with via the following steps in Visual Studio (as set up in the sample):
1. Add a new `Extension` folder to `NativeMessagingHostInProcess` project. Add all the extension files link (instead of local copy) so any changes are reflected in the package. Make sure the properties for them are set to `Build Action` = `Content` and `Copy to Output Directory` = `Copy Always`.
2. Add a new `Win32` folder to `NativeMessagingHostInProcess` project and add the necessary Win32 binaries to this folder.
3. Since VS' default configuration for Win32 project is to place x64 binaries in a different folder structure compared to x86, we need to modify the project configuration so both x64 and x86 bits are binplaced to the same folder structure. This is accomplished by changing the default value of `Output File` to `$(SolutionDir)$(Configuration)\$(TargetName)$(TargetExt)` and `Generate Program Database File` to `$(SolutionDir)$(Configuration)\$(TargetName)$(TargetExt)`.
4. Modify the **NativeMessagingHostInProcess.csproj** file to include a PostBuild event to copy all the generated Win32 binaries to the Win32 folder."`:
```xml
<Target Name="AfterBuild">
<Copy SourceFiles="..\$(Configuration)\DigitalSigning.exe" DestinationFolder="win32" />
<Copy SourceFiles="..\$(Configuration)\DigitalSigning.pdb" DestinationFolder="win32" />
</Target>
```
5. Update **package.manifest** to point to the Win32 binary in the `Win32` folder.
6. Build and deploy the `NativeMessagingHostinProcess` UWP app.
![build inprocess project](../media/buildnativemessaginghostinprocess.png)
This will generate:
- Necessary binaries and files needed for the UWP app.
- The **AppX** folder.
- The **AppXManifest.xml** based on the content of **package.manifest**. (The content of **package.manifest** in this sample has been edited to include the necessary entries for Microsoft Edge extensions).
Once the solution is correctly deployed, you should see the extension in Microsoft Edge.
![extension showing in Microsoft Edge](../media/digitalsigningextension.png)
## Creating AppX package for Store submission
The steps for creating an AppX package is similar to how one would [create a UWP package using Visual Studio](https://docs.microsoft.com/en-us/windows/uwp/packaging/packaging-uwp-apps#create-an-app-package).
## Debugging
The instructions for debugging vary depending on which component you want to test out:
### Debugging the extension
Once the solution is deployed, the extension will be installed in Microsoft Edge. Checkout the [Debugging](https://developer.microsoft.com/microsoft-Microsoft Edge/platform/documentation/extensions/guides/debugging-extensions/) guide for info on how to debug an extension.
### Debugging the UWP app
The UWP app will launch when the extension tries to connect to it using [native messaging APIs](https://developer.mozilla.org/Add-ons/WebExtensions/API/runtime/connectNative). Youll need to debug the UWP app only once the process starts. This can be configured via the projects property page:
1. In Visual Studio, right click your `NativeMessagingHostInProcess` project
2. Select Properties
![properties option](../media/properties.png)
3. Check "Do not launch, but debug my code when it starts"
![selecting do not launch box](../media/donotlaunch.png)
You can now set breakpoints in the code where you want to debug and launch the debugger by pressing F5. Once you interact with the extension to connect to the UWP app, Visual Studio will automatically attach to the process.
### Debugging the Desktop Bridge
Even though there are various [methods for debugging a Desktop Bridge](https://msdn.microsoft.com/windows/uwp/porting/desktop-to-uwp-debug) (converted Win32 app), the only one applicable for this scenarios is the PLMDebug option. You could also add debugging code to the startup function to perform a wait for a specific time, allowing you to attach Visual Studio to the process.

Просмотреть файл

@ -1,55 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Edge Online Banking Digital Signing Demo</title>
<script language="javascript" type="text/javascript">
function SignOnClick() {
var text = document.getElementById("OriginalText").value;
var event = new CustomEvent('SignRequest', { 'detail': text });
document.dispatchEvent(event);
}
document.addEventListener('SignResponse',
function (e) {
document.getElementById("Signature").value = e.detail;
}, false);
</script>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<h1>Message Digital Signing</h1>
</td>
</tr>
</table>
<tr>
<input type="button" id="ConnectButton" name="ConnectButton" value="Connect">
<input type="button" id="DisconnectButton" name="DisconnectButton" value="Disconnect" disabled>
</tr>
<hr />
<label>
<h3>Message Signing</h3>
</label>
<label>
Original Text
<br />
<textarea id="OriginalText" rows="8" style="width: 650px"></textarea>
</label>
<label>
<br>
<input type="button" id="SignButton" onclick="SignOnClick()" name="SignButton" value="Sign" disabled>
</label>
<br />
<br />
<label>
Signature
<br />
<textarea id="Signature" rows="8" style="width: 650px"></textarea>
</label>
<br />
</body>
</html>

Двоичный файл не отображается.

Двоичные данные
SecureInput/.vs/SecureInput/v14/.suo

Двоичный файл не отображается.

Просмотреть файл

@ -1,85 +0,0 @@
// Store port for native messaging connections
var portDict = {};
// Listen for messages from content script
browser.runtime.onMessage.addListener(
function (request, sender, sendResponse) {
try {
if (request.type == "connect") {
connect(sender.tab);
sendResponse({ success: true });
} else if (request.type == "disconnect") {
disconnect(sender.tab);
sendResponse({ success: true });
} else {
sendNativeMessage(request.message, sender.tab);
document.addEventListener('nativeMessage',
function handleNativeMessage(e) {
sendResponse(e.detail);
document.removeEventListener(e.type, handleNativeMessage);
}, false);
}
return true;
}
catch (e) {
sendResponse({ success: false, message: e.message })
return true;
}
});
function onDisconnected() {
// Query current active window
browser.tabs.query({ active: true, currentWindow: true }, function (tabs) {
var lastTabId = tabs[0].id;
browser.tabs.sendMessage(lastTabId, "disconnected");
});
}
function onNativeMessage(message) {
if ((message.length == 1) || (message == "delete")) // Handle intercepted key event from native app
{
// Query current active window
browser.tabs.query({ active: true, currentWindow: true }, function (tabs) {
var lastTabId = tabs[0].id;
browser.tabs.sendMessage(lastTabId, message);
})
}
else // Handle encrypted password
{
var event = new CustomEvent('nativeMessage', { 'detail': message });
document.dispatchEvent(event);
}
}
// Connect to native app and get the communication port
function connect(tab) {
var port = null;
// Connect the App Service in Native App, change to "NativeMessagingHostOutOfProcessService"
// while switching to App Service out-of-proc model
port = browser.runtime.connectNative("NativeMessagingHostInProcessService");
port.onMessage.addListener(onNativeMessage);
port.onDisconnect.addListener(onDisconnected);
var id = tab.id;
portDict[id] = port;
}
// Disconnect from native app
function disconnect(tab) {
var id = tab.id;
portDict[id].disconnect();
delete portDict[id];
}
// Send message to native app
function sendNativeMessage(message, tab) {
var id = tab.id;
try {
portDict[id].postMessage(message);
}
catch (e) {
throw e;
}
}

Просмотреть файл

@ -1,112 +0,0 @@
// Connect native app automatically when page is loaded
window.onload = connectNativeApp;
// Disconnect native app automatically when page is unloaded
window.onbeforeunload = disconnectNativeApp;
// Update UI element enable state depending on connectivity to UWP
function updateUiState(connected) {
if (connected) {
document.getElementById('ConnectButton').disabled = true;
document.getElementById('DisconnectButton').disabled = false;
document.getElementById('SubmitButton').disabled = false;
} else {
document.getElementById('ConnectButton').disabled = false;
document.getElementById('DisconnectButton').disabled = true;
document.getElementById('SubmitButton').disabled = true;
}
}
// Connect to Native Messaging Host
function connectNativeApp() {
var request = new Object();
request.type = "connect";
browser.runtime.sendMessage(request,
function (response) {
if (response.success) {
updateUiState(true);
} else {
console.error(response.message);
}
});
}
// Disconnect from Native Messaging Host
function disconnectNativeApp() {
var request = new Object();
request.type = "disconnect";
browser.runtime.sendMessage(request,
function (response) {
if (response.success) {
updateUiState(false);
} else {
console.error(response.message);
}
});
}
// Submit password for encryption
function submitPassword() {
var request = new Object();
request.type = "SubmitPassword";
request.message = { 'MessageType': 'submit' };
browser.runtime.sendMessage(request,
function (response) {
document.getElementById("EncryptedPassword").value = response;
});
}
// Notify Native Messaging Host that textbox has focus and we should start intercepting keys
function passwordInputFocus() {
if (document.getElementById('ConnectButton').disabled) {
var request = new Object();
request.type = "PasswordInputFocus";
request.message = { 'MessageType': 'focus' };
browser.runtime.sendMessage(request,
function (response) {
document.getElementById("EncryptedPassword").value = response;
});
}
}
// Notify Native Messaging Host that textbox is out of focus, and we should stop intercepting keys
function passwordInputBlur() {
if (document.getElementById('ConnectButton').disabled) {
var request = new Object();
request.type = "PasswordInputBlur";
request.message = { 'MessageType': 'focusout' };
browser.runtime.sendMessage(request,
function (response) {
document.getElementById("EncryptedPassword").value = response;
});
}
}
// Update HTML page UI depending on messages from background script
browser.runtime.onMessage.addListener(function (message) {
var passwordField = document.getElementById("Password");
if (message == "*") {
passwordField.value += message;
} else if (message == "delete") {
passwordField.value = passwordField.value.slice(0, -1);
} else if (message == "disconnected") {
updateUiState(false);
}
// Move cursor to the end
var endIndex = passwordField.value.length;
if (passwordField.setSelectionRange) {
passwordField.setSelectionRange(endIndex, endIndex);
}
});
document.getElementById('ConnectButton').onclick = connectNativeApp;
document.getElementById('DisconnectButton').onclick = disconnectNativeApp;
document.getElementById('SubmitButton').onclick = submitPassword;
document.getElementById('Password').onfocus = passwordInputFocus;
document.getElementById('Password').onblur = passwordInputBlur;

Двоичные данные
SecureInput/Extension/icon_128.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.2 KiB

Двоичные данные
SecureInput/Extension/icon_16.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 391 B

Двоичные данные
SecureInput/Extension/icon_48.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Просмотреть файл

@ -1,33 +0,0 @@
{
"name" : "SecureInput",
"version" : "1.0.0.0",
"description" : "China online banking secure input reference implementation",
"author": "msft",
"background": {
"scripts": [ "background.js" ],
"persistent": true
},
"default_locale": "en_US",
"content_scripts": [
{
"matches": ["*://*/secureinput*"],
"js": ["content.js"],
"run_at": "document_end"
}
],
"permissions": [
"*://*/secureinput*",
"nativeMessaging",
"activeTab"
],
"icons": {
"16": "icon_16.png",
"48": "icon_48.png",
"128": "icon_128.png"
}
}

Просмотреть файл

@ -1,8 +0,0 @@
<Application
x:Class="NativeMessagingHostInProcess.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:NativeMessagingHostInProcess"
RequestedTheme="Light">
</Application>

Просмотреть файл

@ -1,338 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading.Tasks;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.ApplicationModel.AppService;
using Windows.ApplicationModel.Background;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace NativeMessagingHostInProcess
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
private BackgroundTaskDeferral appServiceDeferral = null;
private AppServiceConnection connection = null;
private BackgroundTaskDeferral desktopBridgeAppServiceDeferral = null;
private AppServiceConnection desktopBridgeConnection = null;
private bool desktopBridgeAppLaunched = true;
private int currentConnectionIndex = 0;
static int connectionIndex = 0;
static int desktopBridgeConnectionIndex = 0;
static Dictionary<int, AppServiceConnection> connections = new Dictionary<int, AppServiceConnection>();
static Dictionary<int, AppServiceConnection> desktopBridgeConnections = new Dictionary<int, AppServiceConnection>();
static Dictionary<int, BackgroundTaskDeferral> appServiceDeferrals = new Dictionary<int, BackgroundTaskDeferral>();
static Dictionary<int, BackgroundTaskDeferral> desktopBridgeAppServiceDeferrals = new Dictionary<int, BackgroundTaskDeferral>();
static Object thisLock = new Object();
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
}
/// <summary>
/// Initializes the app service on the host process
/// </summary>
protected async override void OnBackgroundActivated(BackgroundActivatedEventArgs args)
{
base.OnBackgroundActivated(args);
IBackgroundTaskInstance taskInstance = args.TaskInstance;
if (taskInstance.TriggerDetails is AppServiceTriggerDetails)
{
AppServiceTriggerDetails appService = taskInstance.TriggerDetails as AppServiceTriggerDetails;
if (appService.CallerPackageFamilyName == Windows.ApplicationModel.Package.Current.Id.FamilyName) // App service connection from desktopBridge App
{
this.desktopBridgeAppServiceDeferral = taskInstance.GetDeferral(); // Get a deferral so that the service isn't terminated.
taskInstance.Canceled += OndesktopBridgeAppServicesCanceled; // Associate a cancellation handler with the background task.
this.desktopBridgeConnection = appService.AppServiceConnection;
this.desktopBridgeConnection.RequestReceived += OndesktopBridgeAppServiceRequestReceived;
this.desktopBridgeConnection.ServiceClosed += desktopBridgeAppServiceConnection_ServiceClosed;
lock (thisLock)
{
this.desktopBridgeConnection.AppServiceName = desktopBridgeConnectionIndex.ToString();
desktopBridgeConnections.Add(desktopBridgeConnectionIndex, this.desktopBridgeConnection);
desktopBridgeAppServiceDeferrals.Add(desktopBridgeConnectionIndex, this.desktopBridgeAppServiceDeferral);
desktopBridgeConnectionIndex++;
}
}
else // App service connection from Edge browser
{
this.appServiceDeferral = taskInstance.GetDeferral(); // Get a deferral so that the service isn't terminated.
taskInstance.Canceled += OnAppServicesCanceled; // Associate a cancellation handler with the background task.
this.connection = appService.AppServiceConnection;
this.connection.RequestReceived += OnAppServiceRequestReceived;
this.connection.ServiceClosed += AppServiceConnection_ServiceClosed;
lock (thisLock)
{
this.connection.AppServiceName = connectionIndex.ToString();
connections.Add(connectionIndex, this.connection);
appServiceDeferrals.Add(connectionIndex, this.appServiceDeferral);
connectionIndex++;
}
try
{
// Make sure the PasswordInputProtection.exe is in your AppX folder, if not rebuild the solution
await Windows.ApplicationModel.FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
}
catch (Exception)
{
this.desktopBridgeAppLaunched = false;
MessageDialog dialog = new MessageDialog("Rebuild the solution and make sure the PasswordInputProtection.exe is in your AppX folder");
await dialog.ShowAsync();
}
}
}
}
/// <summary>
/// Receives message from Extension (via Edge)
/// </summary>
private async void OnAppServiceRequestReceived(AppServiceConnection sender, AppServiceRequestReceivedEventArgs args)
{
AppServiceDeferral messageDeferral = args.GetDeferral();
try
{
if (this.desktopBridgeAppLaunched)
{
this.currentConnectionIndex = Int32.Parse(sender.AppServiceName);
this.desktopBridgeConnection = desktopBridgeConnections[this.currentConnectionIndex];
// Send message to the desktopBridge component and wait for response
AppServiceResponse desktopBridgeResponse = await this.desktopBridgeConnection.SendMessageAsync(args.Request.Message);
await args.Request.SendResponseAsync(desktopBridgeResponse.Message);
}
else
{
throw new Exception("Failed to launch desktopBridge App!");
}
}
finally
{
messageDeferral.Complete();
}
}
/// <summary>
/// Associate the cancellation handler with the background task
/// </summary>
private void OnAppServicesCanceled(IBackgroundTaskInstance sender, BackgroundTaskCancellationReason reason)
{
AppServiceTriggerDetails appService = sender.TriggerDetails as AppServiceTriggerDetails;
this.currentConnectionIndex = Int32.Parse(appService.AppServiceConnection.AppServiceName);
this.desktopBridgeConnection = desktopBridgeConnections[this.currentConnectionIndex];
this.desktopBridgeConnection.Dispose();
desktopBridgeConnections.Remove(this.currentConnectionIndex);
this.appServiceDeferral = appServiceDeferrals[this.currentConnectionIndex];
appServiceDeferrals.Remove(this.currentConnectionIndex);
this.desktopBridgeAppServiceDeferral = desktopBridgeAppServiceDeferrals[this.currentConnectionIndex];
desktopBridgeAppServiceDeferrals.Remove(this.currentConnectionIndex);
if (this.appServiceDeferral != null)
{
this.appServiceDeferral.Complete();
this.appServiceDeferral = null;
}
if (this.desktopBridgeAppServiceDeferral != null)
{
this.desktopBridgeAppServiceDeferral.Complete();
this.desktopBridgeAppServiceDeferral = null;
}
}
/// <summary>
/// Occurs when the other endpoint closes the connection to the app service
/// </summary>
private void AppServiceConnection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
{
this.currentConnectionIndex = Int32.Parse(sender.AppServiceName);
this.desktopBridgeConnection = desktopBridgeConnections[this.currentConnectionIndex];
this.desktopBridgeConnection.Dispose();
desktopBridgeConnections.Remove(this.currentConnectionIndex);
this.appServiceDeferral = appServiceDeferrals[this.currentConnectionIndex];
appServiceDeferrals.Remove(this.currentConnectionIndex);
this.desktopBridgeAppServiceDeferral = desktopBridgeAppServiceDeferrals[this.currentConnectionIndex];
desktopBridgeAppServiceDeferrals.Remove(this.currentConnectionIndex);
if (this.appServiceDeferral != null)
{
this.appServiceDeferral.Complete();
this.appServiceDeferral = null;
}
if (this.desktopBridgeAppServiceDeferral != null)
{
this.desktopBridgeAppServiceDeferral.Complete();
this.desktopBridgeAppServiceDeferral = null;
}
}
/// <summary>
/// Receives message from desktopBridge App
/// </summary>
private async void OndesktopBridgeAppServiceRequestReceived(AppServiceConnection sender, AppServiceRequestReceivedEventArgs args)
{
AppServiceDeferral messageDeferral = args.GetDeferral();
try
{
this.currentConnectionIndex = Int32.Parse(sender.AppServiceName);
this.connection = connections[this.currentConnectionIndex];
await this.connection.SendMessageAsync(args.Request.Message);
}
finally
{
messageDeferral.Complete();
}
}
/// <summary>
/// Associate the cancellation handler with the background task
/// </summary>
private void OndesktopBridgeAppServicesCanceled(IBackgroundTaskInstance sender, BackgroundTaskCancellationReason reason)
{
AppServiceTriggerDetails appService = sender.TriggerDetails as AppServiceTriggerDetails;
this.currentConnectionIndex = Int32.Parse(appService.AppServiceConnection.AppServiceName);
this.connection = connections[this.currentConnectionIndex];
this.connection.Dispose();
connections.Remove(this.currentConnectionIndex);
this.appServiceDeferral = appServiceDeferrals[this.currentConnectionIndex];
appServiceDeferrals.Remove(this.currentConnectionIndex);
this.desktopBridgeAppServiceDeferral = desktopBridgeAppServiceDeferrals[this.currentConnectionIndex];
desktopBridgeAppServiceDeferrals.Remove(this.currentConnectionIndex);
if (this.appServiceDeferral != null)
{
this.appServiceDeferral.Complete();
this.appServiceDeferral = null;
}
if (this.desktopBridgeAppServiceDeferral != null)
{
this.desktopBridgeAppServiceDeferral.Complete();
this.desktopBridgeAppServiceDeferral = null;
}
}
/// <summary>
/// Occurs when the other endpoint closes the connection to the app service
/// </summary>
private void desktopBridgeAppServiceConnection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
{
this.currentConnectionIndex = Int32.Parse(sender.AppServiceName);
this.connection = connections[this.currentConnectionIndex];
this.connection.Dispose();
connections.Remove(this.currentConnectionIndex);
this.appServiceDeferral = appServiceDeferrals[this.currentConnectionIndex];
appServiceDeferrals.Remove(this.currentConnectionIndex);
this.desktopBridgeAppServiceDeferral = desktopBridgeAppServiceDeferrals[this.currentConnectionIndex];
desktopBridgeAppServiceDeferrals.Remove(this.currentConnectionIndex);
if (this.appServiceDeferral != null)
{
this.appServiceDeferral.Complete();
this.appServiceDeferral = null;
}
if (this.desktopBridgeAppServiceDeferral != null)
{
this.desktopBridgeAppServiceDeferral.Complete();
this.desktopBridgeAppServiceDeferral = null;
}
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached)
{
this.DebugSettings.EnableFrameRateCounter = true;
}
#endif
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (e.PrelaunchActivated == false)
{
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
// Ensure the current window is active
Window.Current.Activate();
}
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 7.5 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.4 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.3 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.4 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.1 KiB

Просмотреть файл

@ -1,13 +0,0 @@
<Page
x:Class="NativeMessagingHostInProcess.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:NativeMessagingHostInProcess"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
</Grid>
</Page>

Просмотреть файл

@ -1,30 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
namespace NativeMessagingHostInProcess
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
}
}

Просмотреть файл

@ -1,183 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{9893CDCE-EA37-4716-A893-95B336312681}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NativeMessagingHostInProcess</RootNamespace>
<AssemblyName>NativeMessagingHostInProcess</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.14393.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.10586.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PackageCertificateKeyFile>NativeMessagingHostInProcess_TemporaryKey.pfx</PackageCertificateKeyFile>
<PackageCertificateThumbprint>2C8EDD1942D38E9D00ECC0038FD09A7B9D3A520E</PackageCertificateThumbprint>
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
<AppxBundle>Always</AppxBundle>
<AppxBundlePlatforms>x86|x64</AppxBundlePlatforms>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
<Content Include="..\Extension\manifest.json">
<Link>Extension\manifest.json</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Win32\PasswordInputProtection.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Include="NativeMessagingHostInProcess_TemporaryKey.pfx" />
<None Include="project.json" />
</ItemGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<ItemGroup>
<Content Include="..\Extension\background.js">
<Link>Extension\background.js</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\Extension\content.js">
<Link>Extension\content.js</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\Extension\icon_128.png">
<Link>Extension\icon_128.png</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\Extension\icon_16.png">
<Link>Extension\icon_16.png</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\Extension\icon_48.png">
<Link>Extension\icon_48.png</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Properties\Default.rd.xml" />
<Content Include="Assets\LockScreenLogo.scale-200.png" />
<Content Include="Assets\SplashScreen.scale-200.png" />
<Content Include="Assets\Square150x150Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Assets\StoreLogo.png" />
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
</ItemGroup>
<ItemGroup>
<SDKReference Include="WindowsDesktop, Version=10.0.14393.0">
<Name>Windows Desktop Extensions for the UWP</Name>
</SDKReference>
</ItemGroup>
<ItemGroup>
<Page Include="MainPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<Target Name="AfterBuild">
<Copy SourceFiles="..\PasswordInputProtection\bin\$(Configuration)\PasswordInputProtection.exe" DestinationFolder="win32" />
<Copy SourceFiles="..\PasswordInputProtection\bin\$(Configuration)\PasswordInputProtection.exe.config" DestinationFolder="win32" />
<Copy SourceFiles="..\PasswordInputProtection\bin\$(Configuration)\PasswordInputProtection.pdb" DestinationFolder="win32" />
</Target>
</Project>

Двоичный файл не отображается.

Просмотреть файл

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" IgnorableNamespaces="uap uap3 mp rescap">
<Identity Name="ae24a957-5239-43b2-a36c-b96805a58ade" Publisher="CN=msft" Version="1.0.4.0" />
<mp:PhoneIdentity PhoneProductId="ae24a957-5239-43b2-a36c-b96805a58ade" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>SecureInput</DisplayName>
<PublisherDisplayName>cct23</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.15063.0" MaxVersionTested="10.0.15063.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="NativeMessagingHostInProcess.App">
<uap:VisualElements DisplayName="SecureInput" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="NativeMessagingHostInProcess" BackgroundColor="transparent">
</uap:VisualElements>
<Extensions>
<uap:Extension Category="windows.protocol">
<uap:Protocol Name="msghost1" />
</uap:Extension>
<uap:Extension Category="windows.appService">
<uap:AppService Name="NativeMessagingHostInProcessService" />
</uap:Extension>
<uap3:Extension Category="windows.appExtension">
<uap3:AppExtension Name="com.microsoft.edge.extension" Id="EdgeExtension" PublicFolder="Extension" DisplayName="ms-resource:DisplayName">
<uap3:Properties>
<Capabilities>
<Capability Name="websiteContent" />
<Capability Name="websiteInfo" />
<Capability Name="browserStorage" />
</Capabilities>
</uap3:Properties>
</uap3:AppExtension>
</uap3:Extension>
<desktop:Extension Category="windows.fullTrustProcess" Executable="Win32\PasswordInputProtection.exe" xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10" />
</Extensions>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<rescap:Capability Name="runFullTrust" />
</Capabilities>
</Package>

Просмотреть файл

@ -1,29 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NativeMessagingHostInProcess")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NativeMessagingHostInProcess")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]

Просмотреть файл

@ -1,31 +0,0 @@
<!--
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most
developers. However, you can modify these parameters to modify the behavior of the .NET Native
optimizer.
Runtime Directives are documented at http://go.microsoft.com/fwlink/?LinkID=391919
To fully enable reflection for App1.MyClass and all of its public/private members
<Type Name="App1.MyClass" Dynamic="Required All"/>
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32
<TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" />
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
<Namespace Name="DataClasses.ViewModels" Seralize="All" />
-->
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Application>
<!--
An Assembly element with Name="*Application*" applies to all assemblies in
the application package. The asterisks are not wildcards.
-->
<Assembly Name="*Application*" Dynamic="Required All" />
<!-- Add your application specific runtime directives here. -->
</Application>
</Directives>

Просмотреть файл

@ -1,33 +0,0 @@
{
"name" : "SecureInput",
"version" : "1.0.0.0",
"description" : "China online banking secure input reference implementation",
"author": "msft",
"background": {
"scripts": [ "background.js" ],
"persistent": true
},
"default_locale": "en_US",
"content_scripts": [
{
"matches": ["*://*/secureinput*"],
"js": ["content.js"],
"run_at": "document_end"
}
],
"permissions": [
"*://*/secureinput*",
"nativeMessaging",
"activeTab"
],
"icons": {
"16": "icon_16.png",
"48": "icon_48.png",
"128": "icon_128.png"
}
}

Просмотреть файл

@ -1,16 +0,0 @@
{
"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0"
},
"frameworks": {
"uap10.0": {}
},
"runtimes": {
"win10-arm": {},
"win10-arm-aot": {},
"win10-x86": {},
"win10-x86-aot": {},
"win10-x64": {},
"win10-x64-aot": {}
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,8 +0,0 @@
<Application
x:Class="NativeMessagingHostOutOfProcess.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:NativeMessagingHostOutOfProcess"
RequestedTheme="Light">
</Application>

Просмотреть файл

@ -1,106 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace NativeMessagingHostOutOfProcess
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached)
{
this.DebugSettings.EnableFrameRateCounter = true;
}
#endif
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (e.PrelaunchActivated == false)
{
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
// Ensure the current window is active
Window.Current.Activate();
}
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 7.5 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.4 KiB

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше