How to use the mega cloud. MEGA, UCE and all, all, all. Working with the Cloud@Mail online disk through the Windows application

Storage service Mega data co nz was launched in 2013. On the first day, 1 million users visited the site, and within the first hour, more than 100,000 users registered. As of 2015, Mega stores information on the Internet for more than 15 million users.

Mega Cloud Service stands for “MEGA Encrypted Global Access”. When uploading data to storage, all files are encrypted in the browser using AES algorithm, and are stored on the server in encrypted form. In addition, Mega does not store passwords or . They belong only to the user and cannot be restored by the company. If you have forgotten your password, the only way to recover it is to have a Mega nz master key.

Data storage Mega co nz - provides both free and paid space for storing files on the Internet. Gives you the opportunity to store and access your files anywhere in the world. It has several ways to upload files to Mega.nz storage using a web browser or special client applications.

Creating an account with Mega is easy. You must provide an address Email and password to get started. The difference between Mega.co storage and storage is that you will then receive 50GB of free disk space to store files on the Internet, and you do not need to enter credit card information during registration.

The Mega co cloud is very easy to navigate. Buttons for uploading files and folders are located in top panel menu, and below it the downloaded data. On the left is the control and display column in the Mega cloud service. By clicking on the menu button at the top right, you can change the language, install Add-On applications on browsers Google Chrome, Mozilla Firefox, synchronize any folders on a computer running under the operating system Windows system, Mac, Linux with folders in the Mega cloud, synchronization and uploading of your data with the cloud mobile app Android iOS Blackberry Windows on a smartphone or tablet.


Storing files and sharing them in the cloud service Mega.co.nz is very simple, create a new folder, upload photos, videos, documents or other information into it by clicking the “Upload file” button in the top menu. The Mega.nz data store does not limit the size of the downloaded file, and the download speed unless you limit it in the settings.

When you right-click on a folder in the drop-down menu, you can open it, get a link to download the file from a cloud service, copy, rename, move, or delete data from the disk.

Data storage Mega.nz offers three paid plans for storing files on the cloud:

PRO Ⅰ 500 GB € 9.99/month OR € 99.99/year
PRO Ⅱ 2TB GB € 19.99/month OR € 199.99/year
PROⅢ 4TB GB € 29.99/month OR € 299.99/year
When purchasing an annual PRO plan, get 2 months free.
Everyone can use the MEGA cloud for free.

Register with Mega.co.nz

Mega | cloud storage Mega | Cloud Mega | Mega Storage

After the launch of the somewhat scandalous MEGA service, conversations about its security began to boil a bit 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, myself MEGA service this simply means that the encryption keys are not stored on the server, but all their cryptography is performed in the context of the browser. Moreover, after the launch of the service there was a lot of talk about the fact that it uses unstable cryptographic algorithms and that in general everything is bad and we will all die, and the FSB will read our files. 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 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 of critical 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, in the code home page SHA-256 checksums are specified 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 commonplace 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 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 public access to downloaded files, and I had the task of changing 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 downloaded; this key itself is used to encrypt the file data, and a key created based on the file’s individual key and its checksum.

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 - simple
  • rand() - local implementation of a pseudorandom number generator based on RC4
  • encrypt_key() - cornerstone function symmetric cryptography service. 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. 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 = ) // discussed below private key RSA pairs, 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;< 16) { // TODO: check remaining padding for added early wrong password detection likelihood r = ; } } } } } ctx.result(ctx, r); }
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 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);< 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; }
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 Current Password comes up, then it is replaced with a new one. Here I wanted to draw 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

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 didn’t the creators of the service use

existing algorithms

(eg PBKDF2) remains a mystery.

The decryption itself occurs using a 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 based on ul_key and file 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 loading the 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 the page code, // ul_keyNonce is passed to the Web Worker and used there // to encrypt a file and calculate its checksum ul_key = Array(6);< 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 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); recursive function, in which keys and file attributes are decrypted // called from process_f function process_f_f(fid) ( // condition for ending the recursion - we have processed all the files in the farray array if (!farray.f.i]) ( if (farray.ap) FileStore. suspendEvents(); // write data to FileStore FileStore.loadData(farray.mdata, true); if (farray.ap) FileStore.resumeEvents(); if (d) console.log("call reqmissingkeys:"); ); if (farray.callback) farray.callback.fn(farray.callback); var f = farray.f.i]; if (f.sk) u_sharekeys(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; newmissingkeys = true; ) ) f.k = "";< 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) // ключ записан в виде ":/f.name = "";< 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 to 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 key information
(master key and file keys) using hardware encryption on
  • 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
  1. With its help, hardware encryption of the master key is performed using a key that cannot be extracted from the token.
  2. The master key encrypted in this way is uploaded to the server
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 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")
  • Functions callback for successful and unsuccessful completion of the 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, adding a couple of dialogs, and override the following service functions:

  • 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 should not drag the extension onto your work account (if anyone here uses this service at all), but it is 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. For 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 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

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 on 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.

Initially, I downloaded small files from Mega, 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 the developers software This promotion scheme is 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 all. To start downloading, 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 to you.

Mega is a cloud storage that offers users 50 GB of free disk space for data storage. A similar increase in memory to hard drive it will not be unnecessary for anyone.

The extension allows access to cloud storage via a browser. This reduces boot times, improves performance and improves security. Speaking of MEGA disk storage, we're talking about about global safe access. Using a browser extension, necessary files will be available day and night. MEGA provides end-to-end encryption. This means that messages, photos, videos are protected from falling into the wrong hands. Only those cloud storages that have access to personal data are under your control. Even MEGA doesn't have access to them! Unlike most other cloud services, MEGA developers advocate secure collaboration. This allows you to exchange information, connect with contacts, and view updates in real time.

Large storage space

MEGA is not just safer than its competitors. Quantity provided free storage many times more than others. Thanks to the real-time file synchronization feature, all files are safe and can be restored if necessary. To provide independent verification of the correctness and integrity of the cryptographic model, as well as its implementation, MEGA publishes a complete source client applications. And it pleases!

Today, the Internet offers a large number file storages, similar to each other. The first thing that comes to mind: Yandex.Disk, Google Drive, Dropbox, OneDrive. What makes MEGA different from its competitors is that it provides 50 GB of disk storage for free for registered users. MEGA does not limit the size of files uploaded to the cloud.

Hello.

Some users forced me to write this article with their whining. More and more cool materials began to appear on the site, which are available for download using the Mega cloud storage. As time has shown, many users are not able to download the course. The question immediately arises: “Why do you need a course if you can’t even do the simplest action, how to download the material?!” If earlier these comments caused a smile and laughter, now it has become a little annoying and those who write such comments resemble a primeval sponge, as in the preview for this article. In the future (in the very near future), voluminous cool materials are expected that will be available for downloading through Mega. If you have problems downloading- read this article, since this issue will not be raised again and no one will, for the sake of some users, break materials into hundreds of pieces and re-upload them to other repositories. Users who continue to whine will be sent to learn PC skills and will be temporarily isolated from society.

So, let's look at why Mega? Everything is very simple. For us, this is a convenient storage facility, where there are no restrictions on the volume of uploaded material, where the disk capacity is large, and where complaints are taken seriously. Materials for users are available for free, so either learn to download or don’t download at all. Let's assume that you have found the desired course and it is uploaded to Mega. First of all, make sure that the storage itself opens. If Mega is not available in your country (some providers block storage), use a proxy or VPN to bypass the block. Now the simplest thing left is to download the material. There are 2 most simple ways downloads:

1 way. This method Suitable for downloading small files. To download large files, use method 2. First way- This is to use downloading through a regular browser. As practice has shown, it works best with Mega Google browser Chrome. Therefore, we recommend using it. How to download via browser: First, the material is downloaded to the cache, then after it is completely downloaded, you can save it to any folder (if folder selection is not configured, the material is saved to the downloads folder).

Click the “Download in Browser” button and wait for the download to complete. You can't close the tab!

You can also use software from Mega - MegaSync and synchronize files, but we have not tried this method of downloading, although some users praise this particular method. Also, according to some users, for successful downloading, files need to be imported to your cloud drive, but in general this is not necessary. After downloading a large file through a browser, we recommend clearing the browser cache, for example, using the CCleaner utility.

Method 2. Download using the Mipony program. Mipony program can be downloaded from the official website. We recommend using this method, since the program is very convenient and has many advantages, for example, the software supports resuming files (like a torrent) and does not create temporary files, unlike downloading through a browser. Some antiviruses may swear at the program, but there is nothing wrong with that. The program does not steal anything and is not malicious. Paranoid people can use the program on a virtual machine. Install the program (everything is very simple) and launch it. First of all, open the “Options” tab and make sure that there is no speed limit there.