TYPE_SODIUM
TYPE_SODIUM
Contains static methods to do various Threema cryptography related tasks.
Support libsoidum >= 0.2.0 (Namespaces)
$instance : \Threema\MsgApi\Tools\CryptTool
getInstance() : \Threema\MsgApi\Tools\CryptTool
Prior libsodium
createInstance(string $type) : null|\Threema\MsgApi\Tools\CryptTool
string | $type |
null on unknown type
encryptMessageText(string $text, string $senderPrivateKey, string $recipientPublicKey, string $nonce) : string
Encrypt a text message.
string | $text | the text to be encrypted (max. 3500 bytes) |
string | $senderPrivateKey | the private key of the sending ID |
string | $recipientPublicKey | the public key of the receiving ID |
string | $nonce | the nonce to be used for the encryption (usually 24 random bytes) |
encrypted box
encryptImageMessage(\Threema\MsgApi\Commands\Results\UploadFileResult $uploadFileResult, \Threema\MsgApi\Tools\EncryptResult $encryptResult, string $senderPrivateKey, string $recipientPublicKey, string $nonce) : string
\Threema\MsgApi\Commands\Results\UploadFileResult | $uploadFileResult | the result of the upload |
\Threema\MsgApi\Tools\EncryptResult | $encryptResult | the result of the image encryption |
string | $senderPrivateKey | the private key of the sending ID (as binary) |
string | $recipientPublicKey | the public key of the receiving ID (as binary) |
string | $nonce | the nonce to be used for the encryption (usually 24 random bytes) |
encryptFileMessage(\Threema\MsgApi\Commands\Results\UploadFileResult $uploadFileResult, \Threema\MsgApi\Tools\EncryptResult $encryptResult, \Threema\MsgApi\Commands\Results\UploadFileResult $thumbnailUploadFileResult = null, \Threema\MsgApi\Tools\FileAnalysisResult $fileAnalysisResult, $senderPrivateKey, $recipientPublicKey, $nonce)
\Threema\MsgApi\Commands\Results\UploadFileResult | $uploadFileResult | |
\Threema\MsgApi\Tools\EncryptResult | $encryptResult | |
\Threema\MsgApi\Commands\Results\UploadFileResult | $thumbnailUploadFileResult | |
\Threema\MsgApi\Tools\FileAnalysisResult | $fileAnalysisResult | |
$senderPrivateKey | ||
$recipientPublicKey | ||
$nonce |
decryptMessage(string $box, string $recipientPrivateKey, string $senderPublicKey, string $nonce) : \Threema\MsgApi\Messages\ThreemaMessage
string | $box | |
string | $recipientPrivateKey | |
string | $senderPublicKey | |
string | $nonce |
the decrypted message
generateKeyPair() : \Threema\Core\KeyPair
Generate a new key pair.
the new key pair
encryptFile( $data) : \Threema\MsgApi\Tools\EncryptResult
$data |
encryptFileThumbnail(string $data, string $key) : \Threema\MsgApi\Tools\EncryptResult
string | $data | |
string | $key |
encryptImage(string $imageData, string $privateKey, string $publicKey) : \Threema\MsgApi\Tools\EncryptResult
string | $imageData | |
string | $privateKey | as binary |
string | $publicKey | as binary |