PHP Class ParagonIE\GPGMailer\GPGMailer

Show file Open project: paragonie/gpg-mailer Class Usage Examples

Protected Properties

Property Type Description
$mailer TransportInterface
$options array
$serverKeyFingerprint string

Public Methods

Method Description
__construct ( TransportInterface $transport, array $options = [], string $serverKey = '' ) GPGMailer constructor.
decrypt ( Message $message ) : Message Encrypt the body of an email.
encrypt ( Message $message, string $fingerprint ) : Message Encrypt the body of an email.
encryptAndSign ( Message $message, string $fingerprint ) : Message Encrypt and sign the body of an email.
export ( string $fingerprint ) : string Get the public key corresponding to a fingerprint.
getTransport ( ) : TransportInterface Return the stored Transport.
import ( string $gpgKey ) : string Import a public key, return the fingerprint
send ( Message $message, string $fingerprint ) Encrypt then email a message
sendUnencrypted ( Message $message, boolean $force = false ) Email a message without encrypting it.
setPrivateKey ( string $serverKey ) : self Sets the private key for signing.
sign ( Message $message ) : Message Sign a message (but don't encrypt)
verify ( Message $message, string $fingerprint ) : boolean Verify a message

Method Details

__construct() public method

GPGMailer constructor.
public __construct ( TransportInterface $transport, array $options = [], string $serverKey = '' )
$transport TransportInterface
$options array For Crypt_GPG
$serverKey string

decrypt() public method

Encrypt the body of an email.
public decrypt ( Message $message ) : Message
$message Message
return Message

encrypt() public method

Encrypt the body of an email.
public encrypt ( Message $message, string $fingerprint ) : Message
$message Message
$fingerprint string
return Message

encryptAndSign() public method

Encrypt and sign the body of an email.
public encryptAndSign ( Message $message, string $fingerprint ) : Message
$message Message
$fingerprint string
return Message

export() public method

Get the public key corresponding to a fingerprint.
public export ( string $fingerprint ) : string
$fingerprint string
return string

getTransport() public method

Return the stored Transport.
public getTransport ( ) : TransportInterface
return TransportInterface

import() public method

Import a public key, return the fingerprint
public import ( string $gpgKey ) : string
$gpgKey string An ASCII armored public key
return string The GPG fingerprint for this key

send() public method

Encrypt then email a message
public send ( Message $message, string $fingerprint )
$message Message The message data
$fingerprint string Which public key fingerprint to use

sendUnencrypted() public method

Email a message without encrypting it.
public sendUnencrypted ( Message $message, boolean $force = false )
$message Message The message data
$force boolean Send even if we don't have a private key?

setPrivateKey() public method

Sets the private key for signing.
public setPrivateKey ( string $serverKey ) : self
$serverKey string
return self

sign() public method

Sign a message (but don't encrypt)
public sign ( Message $message ) : Message
$message Message
return Message

verify() public method

Verify a message
public verify ( Message $message, string $fingerprint ) : boolean
$message Message
$fingerprint string
return boolean

Property Details

$mailer protected property

protected TransportInterface $mailer
return TransportInterface

$options protected property

protected array $options
return array

$serverKeyFingerprint protected property

protected string $serverKeyFingerprint
return string