Setup/UpgradeData.php
private function encryptAndSavePassword($path, $scope, $id)
    {
        $configCollection = $this->configCollectionFactory->create()
            ->addFieldToFilter('scope', $scope)
            ->addFieldToFilter('scope_id', $id)
            ->addFieldToFilter('path', $path)
            ->setPageSize(1);

        if ($configCollection->getSize()) {
            $value = $configCollection->getFirstItem()->getValue();
            if ($value) {
                $this->helper->saveConfigData(
                    $path,
                    $this->helper->encryptor->encrypt($value),
                    $scope,
                    $id
                );
            }
        }
    }
private function encryptAndSavePassword($path, $scope, $id)
    {
        $configCollection = $this->configCollectionFactory->create()
            ->addFieldToFilter('scope', $scope)
            ->addFieldToFilter('scope_id', $id)
            ->addFieldToFilter('path', $path)
            ->setPageSize(1);

        if ($configCollection->getSize()) {
            $value = $configCollection->getFirstItem()->getValue();
            if ($value) {
                $this->helper->saveConfigData(
                    $path,
                    $this->helper->encryptor->encrypt($value),
                    $scope,
                    $id
                );
            }
        }
    }
private function encryptAndSavePassword ( $ path , $ scope , $ id ) { $ configCollection = $ this -> configCollectionFactory -> create ( ) -> addFieldToFilter ( 'scope' , $ scope ) -> addFieldToFilter ( 'scope_id' , $ id ) -> addFieldToFilter ( 'path' , $ path ) -> setPageSize ( 1 ) ; if ( $ configCollection -> getSize ( ) ) { $ value = $ configCollection -> getFirstItem ( ) -> getValue ( ) ; if ( $ value ) { $ this -> helper -> saveConfigData ( $ path , $ this -> helper -> encryptor -> encrypt ( $ value ) , $ scope , $ id ) ; } } }
Encrypt already saved passwords

@param string $path
@param string $scope
@param int $id
Encrypt already saved passwords