Skip to content

kjdev/php-ext-tink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tink for PHP

It's still experimental.

This extension allows Tink.

Documentation for Tink can be found at https://github.com/google/tink.

Build from sources

$ git clone --depth=1 https://github.com/kjdev/php-ext-tink.git
$ phpize
$ ./configure --with-tink=[Tink C++ include/lib path]
$ make
$ make install

Will need Tink's C ++ header files and libraries

Configration

php.ini:

extension=tink.so

Function

  • tink_encrypt — Tink encryption
  • tink_decrypt — Tink decryption

implementation of https://github.com/google/tink/tree/master/examples/cc/helloworld command-line utility.

tink_encrypt — Tink encryption

Description

string tink_encrypt ( string $keyset_filename, string $data, string $associated_data )

Tink encryption.

Pameters

  • keyset_filename

    name of the file with the keyset to be used for encryption.

  • data

    a string to encryption.

  • associated_data

    a string to be used as assciated data.

Return Values

Returns the encryption data or FALSE if an error occurred.

tink_decrypt — Tink decryption

Description

string tink_decrypt ( string $keyset_filename, string $data, string $associated_data )

Tink decryption.

Pameters

  • keyset_filename

    name of the file with the keyset to be used for encryption.

  • data

    a string to decryption.

  • associated_data

    a string to be used as assciated data.

Return Values

Returns the decryption data or FALSE if an error occurred.

Examples

$keyset_file = 'keyset.json'; // See: tests/keyset.json
$data = 'message';
$associated_data = 'associated-data';

// encryption
$encrypt = tink_encrypt($keyset_file, $data, $associated_data);

// decryption
$var = tink_decrypt($keyset_file, $encrypt, $associated_data);
var_dump($var);

About

Tink for PHP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published