1
자체 키 BLOB 형식 등으로 CNG에 사용자 지정 키 저장소 공급자를 등록하는 방법은 무엇입니까? 정말하고 싶은 일은 .NET에서 사용자 지정 CNG 키 BLOB 형식을 처리하는 기능을 제공하는 것입니다. 타사 KSP를 추가 할 수있는 방법을 제공하지만 어떤 샘플이나 자습서도 찾을 수 없다는 CNG 문서를 읽었습니다.Windows CNG 사용자 지정 키 저장소 공급자
자체 키 BLOB 형식 등으로 CNG에 사용자 지정 키 저장소 공급자를 등록하는 방법은 무엇입니까? 정말하고 싶은 일은 .NET에서 사용자 지정 CNG 키 BLOB 형식을 처리하는 기능을 제공하는 것입니다. 타사 KSP를 추가 할 수있는 방법을 제공하지만 어떤 샘플이나 자습서도 찾을 수 없다는 CNG 문서를 읽었습니다.Windows CNG 사용자 지정 키 저장소 공급자
BLOB 형식 등으로 CNG에 사용자 지정 키 저장소 공급자를 등록하는 방법은 무엇입니까?
등록 만하고 싶으므로 이미 맞춤 KSP를 준비했다고 가정하고 등록하면됩니다. 어쨌든, 당신은 programatically 할 수 있습니다.
다음 코드는 암호화 공급자 개발 키트 (http://www.microsoft.com/en-us/download/details.aspx?id=30688)
void
RegisterProvider(
void
)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
//
// Make CNG aware that our provider
// exists...
//
ntStatus = BCryptRegisterProvider(
SAMPLEKSP_PROVIDER_NAME,
0, // Flags: fail if provider is already registered
&SampleKSPProvider
);
if (!NT_SUCCESS(ntStatus))
{
wprintf(L"BCryptRegisterProvider failed with error code 0x%08x\n", ntStatus);
}
//
// Add the algorithm name to the priority list of the
// symmetric cipher algorithm class. (This makes it
// visible to BCryptResolveProviders.)
//
ntStatus = BCryptAddContextFunction(
CRYPT_LOCAL, // Scope: local machine only
NULL, // Application context: default
NCRYPT_KEY_STORAGE_INTERFACE, // Algorithm class
NCRYPT_KEY_STORAGE_ALGORITHM, // Algorithm name
CRYPT_PRIORITY_BOTTOM // Lowest priority
);
if (!NT_SUCCESS(ntStatus))
{
wprintf(L"BCryptAddContextFunction failed with error code 0x%08x\n", ntStatus);
}
//
// Identify our new provider as someone who exposes
// an implementation of the new algorithm.
//
ntStatus = BCryptAddContextFunctionProvider(
CRYPT_LOCAL, // Scope: local machine only
NULL, // Application context: default
NCRYPT_KEY_STORAGE_INTERFACE, // Algorithm class
NCRYPT_KEY_STORAGE_ALGORITHM, // Algorithm name
SAMPLEKSP_PROVIDER_NAME, // Provider name
CRYPT_PRIORITY_BOTTOM // Lowest priority
);
if (!NT_SUCCESS(ntStatus))
{
wprintf(L"BCryptAddContextFunctionProvider failed with error code 0x%08x\n", ntStatus);
}
}
wilkexx 이봐, 당신이 할 수있는 방법을 찾았어요와 함께 제공되는 샘플 KSP에서입니까? – schmudu