Kernel::System::Crypt::PGP - pgp crypt backend lib
This is a sub module of Kernel::System::Crypt and contains all pgp functions.
check if environment is working
my $Message = $CryptObject->Check();
crypt a message
my $Message = $CryptObject->Crypt( Message => $Message, Key => [ $PGPPublicKeyID, $PGPPublicKeyID2, # ... ], ); my $Message = $CryptObject->Crypt( Message => $Message, Key => $PGPPublicKeyID, );
Decrypt a message and returns a hash (Successful, Message, Data)
my %Result = $CryptObject->Decrypt( Message => $CryptedMessage, );
The returned hash %Result has the following keys:
Successful => '1', # could the given data be decrypted at all (0 or 1) Data => '...', # the decrypted data KeyID => 'FA23FB24' # hex ID of PGP-(secret-)key that was used for decryption Message => '...' # descriptive text containing the result status
sign a message
my $Sign = $CryptObject->Sign( Message => $Message, Key => $PGPPrivateKeyID, Type => 'Detached' # Detached|Inline );
verify a message signature and returns a hash (Successful, Message, Data)
Inline sign:
my %Result = $CryptObject->Verify( Message => $Message, Charset => 'utf-8', # optional, 'ISO-8859-1', 'UTF-8', etc. );
Attached sign:
my %Result = $CryptObject->Verify( Message => $Message, Sign => $Sign, );
The returned hash %Result has the following keys:
SignatureFound => 1, # was a signature found at all (0 or 1) Successful => 1, # could the signature be verified (0 or 1) KeyID => 'FA23FB24' # hex ID of PGP-key that was used for signing KeyUserID => 'username <user@test.org>' # PGP-User-ID (e-mail address) used for signing Message => '...' # descriptive text containing the result status MessageLong => '...' # full output of GPG binary
returns a array with search result (private and public keys)
my @Keys = $CryptObject->KeySearch( Search => 'something to search' );
returns an array with search result (private keys)
my @Keys = $CryptObject->PrivateKeySearch( Search => 'something to search' );
returns an array with search result (public keys)
my @Keys = $CryptObject->PublicKeySearch( Search => 'something to search' );
returns public key in ascii
my $Key = $CryptObject->PublicKeyGet( Key => $KeyID, );
returns secret key in ascii
my $Key = $CryptObject->SecretKeyGet( Key => $KeyID, );
remove public key from key ring
$CryptObject->PublicKeyDelete( Key => $KeyID, );
remove secret key from key ring
$CryptObject->SecretKeyDelete( Key => $KeyID, );
add key to key ring
my $Message = $CryptObject->KeyAdd( Key => $KeyString, );
This software is part of the OTRS project (https://otrs.org/).
This software comes with ABSOLUTELY NO WARRANTY. For details, see the enclosed file COPYING for license information (GPL). If you did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.