Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicPythonRubySQL ServerSwiftTclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcel

Ruby Examples

ASN.1
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Bounced Email
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
ECC
Email Object
Encryption
FTP
Facebook
Firebase
GeoOp
Google APIs
Google Cloud Storage
Google Drive
Gzip
HTML-to-XML/Text
HTTP
HTTP Misc

IMAP
JSON
Java KeyStore (JKS)
Jwt
MHT / HTML Email
MIME
NTLM
OAuth1
OAuth2
OpenSSL
PEM
PFX/P12
POP3
PRNG
PayPal
Peoplevox
QuickBooks
REST
RSA Encryption
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
Socket/SSL/TLS
Spider
Stream
Tar Archive
Twitter
XML
XMP
Xero
Zip
curl

 

 

 

(Ruby) PKCS7 Decrypt MIME

Loads a PKCS7 encrypted MIME file and decrypts. The cert and private key used for decryption is loaded from a PFX file.

Chilkat Ruby Downloads

Ruby Library for Linux and MAC OS X

require 'chilkat'

mime = Chilkat::CkMime.new()

success = mime.UnlockComponent("Anything for 30-day trial.")
if (success == false)
    print mime.lastErrorText() + "\n";
    exit
end

#  Load the MIME
success = mime.LoadMimeFile("encryptedMime.txt")
if (success == false)
    print mime.lastErrorText() + "\n";
    exit
end

#  The AddPfxSourceFile and/or AddPfxSourceData
#  methods may be called one or more times (one per PFX)
#  to add sources from which the MIME component will
# search for certificates and private keys when decrypting.
pfxPassword = "myPassword"
success = mime.AddPfxSourceFile("myCertAndPrivateKey.pfx",pfxPassword)
if (success == false)
    print mime.lastErrorText() + "\n";
    exit
end

#  Decrypt...
success = mime.Decrypt()
if (success == false)
    print mime.lastErrorText() + "\n";
    exit
end

#  Display the decrypted MIME:
print mime.getMime() + "\n";

 

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