Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Security / March 2008

Tip: Looking for answers? Try searching our database.

How to insert token PIN programmatically?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
raymond_b_jimenez@yahoo.com - 18 Feb 2008 21:42 GMT
I'm trying to build a program (trying with C#) that signs a document
using a certificate inside a token. Have managed to build code that
does it, but still I'm asked for the PIN. Sample of code follows
below. Can anyone point out how to programmatically insert the code?

rj
-----------------------------------------------
public byte[] SignMsg(Byte[] msg, X509Certificate2 signerCert, bool
detached)
       {
           ContentInfo contentInfo = new ContentInfo(msg);
           SignedCms signedCms = new SignedCms(contentInfo,
detached);
           CmsSigner cmsSigner = new CmsSigner(signerCert);
           cmsSigner.IncludeOption = X509IncludeOption.EndCertOnly;
           signedCms.ComputeSignature(cmsSigner, false);
           return signedCms.Encode();
       }
Dominick Baier - 19 Feb 2008 20:00 GMT
Is this cert coming from a Smart Card or is it a soft cert?

-----
Dominick Baier (http://www.leastprivilege.com)

Developing More Secure Microsoft ASP.NET 2.0 Applications (http://www.microsoft.com/mspress/books/9989.asp)

> I'm trying to build a program (trying with C#) that signs a document
> using a certificate inside a token. Have managed to build code that
[quoted text clipped - 13 lines]
> signedCms.ComputeSignature(cmsSigner, false);
> return signedCms.Encode();
raymond_b_jimenez@yahoo.com - 04 Mar 2008 09:45 GMT
It's from a SafeNet iKey 2032
I've been able to use it from Java with no problems, but have had no
success with .Net
rj

> Is this cert coming from a Smart Card or is it a soft cert?
>
> -----
> Dominick Baier (http://www.leastprivilege.com)
>
> Developing More Secure Microsoft ASP.NET 2.0 Applications (http://www.microsoft.com/mspress/books/9989.asp)
Dominick Baier - 17 Mar 2008 20:15 GMT
This is not possible. And thats by design.

If you need to use the cert without the PIN - configure the token accordingly
(if possible).

-----
Dominick Baier (http://www.leastprivilege.com)

Developing More Secure Microsoft ASP.NET 2.0 Applications (http://www.microsoft.com/mspress/books/9989.asp)

> It's from a SafeNet iKey 2032
> I've been able to use it from Java with no problems, but have had no
[quoted text clipped - 6 lines]
>> Developing More Secure Microsoft ASP.NET 2.0 Applications
>> (http://www.microsoft.com/mspress/books/9989.asp)

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.