ASP Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

ASP Examples

ASP String
ASP Byte Array
Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
RSA
S/MIME
SMTP
Socket
Spider
SSH
SSH Tunnel
SSH Key
SFTP
Tar
ASP Upload
XML
XMP
Zip Compression

More Examples...
Email Object
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA

Unreleased...
Bzip2
LZW
Icon

 

 

 

 

 

 

Find Certificates that can be used for Signing

Download Chilkat Crypt ActiveX

This ASP script shows how to iterate over the certificates on a computer to find those that can be used for signing.

<html><body>
<%

    ' What certificates exist on my computer, and which
    ' ones can I use for creating digital signatures?
    set ccs = Server.CreateObject("Chilkat.CreateCS")
    
    set crypt = Server.CreateObject("Chilkat.Crypt2")
    
    unlocked = crypt.UnlockComponent("anything begins 30-day trial")
    If unlocked = 0 Then
        ' Failed to unlock...
    End If
    
    ' Use the Microsoft Enhanced Cryptographic Service Provider
    ' Add a reference to ChilkatUtil for the ChilkatCSP object
    set csp = Server.CreateObject("ChilkatUtil.ChilkatCSP")
    csp.SetProviderMicrosoftEnhanced
    crypt.SetCSP csp
    
    ' -------------------------------------------------------
    ' Check the local machine certificate store.
    ' -------------------------------------------------------
    Set certStore = ccs.OpenLocalSystemStore()
    
    Response.write "<b>Local Machine Certificate Store</b>"
    Response.write "<table border=1>"
    
    For i = 0 To certStore.NumCertificates - 1
        Set cert = certStore.GetCertificate(i)
        
        Response.write "<tr><td>"
        
        ' Display the certificate we are testing..
        Response.write "<font size='+1'><b>" & cert.SubjectDN & "</b></font><br>"
        
        ' Set the certificate to be used for signing, and our output string encoding.
        crypt.SetSigningCert cert
        crypt.EncodingMode = "base64"
        
        ' Try signing....
        signature = crypt.SignStringENC("This is a test")
        If Len(signature) = 0 Then
            ' Failed to create signature
            Response.write "FAILED<br>"
            If cert.HasPrivateKey() = 0 Then
                Response.write "NO PRIVATE KEY<br>"
            End If
            Response.write "<p>" & crypt.LastErrorHtml
        Else
            Response.write "SUCCESS!<br>"
            Response.write "<p>" & crypt.LastErrorHtml
        End If
        
        Response.write "</td></tr>"
    Next
    
    Response.write "</table>"
    


%>

</body></html>
 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2008 Chilkat Software, Inc. All Rights Reserved.