RT 5.0.5 Documentation

RT::Crypt::Role

Go to latest version →

NAME

RT::Crypt::Role - Common requirements for encryption implementations

METHODS

Probe

This routine is called only if the protocol is enabled, and should return true if all binaries required by the protocol are installed. It should produce any warnings necessary to describe any issues it encounters.

GetPassphrase Address => ADDRESS, For => Encryption|Signing

Returns the passphrase for the given address. It looks at the relevant configuration option for the encryption protocol (e.g. "GnuPG" in RT_Config for GnuPG), and examines the Passphrase key. It it does not exist, returns the empty string. If it is a scalar, it returns that value. If it is an anonymous subroutine, it calls it. If it is a hash, it looks up the address (using '' as a fallback key).

SignEncrypt Entity => MIME::Entity, [ Encrypt => 1, Sign => 1, ... ]

Signs and/or encrypts a MIME entity. All arguments and return values are identical to "SignEncrypt" in RT::Crypt, with the omission of Protocol.

SignEncryptContent Content => STRINGREF, [ Encrypt => 1, Sign => 1, ... ]

Signs and/or encrypts a string, which is passed by reference. All arguments and return values are identical to "SignEncryptContent" in RT::Crypt, with the omission of Protocol.

VerifyDecrypt Info => HASHREF, [ Passphrase => undef ]

The Info key is a hashref as returned from "FindScatteredParts" or "CheckIfProtected". This method should alter the mime objects in-place as necessary during signing and decryption.

Returns a hash with at least the following keys:

exit_code

True if there was an error encrypting or signing.

message

An un-localized error message desribing the problem.

DecryptContent Content => STRINGREF, [ Passphrase => undef ]

Decrypts the content in the string reference in-place. All arguments and return values are identical to "DecryptContent" in RT::Crypt, with the omission of Protocol.

ParseStatus STRING

Takes a string describing the status of verification/decryption, usually as stored in a MIME header. Parses and returns it as described in "ParseStatus" in RT::Crypt.

FindScatteredParts Parts => ARRAYREF, Parents => HASHREF, Skip => HASHREF

Passed the list of unclaimed MIME::Entity objects in Parts, this method should examine them as a whole to determine if there are any that could not be claimed by the single-entity-at-a-time "CheckIfProtected" method. This is generally only necessary in the case of signatures manually attached in parallel, and the like.

If found, the relevant entities should be inserted into Skip with a true value, to signify to other encryption protols that they have been claimed. The method should return a list of hash references, each containing a Type key which is either signed or encrypted. The remaining keys are protocol-dependent; the hashref will be provided to "VerifyDecrypt".

CheckIfProtected Entity => MIME::Entity

Examines the provided MIME::Entity, and returns an empty list if it is not signed or encrypted using the protocol. If it is, returns a hash reference containing a Type which is either encrypted or signed. The remaining keys are protocol-dependent; the hashref will be provided to "VerifyDecrypt".

GetKeysInfo Type => ('public'|'private'), Key => EMAIL

Returns a list of keys matching the email Key, as described in "GetKeysInfo" in RT::Crypt.

GetKeysForEncryption Recipient => EMAIL

Returns a list of keys suitable for encryption, as described in "GetKeysForEncryption" in RT::Crypt.

GetKeysForSigning Signer => EMAIL

Returns a list of keys suitable for encryption, as described in "GetKeysForSigning" in RT::Crypt.

ParseDate STRING

Takes a string, and parses and returns a RT::Date; if the string is purely numeric, assumes is a epoch timestamp.

← Back to index