Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  browser_encrypt.js

  Sprache: JAVA
 

/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */


// Test that databases are encrypted on disk.

"use strict";

const lazy = {};

ChromeUtils.defineESModuleGetters(lazy, {
  Sqlite: "resource://gre/modules/Sqlite.sys.mjs",
});

async function removeIfExists(path) {
  if (await IOUtils.exists(path)) {
    await IOUtils.remove(path);
  }
}

add_task(async function testSecurityEnableEncryption() {
  if (
    !Services.prefs.getBoolPref(
      "security.storage.encryption.sqlite.enabled",
      false
    )
  ) {
    ok(true"SQLite encryption disabled (landing default); skipping.");
    return;
  }

  let profileDir = Services.dirsvc.get("ProfD", Ci.nsIFile).path;

  let dbName = `test_encryption_encrypt_${Date.now()}_${Math.random()
    .toString(36)
    .slice(28)}.sqlite`;
  let dbPath = PathUtils.join(profileDir, dbName);

  for (let suffix of ["""-wal""-shm""-journal"]) {
    await removeIfExists(dbPath + suffix);
  }

  let conn = await lazy.Sqlite.openConnection({ path: dbName });

  is(conn._connectionData._open, true"Connection should be open");

  let lorem =
    "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin a convallis nisl. Donec tincidunt sodales felis vitae tempus sed. ";

  await conn.execute("CREATE TABLE IF NOT EXISTS test (value TEXT);");
  await conn.execute("INSERT INTO test (value) VALUES ('" + lorem + "');");

  await conn.close();

  let contents = await IOUtils.read(dbPath);

  // Checking for a substring is easier than checking for a subarray.
  const decoder = new TextDecoder();
  let text = decoder.decode(contents);

  is(
    text.includes(lorem),
    false,
    "Encrypted database should not contain plain-text values"
  );
});

Messung V0.5 in Prozent
C=92 H=95 G=93

¤ Dauer der Verarbeitung: 0.16 Sekunden  (vorverarbeitet am  2026-08-25) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002