Encryption

Name -- Syntax / Description
bf_decrypt
bf_decrypt( key, encrypted, plaintext var )
Blowfish decryption
Returns 1 on success, 0 on error
  • key = the encryption key in ECB mode. the key must be 16 characters.
  • plaintext = the text thats encrypted
  • encrypted = if sucessful it will contain the results
bf_encrypt
bf_encrypt( key, plaintext, encrypted var )
Blowfish encryption
Returns 1 on success, 0 on error
  • key = the encryption key in ECB mode. The key must be 16 characters.
  • plaintext = the text thats encrypted
  • encrypted = if sucessful it will contain the results
crypto_base64_decode
crypto_base64_decode( data )
Decodes and returns Base-64 decodes data.
Returns the decrypted data
  • data = the information to decode
crypto_base64_encode
crypto_base64_encode( data )
Encodes and returns Base-64 encoded data.
Returns the encrypted data
  • data = the information to encode
crypto_hmac_sha1
crypto_hmac_sha1( value, key, output_format, output)
Calculates an HMAC SHA-1 (Hash-based Message Authentication Code) of value
returns: 1 on success, 0 on failure (including OpenSSL not being available)
  • value = value to hash by reference
  • key = key to use to calculate the hmac
  • output_format = 'hex' or 'binary'
  • output = hmac_sha1 hash value.
crypto_hmac_sha256
crypto_hmac_sha256( buffer var, key, format, result var )
Calculates an HMAC SHA-256 (Hash-based Message Authentication Code) of buffer
Returns 1 on success, 0 on error or if on an unsuported platform.
  • buffer = value to hash
  • key = binary key to use to calculate the hmac
  • format = "binary" or "hex"
  • result = a variable used to store the results.
crypto_last_error
crypto_last_error()
Returns the error text from the last SSL error, or other internal errors in the crypto suite of functions. Use crypto_last_ssl_error() instead to get the code of the last SSL error.
Returns error text.
crypto_last_ssl_error
crypto_last_ssl_error()
Returns the Integer value of the last SSL error code. Use crypto_last_error() instead to get the text of the last SSL error.
Returns error code.
crypto_library_version
crypto_library_version( info )
crypto_md5
crypto_md5( buffer )
Calculates the MD5 hash of a string.
Returns the MD5 hash value.
  • buffer = the data to be hashed.
crypto_md5_file
crypto_md5_file( file, location, hash var )
Calculates the md5 hash of a file
Returns 1 on success, 0 on failure.
  • file = Name of file to calculate the hash of
  • location = Location either "script" or "data"
  • hash = MD5 hash value
crypto_rand_bytes
crypto_rand_bytes( n )
Generates n random bytes.
Returns a string of bytes
  • n = the number of bytes
crypto_sha1
crypto_sha1( buffer var, format, result var )
Returns an SHA1 hash of buffer. Secure Hash Algorithm
Returns 1 on success, 0 on failure. (including OpenSSL not being available)
  • buffer = value to hash by reference
  • output_format = 'hex' or 'binary'. Anything else will result in binary output.
  • output = returned sha1 hash value.
crypto_sha256
crypto_sha256( buffer var, format, result var )
Returns an SHA256 hash of buffer. Secure Hash Algorithm. May not be available on platforms running versions of OpenSSL Older than v0.9.8.
Returns 1 on success, 0 on failure. (including OpenSSL not being available)
  • buffer = value to hash by reference
  • output_format = 'hex' or 'binary'. Anything else will result in binary output.
  • output = returned sha1 hash value.
rsa_free
rsa_free( rsa var )
Frees the RSA indicated by rsa.
Returns 1 on success, 0 on error.
rsa_generate_keypair
rsa_generate_keypair( pubkey_file, privkey_file, bits, e, passphrase )
Generates an RSA keypair, saving the public key in pubkey_file, the private key in privkey_file, and encrypting the private key with passphrase.
Returns 1 on success, 0 on error.
rsa_generate_keypair_mem
rsa_generate_keypair_mem( pubkey var, privkey var, bits, e, passphrase )
rsa_load_privatekey
rsa_load_privatekey( privkey_file, rsa var, passphrase )
Load an encrypted RSA private key from a PKCS#8 file specified by privkey_file, and decrypt it using passphrase.
Returns 1 on success, 0 on error.
rsa_load_privatekey_mem
rsa_load_privatekey_mem( privkey, rsa var, passphrase )
rsa_load_publickey
rsa_load_publickey( pubkey_file, rsa var )
Load an RSA public key from a PKCS#1 file specified by "pubkey_file".
rsa_load_publickey_mem
rsa_load_publickey_mem( pubkey, rsa var )
rsa_private_decrypt
rsa_private_decrypt( rsa, encrypted, plaintext var )
Decrypts the data in encrypted, storing the result in plaintext, using the private key portion of the RSA structure specified by rsa.
Returns 1 on success, 0 on error.
rsa_private_encrypt
rsa_private_encrypt( rsa, plaintext, encrypted var )
Encrypts the data in plaintext, storing the result in encrypted, using the private key portion of the RSA structure specified by rsa.
Returns 1 on success, 0 on error.
rsa_public_decrypt
rsa_public_decrypt( rsa, encrypted, plaintext var )
Decrypt the data in encrypted, storing the result in plaintext, using the public key portion of the RSA structure specified by rsa.
Returns 1 on success, 0 on error.
rsa_public_encrypt
rsa_public_encrypt( rsa, plaintext, encrypted var )
Encrypt the data in plaintext, storing the result in encrypted, using the public key portion of the RSA structure specified by rsa.
Returns 1 on success, 0 on error.
rsa_save_privatekey
rsa_save_privatekey( privkey_file, rsa var, passphrase )
rsa_save_privatekey_mem
rsa_save_privatekey_mem( privkey var, rsa var, passphrase )
rsa_sign
rsa_sign( rsa, buffer, signature var )
Sign the data in "buffer" with the RSA private key specified by "rsa", returning the result in "signature" where rsa = Value returned from one of the rsa_load_key routines, buffer = Buffer to sign, signature = Resulting signature.
Returns 1 on success, 0 on failure. Requires OpenSSL 0.9.7 or greater.
rsa_verify
rsa_verify( rsa, buffer, signature )
Verify the data in "buffer" with the RSA public key specified by "rsa" and the signature in "signature" where rsa = Value returned from one of the rsa_load_key routines, buffer = Buffer to sign, signature = Signature.
Returns 1 on success, 0 on verification failure or error. Requires OpenSSL 0.9.7 or greater.
x509_create
x509_create( cert, x509 var )
Create an X509 Certificate from the PEM format data in "cert" where cert = PEM format certificate, x509 =Index into an internal array of certificates.
Returns 1 on sucess, 0 on error.
x509_free
x509_free( rsa var )
Deletes an x509 from the internal array of x509 certificates where x509 = Index into internal array of x509 certificates.
Returns 1 on success, 0 on error.
x509_load
x509_load( cert, x509 var )
Load an X509 Certificate from the file specified by "cert" where cert = File containing an x509 certificate, x509 = Index into an internal array of certificates.
Returns 1 on sucess, 0 on error.
x509_rsa_publickey
x509_rsa_publickey( x509 var, rsa var )
Extracts the RSA public key from the X509 specified by "x509" and stores it in "rsa" where x509 = Index into internal array of x509 certificates, rsa =Index into internal array of RSA public keys.
Returns 1 on success, 0 on error.
x509_verify
x509_verify( x509 var, trusted_certs )
Verifies that the X509 certificate specified by "x509" was issued by one of the X509 certificates (in PEM format) in "trusted_certs", where x509 = Index into internal array of certificates, trusted_certs = Certificates (in PEM text format) to find the x50
Returns 1 on successful find, 0 if certificate isn't in trusted_certs, or other error.
User Annotations: encryption