src/RNCryptor/Decryptor.php
public function decrypt($encryptedBase64Data, $password)
    {
        $components = $this->unpackEncryptedBase64Data($encryptedBase64Data);

        if (!$this->hmacIsValid($components, $password)) {
            return false;
        }

        $key = $this->makeKey($components->headers->encSalt, $password);
        if ($this->config->mode == 'ctr') {
            return $this->aesCtrLittleEndianCrypt($components->ciphertext, $key, $components->headers->iv);
        }

        $iv = (string)$components->headers->iv;
        $method = $this->config->algorithm . 'cbc';

        return openssl_decrypt($components->ciphertext, $method, $key, OPENSSL_RAW_DATA, (string)$iv);
    }
public function decrypt($encryptedBase64Data, $password)
    {
        $components = $this->unpackEncryptedBase64Data($encryptedBase64Data);

        if (!$this->hmacIsValid($components, $password)) {
            return false;
        }

        $key = $this->makeKey($components->headers->encSalt, $password);
        if ($this->config->mode == 'ctr') {
            return $this->aesCtrLittleEndianCrypt($components->ciphertext, $key, $components->headers->iv);
        }

        $iv = (string)$components->headers->iv;
        $method = $this->config->algorithm . 'cbc';

        return openssl_decrypt($components->ciphertext, $method, $key, OPENSSL_RAW_DATA, (string)$iv);
    }
public function decrypt ( $ encryptedBase64Data , $ password ) { $ components = $ this -> unpackEncryptedBase64Data ( $ encryptedBase64Data ) ; if ( ! $ this -> hmacIsValid ( $ components , $ password ) ) { return false ; } $ key = $ this -> makeKey ( $ components -> headers -> encSalt , $ password ) ; if ( $ this -> config -> mode == 'ctr' ) { return $ this -> aesCtrLittleEndianCrypt ( $ components -> ciphertext , $ key , $ components -> headers -> iv ) ; } $ iv = ( string ) $ components -> headers -> iv ; $ method = $ this -> config -> algorithm . 'cbc' ; return openssl_decrypt ( $ components -> ciphertext , $ method , $ key , OPENSSL_RAW_DATA , ( string ) $ iv ) ; }
Decrypt RNCryptor-encrypted data

@param string $base64EncryptedData Encrypted, Base64-encoded text
@param string $password Password the text was encoded with
@throws Exception If the detected version is unsupported
@return string|false Decrypted string, or false if decryption failed
Decrypt RNCryptor - encrypted data