몇 가지 간단한 암호화/암호 해독 기능을 웹 페이지에 포함시키는 C# .Net 코드를 포함하고 싶습니다. 내부 웹 페이지이므로 사용자는 암묵적으로 신뢰할 수 있습니다. 이 일을 할 수있는 방법이 있습니까? 암호화를 위해 공개 키를 얻기 위해 사용자의 Windows-MY 키 저장소 (CAPI를 통해)를 해독해야하며 LDAP 서버를 누르십시오.Embeded .Net C# 웹 페이지에서?
답변
C#을 사용하여 COM 개체를 가짜로 만든 다음 JavaScript를 사용하여 해당 COM 개체를 호출하고 브라우저를 통해 CAPI와 상호 작용할 수있었습니다.
자바 스크립트 :
<html>
<head>
<script language="javascript">
var keystore = new ActiveXObject("RBCrypto.KeyStore");
function getCertList()
{
try {
keystore.openKeyStore("MY", true, false);
var size = keystore.getStoreSize();
var list = document.getElementById('list');
list.size = size;
for(var i = 0; i < size; i++)
{
var fname = keystore.getFriendlyName(i, true);
var opt = new Option(fname, fname);
list.options.add(opt);
}
}
catch(err)
{
alert(err.description);
}
}
</script>
</head>
<body onload="getCertList()">
<center>
<h2>KeyStore Test</h2>
<hr />
<br />
<select id="list"></select>
</center>
</body>
</html>
C 번호 :
using System;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
namespace RBCrypto
{
public interface AXInterface
{
void openKeyStore(string storeName, bool currentUser, bool readOnly);
int getStoreSize();
string getFriendlyName(int index, bool subjectNameIfEmpty);
}
[ClassInterface(ClassInterfaceType.AutoDual)]
public class KeyStore :AXInterface
{
public void openKeyStore(string storeName, bool currentUser, bool readOnly)
{
if (keystoreInitialized)
throw new Exception("Key Store must be closed before re-initialization");
try
{
if (currentUser) //user wants to open store used by the current user
certificateStore = new X509Store(storeName, StoreLocation.CurrentUser);
else //user wants to open store used by local machine
certificateStore = new X509Store(storeName, StoreLocation.LocalMachine);
if (readOnly)
certificateStore.Open(OpenFlags.ReadOnly);
else
certificateStore.Open(OpenFlags.ReadWrite);
allCertificates = certificateStore.Certificates;
if (allCertificates == null)
{
certificateStore.Close();
throw new NullReferenceException("Certificates could not be gathered");
}
keystoreInitialized = true;
}
catch (ArgumentException ae)
{
throw ae;
}
catch (SecurityException se)
{
throw se;
}
catch (CryptographicException ce)
{
throw ce;
}
catch (NullReferenceException ne)
{
throw ne;
}
}
....
}
}
C# 어셈블리 정보 :
이 자신의 컴퓨터에 당신의 .DLL을 isntall하는 사용자를했다 작동하기 위해서는// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(true)]
(.dll을 설치 프로그램에 vsdraCOM으로 등록하도록 지정했는지 확인하십시오.) 사이트를 truste에 추가해야합니다. d 사이트.
Silverlight를 사용할 수 있습니다. 당신은뿐만 아니라 자바 스크립트에서 암호화를 할 수 있지만
참고 : Script# 같은 자바 스크립트 컴파일러
Silverlight 아니면 C#을,.
"웹 페이지에 넣기"란 의미를 정의 하시겠습니까? 웹 페이지는 일반적으로 Javascript (및 Java) 만 알고있는 브라우저에서 실행됩니다.
당신은 Silverlight 응용 프로그램으로 할 수 있습니다.
Silverlight에는 필요한 암호화 기능이 없습니다.내가 찾은 Windows-MY 키 저장소에 접근 할 방법이 없다면? –
암호화/암호 해독 논리가 응용 프로그램 내에있는 새 ASP.NET 응용 프로그램을 작성하는 것이 좋습니다. 아마도 이러한 요청을 처리하기위한 전용 페이지가있는 새로운 webforms 응용 프로그램을 만들 수 있습니다.
암호화 논리를 별도의 .NET 어셈블리에 작성한 다음 ASP.NET 응용 프로그램에서이 어셈블리를 참조하는 것이 좋습니다.
서비스로 사용하려는 것인지 또는 사용자가 텍스트 상자에 텍스트를 입력하고 방문시 암호화를 수행하는지 여부는 명확하지 않습니다.
이 작업을 수행 할 수 있지만 Windows-MY 키 저장소에서 암호 해독을 위해 사용자의 개인 키를 가져 오는 방법이 필요합니다. 다른 모든 것은 서버 측에서 할 수 있습니다. –
AJAX를 사용하여 네트워크에서 사용한 암호화 기능을 호출 할 수 있습니다.
- 1. Firebird Embeded & .NET : 다른 폴더에있는 fbembed.dll
- 2. youtube embeded objects ie9
- 3. 직렬 포트 통신 .net 4.0 웹 페이지에서
- 4. C# 웹 페이지에서 양식을 찾는 방법 C#?
- 5. Excel Embeded If Statements
- 6. Youtube embeded code
- 7. mongodb에 embeded 덧글 페이징
- 8. ASP.Net 웹 페이지에서 판매 강제 인증 C#
- 9. 웹 페이지에서 테이블을 읽는 C++ 프로그램
- 10. 웹 페이지에서 서버 C 프로그램으로 데이터 전송
- 11. 웹 페이지에서 메서드 호출
- 12. 공개 웹 페이지에서
- 13. ASP.NET 페이지에서 .NET DLL 시작
- 14. 웹 페이지에서 양식 표시
- 15. 웹 페이지에서 정보 얻기
- 16. C#의 웹 클라이언트 실행은 다음과 같이, 내가 웹 페이지에서 텍스트를 다운로드하는 웹 클라이언트를 사용하고 처음
- 17. 자체 웹 페이지에서 웹 사이트 다시 시작
- 18. asp.net에 embeded 플래시 accordian가 제대로 수행되지 않습니다.
- 19. .net 페이지에서 PHP 스크립트 실행
- 20. 웹 페이지에서 광고 검색
- 21. 웹 페이지에서 피드 추출
- 22. 웹 페이지에서 값 추출
- 23. 웹 페이지에서 헤더 추출하기
- 24. 웹 페이지에서 데이터 추출
- 25. 웹 페이지에서 비디오 식별하기
- 26. 웹 페이지에서 데이터 읽기
- 27. 웹 페이지에서 루아 실행하기
- 28. 웹 페이지에서 exe 실행
- 29. 웹 페이지에서 이미지 업로드
- 30. 내 웹 페이지에서 페이징
이미 사용자의 Windows-MY 키 저장소에있는 키와 Sivelight 또는 Javascript에서 읽을 수없는 키를 사용하고 싶습니다. –
@Petey : 그러면 브라우저 플러그인을 작성해야합니다. – SLaks
SLaks에 감사드립니다 (Ex Lax에서 플레이해야할까요?), 브라우저 플러그인에 대한 정보를 어디에서 찾아야합니까? –