Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Powershell + certificate = encrypted/signed email?

Reply
 
Old 06-07-2008   #1 (permalink)
Blake


 
 

Powershell + certificate = encrypted/signed email?

I have certs to sign and/or encrypt email via outlook. Using openssl, I can
create a command line to sign/encrypt an email using said cert and send it.

Can I do the same with PowerShell? It seems there is reference to certs
here:



PS C:\Documents and Settings\Blake\Desktop\PowerShell\scripts> $SmtpClient =
new-object system.net.mail.smtpClient
PS C:\Documents and Settings\Blake\Desktop\PowerShell\scripts> $SmtpClient


Host :
Port : 25
UseDefaultCredentials : False
Credentials :
Timeout : 100000
ServicePoint :
DeliveryMethod : Network
PickupDirectoryLocation :
EnableSsl : False
ClientCertificates : {}





My System SpecsSystem Spec
Old 06-08-2008   #2 (permalink)
Marco Shaw [MVP]


 
 

Re: Powershell + certificate = encrypted/signed email?

Blake wrote:
Quote:

> I have certs to sign and/or encrypt email via outlook. Using openssl, I can
> create a command line to sign/encrypt an email using said cert and send it.
>
> Can I do the same with PowerShell? It seems there is reference to certs
> here:
Quote:

> PS C:\Documents and Settings\Blake\Desktop\PowerShell\scripts> $SmtpClient =
> new-object system.net.mail.smtpClient
> PS C:\Documents and Settings\Blake\Desktop\PowerShell\scripts> $SmtpClient
>
>
> Host :
> Port : 25
> UseDefaultCredentials : False
> Credentials :
> Timeout : 100000
> ServicePoint :
> DeliveryMethod : Network
> PickupDirectoryLocation :
> EnableSsl : False
> ClientCertificates : {}
That property is read-only:
http://msdn.microsoft.com/en-us/libr...tificates.aspx

Looks like you have to tell the .NET Framework some other way what
cert(s) are available.

Not a fix, but it might help you to start looking in the right direction...

I'll try and look at it again also, time permitting...

Marco

--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 06-10-2008   #3 (permalink)
Blake


 
 

Re: Powershell + certificate = encrypted/signed email?

I appreciate the response

I could use PS in conjunction with OpenSSL, but was hoping to avoid multiple
steps.

If you come up with anything feel free to reply.

Thanks
Blake

"Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote in message
news:OVukl3cyIHA.5716@xxxxxx
Quote:

> Blake wrote:
Quote:

>> I have certs to sign and/or encrypt email via outlook. Using openssl, I
>> can create a command line to sign/encrypt an email using said cert and
>> send it.
>>
>> Can I do the same with PowerShell? It seems there is reference to certs
>> here:
>
Quote:

>> PS C:\Documents and Settings\Blake\Desktop\PowerShell\scripts>
>> $SmtpClient = new-object system.net.mail.smtpClient
>> PS C:\Documents and Settings\Blake\Desktop\PowerShell\scripts>
>> $SmtpClient
>>
>>
>> Host :
>> Port : 25
>> UseDefaultCredentials : False
>> Credentials :
>> Timeout : 100000
>> ServicePoint :
>> DeliveryMethod : Network
>> PickupDirectoryLocation :
>> EnableSsl : False
>> ClientCertificates : {}
>
> That property is read-only:
> http://msdn.microsoft.com/en-us/libr...tificates.aspx
>
> Looks like you have to tell the .NET Framework some other way what cert(s)
> are available.
>
> Not a fix, but it might help you to start looking in the right
> direction...
>
> I'll try and look at it again also, time permitting...
>
> Marco
>
> --
> Microsoft MVP - Windows PowerShell
> http://www.microsoft.com/mvp
>
> PowerGadgets MVP
> http://www.powergadgets.com/mvp
>
> Blog:
> http://marcoshaw.blogspot.com

My System SpecsSystem Spec
Old 06-11-2008   #4 (permalink)
Marco Shaw [MVP]


 
 

Re: Powershell + certificate = encrypted/signed email?

Blake wrote:
Quote:

> I appreciate the response
>
> I could use PS in conjunction with OpenSSL, but was hoping to avoid multiple
> steps.
I've gone and asked this in a general .NET newsgroup. I couldn't find
anyone indicating how this could be done in C# either.

Marco
My System SpecsSystem Spec
Old 06-12-2008   #5 (permalink)
Marco Shaw [MVP]


 
 

Re: Powershell + certificate = encrypted/signed email?

Blake wrote:
Quote:

> I appreciate the response
>
> I could use PS in conjunction with OpenSSL, but was hoping to avoid multiple
> steps.
>
> If you come up with anything feel free to reply.
Thanks to Oisin (www.nivot.org). Try something like this:

PS > cd cert:\currentuser\my
PS > gci .
PS > $cert=gci .| where{$_.subject -like
"match_something_for_the_cert_you_want_if_you_have_several*"} <--Get a
cert object
PS > $smtpclient.clientcertificates.Add($cert) <--Should return a "0".

If you check $smtpclient after, you should have soemthing show up.

Marco
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
self-signed certificate issue PowerShell
certificate expiring (self signed) .NET General
Encrypted File System (EFS) Certificate Backup Tutorials
Encrypted File System (EFS) Certificate Restore Tutorials
can not send signed/encrypted emails Vista mail


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46