Chilkat HOME Android™ Classic ASP C C++ C# Mono C# .NET Core C# C# UWP/WinRT DataFlex Delphi ActiveX Delphi DLL Visual FoxPro Java Lianja MFC Objective-C Perl PHP ActiveX PHP Extension PowerBuilder PowerShell PureBasic CkPython Chilkat2-Python Ruby SQL Server Swift 2 Swift 3/4 Tcl Unicode C Unicode C++ Visual Basic 6.0 VB.NET VB.NET UWP/WinRT VBScript Xojo Plugin Node.js Excel Go
(PHP ActiveX) Add S/MIME Signature using PFXAdd a digital signature to a MIME message using the certificate + private key from a PFX file.
<?php $mime = new COM("Chilkat_9_5_0.Mime"); $success = $mime->UnlockComponent('Anything for 30-day trial'); if ($success == 0) { print $mime->LastErrorText . "\n"; exit; } // Load a PFX file into a certificate object. $cert = new COM("Chilkat_9_5_0.Cert"); $pfxFilepath = 'pfxFiles/something.pfx'; $pfxPassword = 'secret'; $success = $cert->LoadPfxFile($pfxFilepath,$pfxPassword); if ($success == 0) { print $cert->LastErrorText . "\n"; exit; } $success = $mime->SetBodyFromPlainText('This is the plain-text MIME body.'); $mime->Charset = 'utf-8'; $mime->Encoding = 'quoted-printable'; // Sign the MIME (adds a PKCS7 detached signature) $success = $mime->AddDetachedSignature($cert); if ($success == 0) { print $mime->LastErrorText . "\n"; exit; } // Save the S/MIME to a file. $success = $mime->SaveMime('/temp/signedMime.txt'); if ($success == 0) { print $mime->LastErrorText . "\n"; exit; } print 'success!' . "\n"; ?> |
© 2000-2016 Chilkat Software, Inc. All Rights Reserved.