• We take control of cryptography in the MEGA cloud storage. Cloud file hosting MEGA

    Let me start by saying that my Internet is not particularly fast. Since I currently live in a village, I have to use a Megafon Modem. 3G network. My usual Internet speed is 100-200 Kilobytes per second, and the fastest is 500-600 Kilobytes per second. And it constantly changes depending on the time of day and weather conditions. But still, even under such circumstances, I successfully managed to download a massive 12 GB file from the Mega file hosting service. I’ll tell you about this further, and you will learn useful information for yourself on how to download huge files from mega.nz.

    I didn't originally download it from Mega. large files, using just a regular browser. By the way, due to the fact that access to this file hosting service is closed through some networks, especially through some networks, you need to look for additional ways to access it. Typically, file addresses begin with the line https://mega.co.nz. And if you can’t log in through them, then you just need to change the symbols “mega.co.nz” to “eu.static.mega.co.nz”.

    First way downloading a file from Mega.nz means using a regular browser. It is recommended to use Google Chrome for a more successful download. If the file is huge in size, then it is advisable to initially clean the browser itself of any rubbish that accumulates in it and interferes with further work– this is a download history, cookies, a log of visited sites. For these purposes I use free utility called CCleaner.

    How is the download process on Mega via a browser? First, it is saved in the browser, and then when it is completely downloaded, it is automatically transferred to the computer. Most often in the "Downloads" folder. Well, or to another folder in which you installed.

    Select the file you want to download and click “Download in zip”. Or you can right-click on the file. A window will appear in which you click on “Download”, and then select either a regular download or a zip download. I prefer to download files in archives like zip and others.

    Initially, I downloaded one object - an 8 GB archive. Everything went well. The next day I started downloading a 12 GB file. I had it swinging for about 22 hours. I'm tired of it. The speed was, for some unknown reason, very low. Then, when the file was already 90% downloaded, the download process was constantly interrupted, and it was necessary to constantly start it. It was written in English something like that the download will continue after you free up space on the browser. It is possible that 12 GB was too much for the browser. Plus, it was also influenced by the fact that I didn’t clear the browser before downloading. And as a result, 99% of the download to Mega was interrupted. I was disappointed because I couldn't do anything about it. Yes, and I spent a lot of time and traffic. Therefore, I had to look for another, more successful method of downloading from Mega.

    Second way How to download from the Mega.nz file hosting service is to use the Mipony program. She has many advantages. It is capable of downloading and does not create temporary files. I installed it from mipony.net. My antivirus program did not detect any signs of an “evil” virus in this file. And the site mipony.net seems to be official, at least it looks like it. True, along with this utility, a bunch of programs that were unnecessary for me were installed. I will get rid of them, since I don’t need them, even though they look harmless. And among them there is the Amigo browser. I'm so tired of him already. I constantly install it along with some programs. Apparently, software developers have such a promotion scheme - to pay the owners of other programs so that along with the installation of their file, their application is also installed.

    Then you choose necessary files or everything. To start the download, click on “Select download” below. All files after these steps begin to download.

    The entire download process takes place in the “Download” section.

    Don't forget to set the speed to "Unlimited" in the lower right corner. I initially had 10 KB/s. This is very little and you will be downloading large files at this speed not just for weeks, but for months, if not years.

    As a result of using Mipony, I was able to download a 12 GB file in about 8 hours. For you, this process may take much less time. It all depends on the speed of the Internet you use.

    Good luck! I hope that the article about how to download from the Mega file hosting service was useful for you.

    In this article I will continue to talk about working with various online storage facilities and we will look at 3 more good service: Cloud Mail, Mega and Microsoft OneDrive.

    From this guide you will learn how to register in each of the above services, as well as how to work with them through the Web interface and special application for operating systems (I will show using Windows as an example).

    About working with Yandex services and Google drives I talked about it in a separate previous article - because they are the most popular and popular.

    Each of the above 3 services provides its own specific volume for storing your data for free, and also has its own rules for expanding the volume using both paid and free means.

    You can read such general information and a comparison of all the most popular online drives in a separate article:

    Let's start with the Cloud@Mail service.

    Registration in the Cloud@Mail service

    The Mail service provides remote data storage with a free capacity of 100 GB.

    Let's take a step-by-step look at how to register and connect your account and get 100 GB at once.

      Go to the Cloud@Mail service page using the link:

      mail

      At the very bottom of the page that opens there will be big button"Try the cloud." Click it:

      A login form will appear. If you already have an account on Mail.ru (for example, email), then simply enter your login, password and click the “Login” button, after which you will immediately find yourself in your remote storage account from Mail.

      If you don’t have an account on Mail.ru, then click on the “Registration” link:

      A window with a registration form will open. Fill in all fields with your data: First Name, Last Name, Date of Birth, City, Gender.

      In the field " Mailbox» indicate the desired login, which you will use in the future to access all Mail services. An email in the following format will also be automatically registered for you: “Your [email protected]”.

      Below we indicate the password and repeat it in the next line. Try to specify a more complex password for your own security. In this case, Mail should inform you that the password is strong.

      Next, you can enter your existing phone number and complete registration, or you can not enter the number (this can be done at any time) and enter it instead Security Question. To do this, click the link “I don’t have a mobile phone”:

      After clicking on this link, 3 more points will appear below. You need to fill out the top 2: “ Security question" and "Answer". In the first, you, accordingly, select a security question and indicate the answer to it below. This answer will come in handy if you forget your account login information:

      Click the “Register” button.

      A window for entering captcha will appear. Simply indicate the symbols exactly the same as in the picture on the right and click “Finish”:

      At this point, registration has already been completed, but windows with settings will still appear. For example, in the next window you are asked to collect all your mail from other mailboxes into one mailbox just created in Mail. Of course, if you will constantly use the created mail from Mail, it makes sense to do this, but we are not talking about working with mail now and therefore click the “Skip” button:

      In any case, you can set up mail collection at any time through your account settings.

      Next, a settings window will appear where you will be asked to put a signature that will be attached to each letter you send from Mail and upload an avatar for your account. This does not affect the Cloud service, which we are considering, in any way, and therefore you can do it now, or you can do it later. Click the “Save” button:

      This was the last settings window, after which you will go to your Mail account and mail will initially be opened. Let's move on to consider the main functions when working with the Cloud@Mail service through the Web interface.

    Working with the Cloud@Mail service via the Web interface

    Once you register an account with Mail, you will be immediately logged into your newly created account. From there, you can go to the online storage service by clicking on the button with the image of a cloud at the top of the window:

    A window will open with a greeting from the service, where we simply click “Next”:

    And in the last window, we accept the terms of the license agreement by checking the appropriate box and clicking “Get Started”:

    Let's move on to the possibilities of working with an online disk from Mail via the Web interface

    After switching to the online storage service from Mail, we will see this interface:

    Let's start looking at the useful features step by step:


    This concludes all the most important functions for working with the Cloud@Mail service. Let's move on to consider how to work with the Cloud through a very convenient application for the Windows operating system.

    Working with the Cloud@Mail online disk through the Windows application

    Working with any online drive through an application for your system is much more convenient and allows you to use more features, such as the ability to upload folders, not just files.

    Let's look at everything step by step.

    Installing the Cloud@Mail application on your computer:

      First you need to download the application. You can do this directly from the main account window by clicking on the “Download application for computer” button:

      If there are any requests, I can also talk separately about working with any similar online storage via Smartphones/Tablets, which is also very convenient!

      In a new window we are asked to select the operating system for which the application will be downloaded. In our examples, we are considering only Windows systems for now. But the principle of working with the application on other systems is completely similar. So, click on the button with the image of Windows:

      The installation file will download to your computer. Find it and run it:

      In the first installation window, select the language and click “OK”:

      In the next step, you can change the installation path by clicking the Browse button if necessary. But I recommend leaving the default path.

      You will now be prompted to change the folder in the Start menu. There is no point in this, but if you want to change it, click “Browse” and select another folder.

      In the penultimate installation window we can disable automatic start applications when booting Windows and disable desktop icon creation. It’s up to you to create a shortcut on your desktop or not, and you can create it in the future at any time. But I recommend never disabling the launch feature with Windows so that your files are always synchronized with your account, and you always have access to the latest versions of your files from any of your devices. Otherwise, you might forget to run the application manually, and in this case, changes in your previously downloaded files will no longer be saved to the server.

      After you have selected what you need, click “Next”:

      Well, in the last window, click the “Install” button:

      Installation usually takes place within a few seconds.

      At the last final stage, click “Finish”, leaving the “Launch Cloud Mail.ru” checkbox so that the application starts immediately:

    All! The application is now installed on your computer. Let's start working with it.

    Working with Cloud Mail through an application installed on your computer:

      The first thing you need to do is log into your account. The authorization window will be displayed immediately after you install the application.

      Enter your username and password for your account in Mail (it must be specified in the format of your email on Mail), leave the “I agree to the terms of the license agreement” checkbox and click “Login”:

      After this, the application will be launched. It will appear in the Windows tray and you will receive a notification:

      Access to your account folder [email protected].

      So the application is working. In order to see files that have already been uploaded to the Cloud, open the specially created “Cloud Mail.ru” folder. This can be done from a shortcut on the desktop:

      You can also always open the disk folder by double-clicking on the Cloud Mail icon in the tray.

      In the folder you will already see all your files previously downloaded via the Web interface, for example:

      Uploading files to the Cloud via the app couldn't be easier. Just copy into the Cloud Mail.ru folder all the files and folders that you would like to upload to your Mail online drive:

      Please note that now, using the computer application, you can download entire folders in addition to files!

      To check whether the files have downloaded to your disk completely, right-click on the application tray icon:

      If all files are downloaded, at the top there will be an inscription: “Synchronized,” but if downloading is still in progress, then it will be written “Synchronization in progress.”

      Deleting files from your storage is also easy. To do this, you just need to delete them from the Cloud Mail.Ru folder located on your computer.

      Let's consider the last important function through the application - access to download the selected file to other users.

      In order to get a link to download any file located on your disk through the application, open the Cloud Mail.ru folder, where all your files are located, right-click on the desired one and select “[email protected]: Copy public link":

    With this, we have covered all the main functions for working with the [email protected] service, and it’s time to move on to the next service – Mega.

    Registration in the Mega service

    Let's look at the process of creating an account in the Mega file storage, which provides 50 GB of free space disk space. As you can see, by default the service is in English, but you can change the language to Russian immediately after creating an account.

    So, let's start registration:

    This completes the creation of your account! Now let's move on to considering the functionality through the standard Web interface (i.e. through a browser).

    Working with Mega online storage via the Web interface

    After you register an account, the service interface will look like this:

    Let’s begin to look at all the main functions of the service step by step:

    Now let's look at interacting with Mega online storage through a special application for Windows.

    Mega online storage management via Windows application

    Let's start by installing the application:

      First, you need to download the application as usual. You can do this from your account.
      Go to the “Menu” section, select the “Applications” submenu and then the “Synchronization Application” item:

      On the new page, go down a little and click the “Download for free for Windows” button:

      The file will begin automatically downloading. Sometimes you need to specify the download folder manually. It depends on the browser.

      After the file is downloaded, find it on your computer and run:

      The installation process will begin. Similar programs, as a rule, have almost the same installation process. In the first window, select the language and click “OK”:

      We accept the license agreement with the “Accept” button:

      At the next stage, I recommend switching the button to the “Install for anyone using this computer” item, which means install for all users of this computer so that there are no problems accessing the program in the future:

      In the next window, you can specify a different name for the folder in the Start menu where program shortcuts will be placed. It is most convenient to leave the default name. Click the “Install” button:

      The download process will begin additional files to install, which will take about a minute:

      In the last window, click the “Finish” button, leaving the “Run MEGAsync 1.0.36” checkbox:

      The program has been installed at this point and now some setup steps will begin. In the next window, check the box “I have a MEGA account” if you have already registered, for example, according to the instructions from this article:

      If you have not registered yet, then select the second option and register. Accordingly, I will not consider this process again.

      In the new window, enter the login (E-Mail) and password that you specified during registration and click “Forward”:

      Now, from the two synchronization options, select “ Full synchronization", so that all the files and folders that you have already uploaded to the Mega storage are synchronized with your computer (that is, you will be able to see the uploaded folders and files directly on your computer):

      Click the “Forward” button.

      Now we are given the option to change the Mega storage folder on your computer. This is where you will upload all the files you want to end up on your online drive. You can leave the default folder, or you can change it by clicking “Change”. As a rule, I leave the paths the same because it is more convenient and, in principle, changing the path does not make sense.

      After that, click “Forward”:

      In the last window, click the only button “Done”:

    This completes the installation of the application. Immediately after installation, you will receive a notification, and there will be an application icon in the Windows tray - Mega:

    Let's move on to the principle of working with the Mega service through installed application.

    Control online storage Mega via app

    The Mega computer application has no settings and is easy to manage. Absolutely any computer user can handle it :)

    Let's look at everything that is available to us through the application:

    The Mega storage has also been dealt with. And now let’s look at the last service that I promised to talk about in this article – Microsoft OneDrive.

    Registering with Microsoft OneDrive cloud storage

    Microsoft's OneDrive storage will give you 15GB of free storage, which is comparable to Google's free storage.

    Let's start the registration process:

    Immediately after completing the last step, a page with your online storage on OneDrive will open.

    Let's look at how to work with it through a browser.

    Working with OneDrive via the Web interface

    The OneDrive service interface looks like this:

    As you can see, it is, in principle, similar to all similar services that we reviewed earlier. The principle of interaction here is also exactly the same. Let's break it down:


    In general, nothing complicated this service no either :)

    And finally, I’ll show you how to work with OneDrive through the application, as I showed earlier for all similar services.

    Working with OneDrive through the Windows app

    The OneDrive online storage application is not supported operating system Windows XP!

    Installing the application on your computer:

    All! The OneDrive desktop app is fully installed and configured. It remains to consider how to work with it.

    Managing OneDrive online storage via the Windows application

    Well, in principle, managing your OneDrive storage through an installed application is nothing new. Everything is exactly the same as in the similar services discussed earlier. Read below and see for yourself :)

    Well, that's all. There are no other special functions in the OneDrive application. Everything is exactly the same as in the previously reviewed applications from other developers.

    Today I told you about working with 3 more services that provide normal free space for storing files, and I’ll probably stop there. Of course, there are a dozen more similar services that can be listed, but many do not provide free more than 5 GB of free space. For example, the well-known Dropbox provides only 2 GB of space for free, which is too little, and, accordingly, you need to pay money for expansion.

    Therefore, I think that the services that you have become acquainted with in my articles will be enough for you beyond the roof. comfortable work with your data :)

    Have a nice day! Bye;)

    Remember the times when 40 GB of storage space on your computer seemed like an unaffordable luxury? Now the count is hundreds of gigabytes, and often even terabytes, and we are so used to this that we take up space on PC disks indiscriminately - with everything.

    Meanwhile, savings and comfort have not yet been canceled, and the existence, prosperity and bright prospects of cloud storage prove their worth. Over the past few years, the services of such Internet services have been developing in giant strides, and several cloud data storages can be cited as an example:

    1. Yandex.Disk - offers beginners 5 GB of free space for storing files of various formats and extensions, plus various bonuses. For example, if you have been using Yandex mail for 5 years, you will be given another 2 GB of Disk space.
    2. Google Drive – free 15 GB of space.
    3. Microsoft SkyDrive - 7 GB free instead of 25 GB previously offered.
    4. – 2 GB plus expansion of disk space for attracting referrals.
    5. Apple iCloud– 5 free gigabytes of space.
    6. – here you can borrow no more than 40 MB for each note for free, and use the traffic volume for writing/editing notes up to 60 MB per month.
    7. Amazon Google Drive - 5 GB.
    8. Cloud service Box - 5 GB.
    9. SugarSync service - 5 GB.
    10. Cloud storage Mega.co.nz – 50 GB of free disk space.

    Cloud storage Mega.co.nz

    All of the above services can work not only on desktop PCs, but on all mobile applications, which undoubtedly expands the scope of their application and increases their popularity. But the leader in the free gigabytes offered is still Mega.сo.nz - 50 GB is no joke, you still need to manage to fill it with something, so I suggest we talk about it in more detail cloud service- Mega.co.nz. By the way, I actively use this service, since it is stable, anonymous, and its creators are well-known people.

    The head of the company that offers the services of this storage facility is Kim Dotcom, founder of the Megaupload service, which closed two years ago at the behest of the Department of Justice and FBI of America. Perhaps you remember that story. Actually, their old exchanger was quite a convenient thing. But now Kim's new creation has become even cooler. Let's talk about it in more detail.

    Now the Mega service provides not only the usual storage of data in the cloud using a PC, but, as previously promised by the developers, they have already included the ability to work from mobile devices - iPhone, iPad, devices on , Win 8, mounting the file system for Windows, and etc. That is, it will be possible to send files directly to the cloud. For example, your photos from your smartphone will be stored in the gadget, but at the same time they will be transferred to Mega.сo.nz, so the possibility of unexpected loss or damage to files will be completely eliminated. All your data is encrypted during transmission, and no one except you can unpack it for reading.

    Advantages and differences of Mega

    1. Main feature and the difference between the Mega.co.nz cloud service and similar resources is the initial free amount of disk space offered – 50 GB. At Mega.co.nz you can upload files of any size, with any extension, in any format - there are no restrictions in this regard.

    2. The abbreviation MEGA is the name of “MEGA Encrypted Global Access”.

    3. The main features of Mega are the same as other resources - downloading, storing files on a third-party drive, and the ability to share files with your friends and colleagues by transferring links or encrypted access. File encryption in the browser occurs using AES algorithm, that is, you are provided with protection from unauthorized access. File transfer links are also encrypted, and even service employees do not have access to your data. At least that's what they claim.

    4. The service for exchanging and storing Mega files is multilingual, so you will not have language difficulties when working with it - just select the desired language in the control panel.

    But to start using cloud storage, you need to go through a simple registration procedure.

    Registering and getting started with Mega.co.nz

    As can be seen from the registration link, logging into the site https://mega.co.nz/ occurs via a secure connection. Next on the main page you need to select the Russian language for convenient work - the menu is located at the top right. Now you can register:

    When registering, you need a real email address, the rest of the data can simply be taken from your head. After we fill out all the fields and click the “Create account” button, we will receive an email with a link confirming our registration:

    Click on this link in the letter and confirm your account on the service page - for this there is a form on the right top corner, that is, simply enter your email address and password. This is done once - then the service will use our browser cookies. When confirming registration, we will be asked to create our own individual key, which will determine our authentication. Creating a key is of a playful nature, and I even got carried away, missing the moment when the key had already been created.

    The game looks like knocking out bricks with a ball, which make up the MEGA inscription. Once you reach 100% on the scale at the top of the screen, a key will be created:

    And after clicking the “Finish” button, go to your page in the Mega.co.nz cloud service:

    How to use the Mega.co.nz service

    There is a very slight difference in using the service when working on Google Chrome, which I will discuss below. In the meantime, let’s talk about general control and use points. On the right side of your page you see a control column and a display of the storage structure. At the top there is a menu for downloading, viewing and managing files. That is, in the drop-down menu for already downloaded files, you will see the opportunity to get a link to the file, the ability to copy it, edit it, etc.

    Browser users Mozilla Firefox can install an add-on in their browser MEGA extension. The developers of this add-on promise that after installing it, you will notice a significant improvement in your file download speed. This result is ensured by batch uploading an unlimited number of files without limiting their size. Every link in the Mega.co.nz service is captured by your MEGA extension application and remains local (JavaScript scripts are not downloaded from servers). The service provides reliable automatic updates thanks to a cryptographic signature with an encrypted key.

    Without installing this add-on, to work more efficiently with the Mega service, developers suggest using the Google Chrome browser. Since I’ve been using several browsers all my computer life, I installed the recommended extension in Firefox, but, to be honest, I didn’t notice any difference in the operation of the cloud service. The application can be installed both from the “Add-ons” of the browser and from the MEGA service (“Menu” – “Applications” – “Firefox Application”)

    It is better to use the Google Chrome browser if you are going to upload entire folders of files to the cloud - Mozilla does not have this option, but Chrome can upload both files and folders:

    This is what the storage control panel looks like in Google browser Chrome, but in Mozilla Firefox there is simply no “Upload folder” button - there is only an “Upload file” button. Using the “Upload file” button, you can upload a file to the cloud from your personal computer. After you click on the “Upload folder” button in Google Chrome, an Explorer window will open, in it you select a folder to upload to the file storage, and that’s it – the download has begun.

    Now let's talk about how to get around this problem in Firefox. Let's say you want to download the entire folder - don't install a new browser for this! Then you just need to create a folder of the same name in Mega (the “New Folder” item in the menu), and upload all the files into it (press Ctrl + A to select all at once) that are located in the same folder on the computer.

    We continue to familiarize ourselves with the service. In the “My Account” item, you will see not only that you are using a free account, but you will also see your amount of cloud space used, and you can also change your profile settings or configure data transfer:

    In the settings (“Menu” - “My Account”) you can do a lot. For example, change the number of parallel connections for downloading files, as well as the number of parallel connections when downloading files. You can also impose a limit on the download speed.

    If you click on the menu button “Menu” - “My Account”, you can learn more about the rules for using the Mega.co.nz cloud service. I won’t tell you much about the Pro account, since I haven’t used it yet - the free 50 GB is enough. But after you click on the “Upgrade your status” button in your free account, you can choose any paid package of those offered to be able to store a larger volume of your data in the cloud - from 500 GB to 96 TB. Personally, I can’t imagine such a volume - 96 terabytes - but, nevertheless, if you think carefully, you can find a use. For example, for backup website databases, etc.

    Let's continue with working with files - you can simply create a new folder to upload some thematic files into it. To do this, click on the “New Folder” button and rename the folder as you need. In this new folder, you can also create other subfolders into which you can upload files. If you right-click on a folder (file), you can see the corresponding commands for your actions with the folder (file) in the context menu that pops up. As you can see, there are many possibilities, including the ability to receive a link to transfer to other users. The link will be encrypted.

    If you have not limited the file download speed in your cloud settings, then the data download speed will be unlimited and will depend only on the speed of your PC’s Internet connection. Further work with folders/files occurs in exactly the same way as in regular computer– you can edit them, get links to them, move them, allow shared access to them, copy them, etc. The process of uploading and downloading files is displayed on the right at the bottom of the page on the service - click on the icon

    How to share folders

    You can set public access rights to the folders that you will store in the Mega co nz cloud storage. To do this, simply right-click on the folder, and in the context menu that pops up, click “Sharing”. Next you will see the “Sharing” window, in which you need to specify the email address of the user to whom you want to grant sharing rights. For this user, you can configure rights - for example, set the rights to “Read Only”, “Read and Write”, “Full Control”. After this, sharing rights can allow users with the permissions you set to edit files, or only view them, or only download them. There can be any number of such users.

    After we indicate the email address for providing public access, a letter will be sent to his email with a link that is necessary to go to the service and gain access to the specified folder. The folders that are shared differ slightly in appearance from the rest of the cloud storage folders, and look like this:

    How to get a link to Mega.co.nz

    The Mega.co.nz service allows you to provide other users with links to download files that you host on the Mega cloud service. To get such a link, you need to right-click on the file and in the context menu that appears, click on the “Get link” menu item. In a new window that opens you will see your (encrypted or unencrypted) link to download the file. In general, all links to download files in the Mega.co.nz cloud service are issued in two types, and the type of link will depend on the degree of confidentiality of the security keys.

    If the link itself is formed in unencrypted form, then the file is still transmitted encrypted, and only if the user follows this link, the file is decrypted and becomes available for downloading. That is, until someone downloads this file, it will be stored in encrypted form. If the link itself is encrypted, then only the user who has received the link to the file along with a special security code (key) will be able to download the file from this link. Without this security code, the recipient will not be able to download the file from the link.

    In the image below you can see that if the “With file key” option is activated, then the encrypted code is embedded in the link itself, and it is available for download to all users. And vice versa - if you do not check this box, the target user will be able to download the file only if he enters the key you provided separately.

    Also, the user to whom the link to the file was intended can save it in his cloud located on Mega.co.nz. To do this, after receiving the link, you need to click the “Import” button. With this option, the link will not be downloaded to your computer, but will simply be moved from one account to another. It is clear that to carry out such an operation it is necessary that the recipient also has his own disk space in the Mega.co.nz cloud, just like, for example, in . You can see all these possibilities in the figure below:

    How to download a link with an individual key (second option)? Below in the image you see his solution. In the case of a separately transferred key, the recipient will be able to download the file if he receives from you both a link and a key to download the file from the cloud storage. You will receive the key itself by copying it when transferring the file (in the picture above there is the “Copy keys” item). You send all this data (both the shared link and the link with a separate key) to the user via regular email.

    After clicking on the “Decrypt” link, in a new window the user will have to enter the security key received from you to download the file, or to save it in his own cloud storage. After the key is entered, the user must click the “Download” button and check the box “I agree to MEGA’s terms of service,” or simply import the file to their cloud.

    After the file has been completely downloaded, the “Download Complete” window will open, and in it the user will be prompted to save the file manually in any convenient location on the computer to complete the download.

    And lastly, all the files that will be posted by you on the service cloud storage Mega.co.nz data will be encrypted - I already talked about this above. On the one hand, this is great, but on the other hand, you will not be able to visually view their contents, play or listen to audio and video files while they are in the cloud. That is, to use these files you will need to move them to your computer or mobile device. To completely delete all downloaded files, you need to move them to the trash, and then empty it too.

    Mega cloud is a fairly popular storage for various files, photographs, videos and documents. Each user who creates an account on the site is given 50 GB of free storage space absolutely free. In the future, this volume can be increased by additional fee, for example, you can purchase 4 TB for $30 per month.

    Now I want to make a review about the Mega cloud and talk about its main advantages. Many users call this cloud storage the most favorable in terms of price and available free space. They also often hold various promotions, for example, you can buy a package for one year and get two months absolutely free, which will save you quite a significant amount.

    Key Benefits

    Now I will tell my readers about the main advantages of Mega storage:

    • The service is multilingual, so users will not have any problems associated with not knowing a foreign language. Before you start working with cloud storage, you can select the desired language;
    • sufficiently large disk space, which is provided absolutely free immediately after registration;
    • You can upload files of any size and extension, as there are no restrictions for this;
    • transfer files to your friends using encrypted access. Encryption occurs in the browser using a special algorithm, so users are reliably protected from unauthorized access to personal files.

    Registration

    In order to start using Mega cloud storage, you need to register on the official website. This requires:

    Important! When filling out the form, you can provide any information. However, the email address must be real, otherwise you will not be able to start using cloud storage.

    Getting started

    After registration has been completed, Mega file storage is ready for use. To get started you need:

    1. Select the amount of free space, for example, 50 GB, which is provided for free, and click on the “Finish” button.
    2. Click on the “Upload file” button and select required file from your computer to upload it to the cloud.

    All folders, photos and documents that will be uploaded to the storage can be viewed from any computer or other device.

    Entrance

    In order to enter Mega file storage from your computer you will need:


    With this I would like to finish my article about Mega, reviews of which you can find on the Internet. Separately, I would like to add that those who use the browser can install a special MEGA extension, which can significantly increase the speed of downloading files to the cloud. Also, after installing the add-on, you can batch download files in an unlimited amount. Without installing any applications, it is best to use a browser.

    After the launch of the somewhat scandalous MEGA service, conversations about its security began to boil a little and died down. Today the service lives its own life and no one has even broken it. For some reason, the term “User Controlled Encryption” (UCE, or User Controlled Cryptography), which MEGA boasts, was missed from all the conversations. What I mean by "missed" is the fact that we haven't covered all the possibilities that a cryptography engine running in JavaScript on the client side gives us.

    Of course, the MEGA service itself simply means that the encryption keys are not stored on the server, but all their cryptography is performed in the context of the browser. At the same time, after the launch of the service, there was a lot of talk about the fact that it uses weak cryptographic algorithms and that in general everything is bad and we will all die, and our files will be read by the FSB. This gave me the idea to expand the concept of “UCE” and really take control of cryptography, namely, replace or supplement some of the service’s security mechanisms.

    In this article, I'll break down some of the magic that happens in two megabytes of MEGA JavaScript code and show how you can override some of the methods to stop worrying and love cryptography. As a result, we will receive a cloud file storage service with two-factor authentication and hardware encryption is critical important information.

    MEGA, UCE and all, all, all

    So, let's start by looking at the technologies on which the client part of the service is built, how new users are registered, registered users are authenticated, passwords are changed, and files are uploaded/downloaded.

    JavaScript

    As you may already know, the entire client side of the service is based on JavaScript; the main page code contains SHA-256 checksums for all scripts and pages that are loaded by the browser. The download itself occurs as follows: checksums are checked for all files, after which they are combined into one BLOB, which is given to the browser. The source code of the js files shows that they were written different people and sometimes there are funny gems, such as the consequences of copy-paste, meaningless conditions and simply strange variables.

    In the process of studying the source code of the site, I also noticed that it is being updated quite actively, the developers are correcting minor errors and optimizing the already written code, which is good news. The code itself is written very straightforwardly and without unnecessary prototyping: the site uses three hundred global variables and more than 8,000 functions. It was very easy to understand the site architecture and change its code.

    Among third-party frameworks, MEGA uses jQuery (you can’t live without it now), Ext JS and SJCL. The latter implements a cryptographic core with AES encryption. SJCL also provides an interesting format for storing keys and other byte arrays: instead of simply storing bytes in a regular array, they are “compressed” into a format called a32. Its essence is that the contents of any byte array are packed into 32-bit numbers and written into an array of shorter length. That is, every 4 bytes of the array are converted into one banal int. The site code contains functions that perform all kinds of transformations on an improvised set (a32 array, string, base64 string).

    Key information

    Before moving on to the description of the registration and authentication processes, it is worth considering the information that is subject to encryption, namely:
    • Account master key, which is created randomly at the time of user registration and has a length of 128 bits. And in principle, the length of all keys used for symmetric encryption, is equal to 128 bits.
    • RSA private key: Created at the time of registration based on mouse movements and keyboard input. In this article, I will not focus on asymmetric cryptography, since it is used for sharing downloaded files, and my task was to change the process of authentication and encryption of user data.
    • Individual file keys and the files themselves, uploaded to the service. The keys are generated randomly when a file is loaded, the key itself is used to encrypt the file data, and a key created based on the file's individual key and its checksum is used to encrypt the attributes.

    Closer to the code

    Now I propose to analyze the registration and authentication processes, see how the master key is created and how it is encrypted.
    I tried to depict these processes on paper and in order to let you understand the essence of the madness, I even took this photo:

    New user registration

    The registration process itself is quite confusing; after the user fills out the questionnaire, a mighty bunch of functions are called, but we are interested in the api_createuser function:

    // creating a new user and his master key function api_createuser(ctx, invitecode, invitename, uh) ( var i; var ssc = Array(4); // session self challenge, will be used to verify password var req, res; if (!ctx.passwordkey) ( ctx.passwordkey = Array(4); for (i = 4; i--;) ctx.passwordkey[i] = rand(0x100000000); ) if (!u_k) api_create_u_k(); // generating a random master key u_k for (i = 4; i--;) ssc[i] = rand(0x100000000); // generating a random authentication sequence if (d) console.log("api_createuser - masterkey: " + u_k + " passwordkey: " + ctx.passwordkey); // encrypt the master key on the current password and send it to the server (field k) // the ts field is the concatenation of ssc with its encrypted value req = ( a: "up" , k: a32_to_base64(encrypt_key(new sjcl.cipher.aes(ctx.passwordkey), u_k)), ts: base64urlencode(a32_to_str(ssc) + a32_to_str(encrypt_key(new sjcl.cipher.aes(u_k), ssc))) ); if (invitecode) ( req.uh = uh; req.ic = invitecode; req.name = invitename; ) if (d) console.log("Storing key: " + req.k); api_req(, ctx); )
    In this function we are interested in the following things:

    • u_k is the master key itself, a global variable. An array of 4 32-bit numbers, which is created by the api_create_uk function
    • ssc is simply a random array that is encrypted with the master key, concatenated with its public value, and sent to the server. Later it will be used to check the correctness of the master key during authentication
    • sjcl - cryptographic library implementing AES
    • rand() - local implementation of a pseudorandom number generator based on RC4
    • encrypt_key() is the cornerstone function of the service's symmetric cryptography. Accepts an sjcl object initialized with a key and an array that needs to be encrypted. The function code is below and hopefully self-explanatory.
    // encrypt/decrypt 4- or 8-element 32-bit integer array function encrypt_key(cipher, a) ( if (a.length == 4) return cipher.encrypt(a); var x = ; for (var i = 0;< a.length; i += 4) x = x.concat(cipher.encrypt(, a, a, a])); return x; }
    As a result, after registration the following is sent to the server:
    • Master key encrypted with the key derived from the account password
    • String like ssc||encrypt_AES-128(u_k, ssc)

    User Login

    Now you can smoothly move on to the authentication process. Briefly, it is done like this:
    1. The user enters login/password
    2. If the first stage of authentication is passed, then an encrypted master key and an authentication sequence (ssc) created during registration are received from the server
    3. The master key is decrypted using the user-entered password
    4. The authentication sequence is decrypted on the master key and compared with its open value - thus checking the correctness of the master key and password.
    The api_getsid2 callback function is responsible for all of the above:

    // decrypt the master key after the user logs in function api_getsid2(res, ctx) ( var t, k; var r = false; if (typeof res == "object") ( // initialize sjcl-aes with the current account password var aes = new sjcl.cipher.aes(ctx.passwordkey); // if we received a master key in the server response... if (typeof res.k == "string") ( k = base64_to_a32(res.k); if (k.length == 4) ( // ... then decrypt it k = decrypt_key(aes, k); // and re-initialize sjcl-aes using the master key aes = new sjcl.cipher.aes( k); // if we received ssc from the registration process if (typeof res.tsid == "string") ( t = base64urldecode(res.tsid); // encrypt the first half of the string and compare it with the value from the server // if they matched - it means that all logins and passwords match and you can let the user in if (a32_to_str(encrypt_key(aes, str_to_a32(t.substr(0, 16)))) == t.substr(-16)) r = ) // The private key of the RSA pair is analyzed below, we are not interested in this yet else if (typeof res.csid == "string") ( var t = mpi2b(base64urldecode(res.csid)); var privk = a32_to_str(decrypt_key(aes, base64_to_a32(res.privk))); var rsa_privk = Array(4); // decompose private key for (var i = 0; i< 4; i++) { var l = ((privk.charCodeAt(0) * 256 + privk.charCodeAt(1) + 7) >> 3) + 2; rsa_privk[i] = mpi2b(privk.substr(0, l)); if (typeof rsa_privk[i] == "number") break; privk = privk.substr(l); ) // check format if (i == 4 && privk.length< 16) { // TODO: check remaining padding for added early wrong password detection likelihood r = ; } } } } } ctx.result(ctx, r); }
    As a bonus to registration/authentication, you can take a look at the password change process.

    // change the user password function changepw(currentpw, newpw, ctx) ( var pw_aes = new sjcl.cipher.aes(prepare_key_pw(newpw)); api_req([( a: "up", currk: a32_to_base64(encrypt_key(new sjcl. cipher.aes(prepare_key_pw(currentpw)), u_k)), k: a32_to_base64(encrypt_key(pw_aes, u_k)), uh: stringhash(u_attr["email"].toLowerCase(), pw_aes) )], ctx);
    The code for this function is self-explanatory: we encrypt the master key with two keys obtained from the old and new passwords, and then send these values ​​to the server. If the current password is correct, it is replaced with a new one. Here I wanted to pay more attention to the prepare_key_pw function, which was implicitly present in all previous operations. Its task is to convert the string password into an a32 array, and then perform the key derivation operation as follows:

    // convert user-supplied password array function prepare_key(a) ( var i, j, r; var aes = ; var pkey = ; for (j = 0; j< a.length; j += 4) { key = ; for (i = 0; i < 4; i++) if (i + j < a.length) key[i] = a; aes.push(new sjcl.cipher.aes(key)); } for (r = 65536; r--;) for (j = 0; j < aes.length; j++) pkey = aes[j].encrypt(pkey); return pkey; }
    This feature has caused a lot of criticism because it is based on a home-grown algorithm. While writing this article, the creators of the service managed to change its code a little, but I didn’t notice any significant changes. Its essence is that the transmitted password is encrypted 65536 times using a constant key in order to obtain a key indistinguishable from a random one. Why the creators of the service did not use existing algorithms (for example, PBKDF2) remains a mystery.

    Uploading and encrypting files

    Briefly, this whole process can be represented like this:

    I warn you, delving into this picture for a long time is dangerous for the brain, so below I will tell you how it all happens.

    As I already said, when loading, each file creates its own random array key of 6 32-bit numbers. The first four elements of this array are used to encrypt the contents of the file, and the last two are used as the initial values ​​of the counter that is used to calculate the checksum of the file. This array is stored in the global variable ul_key. Its contents are entered into the JSON-serialized string ul_KeyNonce .

    The decryption itself occurs with using the Web Worker (if the browser supports this technology) or simply inside the main page code. When a file is ready to be sent, a new key, filekey , is created to encrypt its attributes (currently just the file name) based on the ul_key and the file's checksum. This key is then encrypted with the master key and sent to the server along with the file attributes. The initupload3 and api_completeupload2 functions are responsible for all these actions. The filekey is created in the ul_chunkcomplete function, below I will give a part of it.

    // start uploading a file: creating its individual key and initializing the encryption mechanism function initupload3() ( // ... cut =) // creating a random individual key for the file // ul_key is used in page code, // ul_keyNonce is passed to the Web Worker and is used there // to encrypt the file and calculate its checksum ul_key = Array(6); for (i = 6; i--;) ul_key[i] = rand(0x100000000); ul_keyNonce = JSON.stringify(ul_key); ul_macs = ; // ... next is processing the download queue, it is of no interest... // initializing sjcl-aes for a file based on ul_key ul_aes = new sjcl.cipher.aes(); // ... // starting the file upload process: // reading it from disk, encrypting and sending onUploadStart(ul_queue_num); ul_dispatch_chain(); ) // creating a key to encrypt file attributes function ul_chunkcomplete(slot,pos,response) ( // ... var t = ; // ul_macs - an array with the file checksum obtained inside the worker for (p in ul_macs) t .push(p); // filling and sorting a temporary array, if anyone knows why, please explain t.sort(function(a,b) ( return parseInt(a)-parseInt(b) )); = 0;< t.length; i++) t[i] = ul_macs]; // внутри condenseMacs производится зашифрование // и "уплотнение" контрольной суммы файла в массив из 4х элементов var mac = condenseMacs(t,ul_key); ul_settimeout(-1); // на основе контрольной суммы и ключа файла создается ключ для шифрования атрибутов // он же в зашифрованном виде позже будет отправлен на сервер var filekey = ; // ... } // завершение загрузки файла: зашифрование атрибутов и ключа файла и отправка их на сервер function api_completeupload2(ctx, ut) { var p; if (ctx.path && ctx.path != ctx.n && (p = ctx.path.indexOf("/")) >0) ( var pc = ctx.path.substr(0, p); ctx.path = ctx.path.substr(p + 1); fm_requestfolderid(ut, pc, ctx); ) else ( // encrypt the file name to key derived from ul_key and checksum // ctx.k == filekey a = ( n: ctx.n ); if (d) console.log(ctx.k); var ea = enc_attr(a, ctx.k) ; if (d) console.log(ea); // transfer of attributes and the file key encrypted on the master key var req = ( a: "p", t: ut, n: [( h: ctx.t, t: 0, a: ab_to_base64(ea), // attributes k: a32_to_base64(encrypt_key(u_k_aes, ctx.k)), // == AES_encrypt(u_k, filekey) fa: ctx.fa )] ); // a target has been supplied: encrypt to all relevant shares var sn = fm_getsharenodes(ut); if (sn.length) ( req.cr = crypto_makecr(, sn, false); req.cr = ctx.t; ) ) api_req(, ctx.ctx);

    Downloading and decrypting files

    Obviously, these processes should simply be the reverse of encrypting the file. The only thing that may be of interest is obtaining the value of the ul_key key from the encrypted filekey value that came from the server.

    At the time the file is downloaded, the browser context already contains an object that stores the decrypted file keys. Therefore, it first makes sense to consider the process that occurs immediately after user authentication, namely, downloading the file manager. After the user has been allowed into the service, he naturally wants to gain access to his files (assuming that he already had them there). To do this, we need to first decrypt the file keys, and then their attributes. This matter is dealt with by another pack of functions, of which we are interested in loadfm_callback and process_f_f .

    Briefly, the process of obtaining file attributes can be described by the following algorithm:

    1. Wait for the file manager to load (loadfm_callback), where you can get JSON with a description of all downloaded files
    2. Create an array farray in which to put an array with information about files
    3. Run (recursively) the process_f_f function for each file
    4. For each file that has a key, decrypt that key and attributes (crypto_processkey function) and save them back into an array with file information
    5. After that, save the decrypted values ​​to the FileStore variable (end of recursion in process_f_f)
    Below I will provide code excerpts illustrating this algorithm

    // callback for loading the file manager function loadfm_callback(json, res) ( // ... // processing JSON with information about files json = json; if (d) console.log(json); if (d) console.log (json); if (json.u) process_u(json.u, false); if (json.ok) process_ok(json.ok); if (json.s) ( for (i in json.s) ( if ( u_sharekeys.h]) ( sharingData.push(( id: json.s[i].h + "_" + json.s[i].u, userid: json.s[i].u, folderid: json. s[i].h, rights: json.s[i].r, date: json.s[i].ts )); sharednodes.h] = true; ) ) ) // ... nothing special further. .. // entering information about the files into another global array farray = new Object farray.f = json.f // starting its processing, the callback was declared above // ​​in this function and simply modifies the layout process_f(fi, false , callback); fi++; ) // recursive function in which file keys and attributes are decrypted // called from process_f function process_f_f(fid) ( // recursion end condition - we have processed all files in the farray array if (!farray.f.i ]) ( if (farray.ap) FileStore.suspendEvents(); // writing data to FileStore FileStore.loadData(farray.mdata, true); if (farray.ap) FileStore.resumeEvents(); if (d) console.log("call reqmissingkeys:"); crypto_reqmissingkeys(); if (farray.callback) farray.callback.fn(farray.callback); return false; ) var f = farray.f.i]; f.attrs = f.a; if (f.sk) u_sharekeys = crypto_process_sharekey(f.h, f.sk); // if the file matches the type and has a key, then process it if ((f.t !== 2) && (f.t !== 3) && (f.t !== 4) && (f.k)) ( crypto_processkey(u_handle, u_k_aes , f); // description of this function below u_nodekeys = f.key; if ((typeof f.name !== "undefined") && (f.p == InboxID)) InboxCount++) else ( if (f.a) ( if ( !missingkeys) ( missingkeys = true; new missingkeys = true; ) ) f.k = ""; f.name = "" ) if (f.t == 2) RootID = f.h; else if (f.t == 3) InboxID = f.h; else if (f.t == 4) TrashbinID = f.h; else if ((f.t< 2) || (f.t == 5)) { // тут идет обработка расшаренных файлов } else { // подготовка массива для записи в FileStore farray.mdata.push({ id: f.h.replace(/[^a-z^A-Z^0-9^_^-]/g, ""), name: f.name, size: f.s, type: filetype(f.name, f.t), icon: fileicon(f.name, icontype), parentid: f.p, folder: f.t, owner: f.u, date: f.ts, attrs: f.attrs, key: f.key, r: f.r, su: f.su, fa: f.fa, }); if (f.p == TrashbinID) trashbinfull = true; if (((f.t) && (farray.ap)) || (f.p == InboxID)) refreshtree = true; } farray.i++; // проверка таймаута (видимо, чтобы загрузка файл-менеджера не выглядела слишком долгой) timeoutcount++; if (!(timeoutcount & 63)) { // если у нас больше 63 файлов - дальше грузим их асинхронно setTimeout("process_f_f(" + fid + ")", 1); timeoutcount2++; } // иначе - запускаем обработку следующего файла else process_f_f(fid); } // обработка ключа файла и его атрибутов function crypto_processkey(me, master_aes, file) { var id, key, k, n; if (!file.k) { if (!keycache) return; file.k = keycache; } id = me; // do I own the file? (user key is guaranteed to be first in .k) // ключ записан в виде ":/" var p = file.k.indexOf(id + ":"); // first check if the file is shared if (p) ( // I don"t - do I have a suitable sharekey? for (id in u_sharekeys) ( p = file.k.indexOf(id + ":"); if (p >= 0 && (!p || file.k.charAt(p - 1) == "/")) break; p = -1; ) ) // and then we can move on to decryption if (p >= 0) ( delete keycache; // slash is probably a sign of shares var pp = file.k.indexOf("/", p); if (pp< 0) pp = file.k.length; p += id.length + 1; key = file.k.substr(p, pp - p); // we have found a suitable key: decrypt! if (key.length < 46) { // short keys: AES k = base64_to_a32(key); // check for permitted key lengths (4 == folder, 8 == file) if (k.length == 4 || k.length == 8) { // ключ расшифровывается либо на мастер-ключе, либо на общем ключе шары k = decrypt_key(id == me ? master_aes: new sjcl.cipher.aes(u_sharekeys), k); } else { if (d) console.log("Received invalid key length (" + k.length + "): " + file.h); return; } } else { // long keys: RSA if (u_privk) { var t = mpi2b(base64urldecode(key)); if (t) k = str_to_a32(crypto_rsadecrypt(t, u_privk).substr(0, file.t ? 16: 32)); else { if (d) console.log("Corrupt key for node " + file.h); return; } } else { if (d) console.log("Received RSA key, but have no public key published: " + file.h); return; } } // декодируем атрибуты файла var ab = base64_to_ab(file.a); // и расшифровываем их с помощью только что полученного ключа var o = dec_attr(ab, k); if (typeof o == "object") { if (typeof o.n == "string") { if (file.h) { u_nodekeys = k; if (key.length >= 46) rsa2aes = a32_to_str(encrypt_key(u_k_aes, k)); ) // if we have correctly decrypted the key and attributes, we save them into a file object file.key = k; file.name = o.n; ) ) ) else ( if (d) console.log("Received no suitable key: " + file.h); if (!missingkeys) ( new missingkeys = true; missingkeys = true; ) keycache = file.k; ) )
    After this, we can get the value of the original key ul_key from the browser context like this: dl_keyNonce = JSON.stringify();
    This conversion happens in the startdownload function. If we take into account that the value dl_key == filekey from the ul_chunkcomplete function and perform simple modulo addition operations, we will notice that the dl_keyNonce variable will store the ul_key value generated when loading the file. An illustration of this can be seen in the lower left corner of the board in the photo at the beginning of the section on uploading files.

    "Overloading" of cryptographic operations

    Despite the fact that the principles described above for protecting files and keys are very secure, some may not like the fact that we still depend on the implementation of the algorithms that the service provides. In this case, we can develop our own browser extension, which will override some of the service’s functions, implementing additional encryption in them. Namely, I decided to implement the protection of key information (master key and file keys) using hardware encryption on a non-removable key according to the GOST 28147-89 algorithm. A bonus to this will also be the inclusion of two-factor authentication on the service.
    So, let's consider this use-case:
    • The user registers on the service
    • Then it installs the extension
    • With its help, hardware encryption of the master key is performed using a key that cannot be extracted from the token.
    • The master key encrypted in this way is uploaded to the server
    After this, it will be impossible to obtain the master key value without possessing the token and its PIN code. This will give:
    1. Two-factor authentication on the service (without a correctly decrypted master key, the api_getsid2 function will fail)
    2. Without a token, you will also not be able to change your current account password.
    The next step is to encrypt using the file encryption key token (also known as ul_key) and the file attribute key (filekey), which is stored on the server. Thus, we will get that each file will be encrypted with a key that will never get to the server, where the filekey we encrypted from the api_completeupload2 function will go. File attributes will be encrypted on the public value of filekey . For greater clarity, I sketched out the following diagram illustrating the process of downloading a file:

    I want to note that here I used a very cunning method. IN in this case It is important for us that an attacker cannot decrypt the file, even if he intercepts the file key received from the server and knows the user’s master key. Therefore, here you can play on the peculiarities of the service’s architecture and use the key value ul_keyNonce (aka dl_keyNonce) obtained by encrypting the value of the ul_key (or dl_key) key to encrypt files.

    Since these articles were written, our product has added the ability to use hardware encryption using the GOST 28147-89 algorithm. The beta version of the plugin with hardware encryption functionality according to the GOST 28147-89 algorithm can be downloaded. This plugin version has not yet been released full testing, therefore I warn you that there may be errors in it, the presence of which I ask you to report in a personal message.
    In the plugin interface, symmetric encryption is implemented by the encrypt function, which has the following syntax:
    encrypt(deviceId, keyLabel, data, resultCallback, errorCallback) → (string)
    The function takes as input:

    • Device ID, number
    • Label of the encryption key, number (if there is no such key, it will be generated)
    • Encrypted data, string (string containing a byte array of the form "aa:bb:cc:dd")
    • Callback functions for successful and unsuccessful completion of an encryption operation
    Decryption is done in the same way using the decrypt function
    Special attention should be paid to the key label, since it determines on which key the data will be decrypted. The label is an arbitrary string and mainly serves to conveniently identify the key. In this case, I use two key pairs: one to encrypt the master key, the second to encrypt individual file keys. The key on which the master key is encrypted has a label equal to the user’s password (now I came up with the idea of ​​​​using a hash from the e-mail||password string, I will fix this in the near future). To encrypt the keys of downloaded files, a key with a label equal to the string representation of the master key is used (here it is also worth using the hash of the master key).

    Direct development

    I would like to immediately make a note about my source code: it is, in fact, in an alpha version, although it implements the functionality described above. I didn’t check how compatible my modification turned out to be with the other functions of the service, so I posted all the sources on github and will be glad for any help in finalizing this system. Therefore, I will not clutter up the article further with huge listings, but will only describe general scheme expansion work.

    The finished extension can be downloaded. It was developed using the Crossrider service, which provides extensions for three browsers (Chrome, Firefox and IE), but it is better to check its operation in Chrome or Firefox, and in the first it works much more stable.

    The extension code is quite simple: it checks whether we are on the service page and if so, it simply loads additional scripts. These scripts modify the page code by adding a couple of dialogs and override following functions service:

    • changepw: responsible for changing the password
    • api_getsid2: one of the login callbacks
    • api_completeupload2: callback to complete file upload
    • loadfm_callback: file manager load callback
    • processpacket: another callback, in which the attributes of the just downloaded file are decrypted
    • parsepage: responsible for drawing additional dialogs
    • dologin: extends authentication capabilities
    • initupload3: responsible for creating the file encryption key
    • startdownload: reverse parse the file key and initialize the download
    Once again, I want to warn you that you shouldn’t drag the extension onto your work account (if anyone here uses this service at all), but it’s better to create a test one. In order to use the extension after installing it, you will need:
    1. To get started, it’s a good idea to get Rutoken EDS (or Rutoken Web) and install a browser plugin
    2. Install extension
    3. Log in to the service with the extension disabled
    4. Enable extension in browser
    5. Go to account page
    6. Click on the “Bind token” button
    7. Enter the current password and perform this operation
    Instead of the extension, you can use the following bookmarklet (tested in Chrome, Safari, Firefox): javascript:(function())(if(document.getElementById("cryptorutokenjs"))(alert("The plugin is already installed");return)function loadRemoteScript(url )(var script=document.createElement("script");script.type="text/javascript";script.src=url;document.head.appendChild(script))function loadRemoteStyle(url)(var style=document. createElement("link");style.rel="stylesheet";style.type="text/css";style.href=url;document.head.appendChild(style))loadRemoteStyle("https://mega-crypto .googlecode.com/git/mega.css");loadRemoteScript("https://mega-crypto.googlecode.com/git/util.js");loadRemoteScript("https://mega-crypto.googlecode.com /git/rutoken-extra.js");loadRemoteScript("https://mega-crypto.googlecode.com/git/rutoken-crypto.js");loadRemoteScript("https://mega-crypto.googlecode.com /git/mega.js")))();

    Demonstration of work

    First, let's connect our creation to the site. To do this:

    Then you can log out of the service and try to log in again using two-factor authentication:

    Authentication occurs according to the following scheme:

    1. Checking the login-password pair on the server
    2. If the login and password are correct, then an encrypted master key comes from the server
    3. The plugin requests a PIN code for the token
    4. If the PIN is entered correctly, then the master key is decrypted on the key from the token

    Instead of a conclusion

    Here I feel like writing “to be continued...”, since I did not cover the details of creating the extension and the interestingness of bolting asynchronous encryption functions into a service that in most cases uses synchronous calls. In conclusion of this article, I would like to once again turn to the idea of ​​​​implementing client-side cryptography.
    The approach to implementing additional cryptographic functions on the client side can be applied to any web service that does not care what is stored on its server: be it file storage, mail, or a simple chat. For example, you can implement secure mail based on any postal service using message encryption in CMS format and key exchange mechanisms using the VKO GOST R 34.10-2001 algorithm.
    Thank you for your attention, I look forward to your questions and comments.javascript Add tags