# How to send a secure email (maybe PGP)?

**URL:** <https://www.ruby-forum.com/t/how-to-send-a-secure-email-maybe-pgp/103578>\
**Category:** Ruby\
**Created:** [May 8, 2007, 2:54am UTC](https://www.ruby-forum.com/t/how-to-send-a-secure-email-maybe-pgp/103578 "2007-05-08T02:54:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Human\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/edb3f5/32.png) [@Human\_D](https://www.ruby-forum.com/u/Human_D)\
**Post date:** [May 8, 2007, 2:54am UTC](https://www.ruby-forum.com/t/how-to-send-a-secure-email-maybe-pgp/103578/1 "2007-05-08T02:54:31Z")

</div>

Hello,

In an application I have to send an email containing a Credit Card  
number, but I don’t know how to secure it!!!

Is there a ruby library or best practice for securing an email  
content, I googled for it with no success.

Thanks in advance,

- Dunnil

---

<div class="post-metadata">

**Author:** ![Human\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/edb3f5/32.png) [@Human\_D](https://www.ruby-forum.com/u/Human_D)\
**Post date:** [May 8, 2007, 11:52am UTC](https://www.ruby-forum.com/t/how-to-send-a-secure-email-maybe-pgp/103578/2 "2007-05-08T11:52:55Z")

</div>

On 08/05/07, Human D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hello,
> 
> In an application I have to send an email containing a Credit Card  
> number, but I don’t know how to secure it!!!
> 
> Is there a ruby library or best practice for securing an email  
> content, I googled for it with no success.

There are some encryption functions in openssl. Hopefully the ruby  
bindings and mime libraries could be used to compose an encrypted  
message.

However, the critical part is that you have to get the key of the  
receiver somehow and their mail client has to support the kind of  
encryption you use.

You could probably guess the kind of encryption by looking at the key  
(PGP vs the openssl certificates, I am not sure if there is any  
other). However, you still need to collect the (public) keys.

Thanks

Michal

---

<div class="post-metadata">

**Author:** ![Human\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/edb3f5/32.png) [@Human\_D](https://www.ruby-forum.com/u/Human_D)\
**Post date:** [May 9, 2007, 12:36am UTC](https://www.ruby-forum.com/t/how-to-send-a-secure-email-maybe-pgp/103578/3 "2007-05-09T00:36:12Z")

</div>

> -----Original Message-----  
> In an application I have to send an email containing a Credit  
> Card number, but I don’t know how to secure it!!!
> 
> Is there a ruby library or best practice for securing an  
> email content, I googled for it with no success.

There’s a perl CGI called Soupermail that does this. It uses a shell  
exec call to PGP to encode a temporary file that contains the  
information, then attaches that file to the email, or something like  
that.

If you’re looking for something, you could either use that, or use it as  
an example. I’ve used it several times on a number of consulting  
projects, and it works great, so… Hope this helps 🙂

-Doug
