Results 1 to 4 of 4

Thread: Native Email Encryption

  1. #1
    Join Date
    Oct 2006
    Posts
    38
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Native Email Encryption

    I want to send email using a personal email certificate. I'm currently using the Persits CryptoManager and MailSender via classic ASP but it is not an idea situation and i'd much rather package it all up with the rest of my site in .Net.

    Has anyone else done this or got any ideas.

    Thanks,

    Josh

  2. #2
    Join Date
    Oct 2006
    Posts
    38
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    I've tried the code below.

    Code:
       Dim CM As ASPENCRYPTLib.ICryptoManager
       CM = New ASPENCRYPTLib.CryptoManager()
       Dim Mail As ASPEMAILLib.IMailSender
       Mail = New ASPEMAILLib.MailSender()
       Dim strSubject As String
       Dim strFrom As String
       Dim strTo As String
       Dim strBody As String
       Dim cert As String
       strSubject = "Test"
       strFrom = "josh@test.com"
       strTo = "josh@test.com"
       strBody = "test123"
       cert = "secureemail.cer"
       Dim Context As ASPENCRYPTLib.ICryptoContext = CM.OpenContext("SecureMail", True)
       Dim RecipientCert As ASPENCRYPTLib.ICryptoCert = CM.ImportCertFromFile(Server.MapPath(cert))
       Dim Msg As ASPENCRYPTLib.ICryptoMessage = Context.CreateMessage
       Msg.AddRecipientCert(RecipientCert) ' repeat if necessary
       '' Send Encrypted Message
       Mail.Host = "mail.test.com"
       Mail.Username = "josh@test.com"
       Mail.Password = "test"
       Mail.Subject = strSubject
       Mail.From = strFrom
       Mail.FromName = strFrom
       Mail.AddAddress(strTo)
       Mail.Body = strBody
       Mail.IsHTML = True
       Mail.SendEncrypted(Msg) ' Use CryptoMessage object
    But I get "System.Security.SecurityException: System.Security.Permissions.SecurityPermission" when defining CM = New ASPENCRYPTLib.CryptoManager()

    Any ideas?

    Josh

  3. #3
    Join Date
    Feb 2004
    Posts
    4,877
    Thanks
    2
    Thanked 134 Times in 113 Posts

    Default

    You will not be able to call ActiveX/Com controls from .NET code running under Medium Trust.
    Warren Ashcroft
    Red Fox UK Limited - Pioneers in Internet Technology
    http://www.redfoxuk.com
    w.ashcroft [at] redfoxuk.com

    NOTE: Forum Private Messaging should not be used to contact staff with support queries.

  4. #4
    Join Date
    Oct 2006
    Posts
    38
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Any .Net alternatives?

    Josh

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. .htpasswd password encryption script
    By Mark Voss in forum Development Support
    Replies: 6
    Last Post: 21st June 2005, 08:22 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •