├── .gitignore ├── .gitmodules ├── .travis.yml ├── AUTHORS ├── CONTRIBUTING.md ├── CONTRIBUTORS ├── Copybara ├── Gruntfile.js ├── LICENSE ├── README.md ├── all_tests.html ├── compiler.flags ├── do.sh ├── download-libs.sh ├── lib └── docs-build │ ├── dossier-config.json │ └── zlib_externs.js ├── package.json ├── src └── javascript │ └── crypto │ └── e2e │ ├── algorithm │ ├── algorithm.js │ ├── all_ciphers.js │ ├── all_signers.js │ ├── cipher.js │ ├── ciphertext.js │ ├── key.js │ ├── signature.js │ └── signer.js │ ├── asymmetric │ ├── dh.js │ ├── dh_test.js │ ├── dsa.js │ ├── dsa_test.html │ ├── dsa_testdata.js │ ├── ecdh.js │ ├── ecdh_test.html │ ├── ecdh_testdata.js │ ├── ecdsa.js │ ├── ecdsa_test.html │ ├── elgamal.js │ ├── elgamal_test.html │ ├── keygenerator.js │ ├── keygenerator_test.html │ ├── rsa.js │ ├── rsa_encrypt.js │ ├── rsa_sign.js │ └── rsa_test.html │ ├── async │ ├── async.js │ ├── async_test.html │ ├── asyncrespondingchannel.js │ ├── asyncrespondingchannel_test.html │ ├── asyncrespondingchannel_test.js │ ├── broker.js │ ├── childpeer.js │ ├── client.js │ ├── foreignpeer.js │ ├── frame.js │ ├── frameself.js │ ├── peer.js │ ├── result.js │ ├── router.js │ ├── service.js │ ├── sharedworker.js │ ├── util.js │ ├── worker.js │ ├── worker_test.html │ └── workerself.js │ ├── ciphermode │ ├── cbc.js │ ├── cbc_test.html │ ├── cfb.js │ ├── cfb_test.html │ ├── ciphermode.js │ ├── ctr.js │ ├── ctr_test.html │ ├── pkcs7.js │ └── pkcs7_test.html │ ├── compatibility_tests │ ├── README.md │ └── drivers │ │ ├── bc │ │ ├── build.xml │ │ ├── download-libs.sh │ │ └── src │ │ │ └── com │ │ │ └── google │ │ │ └── e2e │ │ │ └── bcdriver │ │ │ ├── Decryptor.java │ │ │ ├── KeyChecker.java │ │ │ ├── Main.java │ │ │ └── Util.java │ │ └── e2e │ │ └── run.js │ ├── compression │ ├── all.js │ ├── bzip2.js │ ├── bzip2_test.html │ ├── compression.js │ ├── factory.js │ ├── zip.js │ ├── zlib.js │ └── zlib_test.html │ ├── debug.js │ ├── debug_test.html │ ├── e2e.js │ ├── e2e_test.html │ ├── ecc │ ├── constant │ │ ├── constant.js │ │ ├── create_fast_multiply_table_ed25519.html │ │ ├── create_fast_multiply_table_nist.html │ │ ├── fast_multiply_table_ed25519.js │ │ ├── fast_multiply_table_p256.js │ │ ├── fast_multiply_table_p384.js │ │ └── fast_multiply_table_p521.js │ ├── curve │ │ ├── curve.js │ │ ├── curve25519.js │ │ ├── ed25519.js │ │ └── nist.js │ ├── domainparam.js │ ├── ecc_perf_test.html │ ├── ecctester.js │ ├── ecdh.js │ ├── ecdh_test.html │ ├── ecdh_testdata.js │ ├── ecdsa.js │ ├── ecdsa_test.html │ ├── ecdsa_testdata.js │ ├── ed25519.js │ ├── ed25519_test.html │ ├── element.js │ ├── fastmodulus │ │ ├── curve25519.js │ │ ├── fastmodulus_test.html │ │ └── nist.js │ ├── point │ │ ├── curve25519.js │ │ ├── curve25519_test.html │ │ ├── ed25519.js │ │ ├── ed25519_test.html │ │ ├── nist.js │ │ ├── point.js │ │ ├── point_test.html │ │ └── testdata.js │ ├── protocol.js │ └── protocol_test.html │ ├── error.js │ ├── extension │ ├── _locales │ │ └── en │ │ │ └── messages.json │ ├── actions │ │ ├── action.js │ │ ├── decryptverify.js │ │ ├── decryptverify_test.html │ │ ├── decryptverify_test.js │ │ ├── encryptsign.js │ │ ├── encryptsign_test.html │ │ ├── encryptsign_test.js │ │ ├── executor.js │ │ ├── executor_test.html │ │ ├── executor_test.js │ │ ├── getkeydescription.js │ │ ├── getkeydescription_test.html │ │ ├── getkeydescription_test.js │ │ ├── getkeyringbackupdata.js │ │ ├── importkey.js │ │ ├── importkey_test.html │ │ ├── importkey_test.js │ │ ├── listkeys.js │ │ ├── listkeys_test.html │ │ ├── listkeys_test.js │ │ ├── restorekeyringdata.js │ │ ├── restorekeyringdata_test.html │ │ └── restorekeyringdata_test.js │ ├── api │ │ ├── api.js │ │ ├── api_test.html │ │ ├── api_test.js │ │ ├── requestthrottle.js │ │ ├── requestthrottle_test.html │ │ └── requestthrottle_test.js │ ├── app_manifest.json │ ├── bootstrap.js │ ├── constants.js │ ├── extension_manifest.json │ ├── externs.js │ ├── helper │ │ ├── bootstrap.js │ │ ├── gmonkeystub.js │ │ ├── helper.js │ │ ├── helper_test.html │ │ ├── helper_test.js │ │ ├── websiteapi.js │ │ ├── websiteapi_test.html │ │ └── websiteapi_test.js │ ├── images │ │ ├── close.png │ │ ├── delete.png │ │ ├── download_item.png │ │ ├── editortoolbar.png │ │ ├── ic_launch.png │ │ ├── ic_more_vert.png │ │ ├── icon-128.png │ │ ├── icon-16.png │ │ ├── icon-48.png │ │ └── screenshot.png │ ├── launcher.js │ ├── launcher_test.html │ ├── launcher_test.js │ ├── messages.js │ ├── preferences.js │ ├── preferences_test.html │ ├── preferences_test.js │ ├── testingstubs.js │ ├── ui │ │ ├── dialogs │ │ │ ├── backupkey │ │ │ │ ├── backupkey.js │ │ │ │ ├── backupkey.soy │ │ │ │ ├── backupkey_test.html │ │ │ │ ├── backupkey_test.js │ │ │ │ └── restorekey.js │ │ │ ├── generic │ │ │ │ ├── generic.js │ │ │ │ ├── generic.soy │ │ │ │ ├── generic_test.html │ │ │ │ └── generic_test.js │ │ │ ├── importconfirmation │ │ │ │ ├── importconfirmation.css │ │ │ │ ├── importconfirmation.js │ │ │ │ ├── importconfirmation.soy │ │ │ │ ├── importconfirmation_test.html │ │ │ │ └── importconfirmation_test.js │ │ │ ├── inputtype.js │ │ │ └── overlay │ │ │ │ ├── dialog.css │ │ │ │ ├── overlay.js │ │ │ │ ├── overlay_test.html │ │ │ │ └── overlay_test.js │ │ ├── glass │ │ │ ├── bootstrap.js │ │ │ ├── glass.css │ │ │ ├── glass.html │ │ │ ├── glass.js │ │ │ ├── glass.soy │ │ │ ├── glass_test.html │ │ │ ├── glass_test.js │ │ │ ├── glasswrapper.js │ │ │ ├── glasswrapper_test.html │ │ │ └── glasswrapper_test.js │ │ ├── panels │ │ │ ├── chipholder │ │ │ │ ├── chip.js │ │ │ │ ├── chip_test.html │ │ │ │ ├── chip_test.js │ │ │ │ ├── chipholder.js │ │ │ │ ├── chipholder.soy │ │ │ │ ├── chipholder_test.html │ │ │ │ ├── chipholder_test.js │ │ │ │ ├── inputhandler.js │ │ │ │ ├── inputhandler_test.html │ │ │ │ └── inputhandler_test.js │ │ │ ├── generatekey │ │ │ │ ├── generatekey.js │ │ │ │ ├── generatekey.soy │ │ │ │ ├── generatekey_test.html │ │ │ │ └── generatekey_test.js │ │ │ ├── keyringmgmt │ │ │ │ ├── keyringmgmt.soy │ │ │ │ ├── keyringmgmtfull.js │ │ │ │ ├── keyringmgmtfull_test.html │ │ │ │ ├── keyringmgmtfull_test.js │ │ │ │ ├── keyringmgmtmini.js │ │ │ │ ├── keyringmgmtmini_test.html │ │ │ │ └── keyringmgmtmini_test.js │ │ │ ├── preferences │ │ │ │ ├── preferenceentry.js │ │ │ │ ├── preferenceentry_test.html │ │ │ │ ├── preferenceentry_test.js │ │ │ │ ├── preferences.soy │ │ │ │ ├── preferencespanel.js │ │ │ │ ├── preferencespanel_test.html │ │ │ │ └── preferencespanel_test.js │ │ │ └── prompt │ │ │ │ ├── decryptverify.js │ │ │ │ ├── decryptverify_test.html │ │ │ │ ├── decryptverify_test.js │ │ │ │ ├── encryptsign.js │ │ │ │ ├── encryptsign_test.html │ │ │ │ ├── encryptsign_test.js │ │ │ │ ├── importkey.js │ │ │ │ ├── importkey_test.html │ │ │ │ ├── importkey_test.js │ │ │ │ ├── panelbase.js │ │ │ │ ├── panelbase_test.html │ │ │ │ ├── panelbase_test.js │ │ │ │ └── prompt.soy │ │ ├── prompt │ │ │ ├── bootstrap.js │ │ │ ├── prompt.css │ │ │ ├── prompt.html │ │ │ ├── prompt.js │ │ │ ├── prompt.soy │ │ │ ├── prompt_test.html │ │ │ └── prompt_test.js │ │ ├── settings │ │ │ ├── bootstrap.js │ │ │ ├── settings.css │ │ │ ├── settings.html │ │ │ ├── settings.js │ │ │ ├── settings_test.html │ │ │ └── settings_test.js │ │ ├── styles │ │ │ └── base.css │ │ ├── templates.soy │ │ ├── webview │ │ │ ├── bootstrap.js │ │ │ ├── websitecontainer.js │ │ │ ├── websitecontainer_test.html │ │ │ ├── websitecontainer_test.js │ │ │ ├── webview.css │ │ │ ├── webview.html │ │ │ └── webview.soy │ │ └── welcome │ │ │ ├── bootstrap.js │ │ │ ├── welcome.css │ │ │ ├── welcome.html │ │ │ ├── welcome.js │ │ │ ├── welcome.soy │ │ │ ├── welcome_test.html │ │ │ └── welcome_test.js │ ├── utils │ │ ├── action.js │ │ ├── action_test.html │ │ ├── action_test.js │ │ ├── callbacksmap.js │ │ ├── callbacksmap_test.html │ │ ├── callbacksmap_test.js │ │ ├── chromestoragelocal.js │ │ ├── helperproxy.js │ │ ├── helperproxy_test.html │ │ ├── helperproxy_test.js │ │ ├── indexeddbstorage.js │ │ ├── text.js │ │ ├── text_test.html │ │ ├── text_test.js │ │ ├── utils.js │ │ ├── utils_test.html │ │ └── utils_test.js │ └── worker_bootstrap.js │ ├── hash │ ├── all.js │ ├── factory.js │ ├── hash.js │ ├── md5.js │ ├── sha1.js │ └── sha2.js │ ├── integration_test.html │ ├── kdf │ ├── hkdf.js │ └── hkdf_test.html │ ├── math │ ├── bignum.js │ ├── bignum_perf_test.html │ ├── bignum_test.html │ ├── bignum_testdata.js │ ├── bignummodulus.js │ ├── bignummodulus_test.html │ ├── bignumtester.js │ ├── bigprimenum.js │ ├── bigprimenum_test.html │ ├── fastmodulus.js │ ├── fastmodulus_test.html │ ├── fixedtiming.js │ └── fixedtiming_test.html │ ├── openpgp │ ├── aeskeywrap.js │ ├── aeskeywrap_test.html │ ├── aeskeywrap_testdata.js │ ├── asciiarmor.js │ ├── asciiarmor_test.html │ ├── block │ │ ├── all.js │ │ ├── armorable.js │ │ ├── block.js │ │ ├── compressed.js │ │ ├── encryptedmessage.js │ │ ├── factory.js │ │ ├── factory_test.html │ │ ├── keyparameter_test.html │ │ ├── literalmessage.js │ │ ├── message.js │ │ ├── transferablekey.js │ │ ├── transferablekey_test.html │ │ ├── transferablepublickey.js │ │ └── transferablesecretkey.js │ ├── bytestream.js │ ├── bytestream_test.html │ ├── clearsignmessage.js │ ├── compatibility_test.html │ ├── constants.js │ ├── context.js │ ├── context2.js │ ├── context2impl.js │ ├── context2impl_test.html │ ├── context2impl_test.js │ ├── contextimpl.js │ ├── contextimpl_perf_test.html │ ├── contextimpl_test.html │ ├── contextimpltester.js │ ├── contextservice.js │ ├── contextservice_test.html │ ├── encryptedcipher.js │ ├── encryptedcipher_test.html │ ├── error.js │ ├── keyclient.js │ ├── keyclient_test.html │ ├── keygenerator.js │ ├── keygenerator_perf_test.html │ ├── keygenerator_test.js │ ├── keyprovidercipher.js │ ├── keyprovidercipher_test.html │ ├── keyprovidercipher_test.js │ ├── keyring.js │ ├── keyring_test.html │ ├── lockablestorage.js │ ├── lockablestorage_test.html │ ├── managers │ │ ├── keymanager.js │ │ ├── simplekeymanager.js │ │ ├── simplekeymanager_test.html │ │ └── simplekeymanager_test.js │ ├── mpi.js │ ├── mpi_test.html │ ├── ocfb.js │ ├── ocfb_test.html │ ├── openpgp.js │ ├── packet │ │ ├── all.js │ │ ├── compressed.js │ │ ├── data.js │ │ ├── encrypteddata.js │ │ ├── encryptedsessionkey.js │ │ ├── factory.js │ │ ├── key.js │ │ ├── literaldata.js │ │ ├── literaldata_test.html │ │ ├── marker.js │ │ ├── onepasssignature.js │ │ ├── packet.js │ │ ├── packet_test.html │ │ ├── pkencryptedsessionkey.js │ │ ├── privateuse.js │ │ ├── privateuse_test.html │ │ ├── publickey.js │ │ ├── publickey_test.html │ │ ├── publicsubkey.js │ │ ├── secretkey.js │ │ ├── secretkey_test.html │ │ ├── secretkeyinterface.js │ │ ├── secretsubkey.js │ │ ├── signature.js │ │ ├── signature_test.html │ │ ├── signaturesub.js │ │ ├── surrogatesecretkey.js │ │ ├── surrogatesecretkey_test.html │ │ ├── surrogatesecretkey_test.js │ │ ├── symmetricallyencrypteddata.js │ │ ├── symmetricallyencrypteddata_test.html │ │ ├── symmetrickey.js │ │ ├── trust.js │ │ ├── userattribute.js │ │ ├── userid.js │ │ └── userid_test.html │ ├── parse.js │ ├── parse_test.html │ ├── pgpmime │ │ ├── constants.js │ │ ├── mimenode.js │ │ ├── mimenode_test.html │ │ ├── mimenode_test.js │ │ ├── pgpmail.js │ │ ├── pgpmail_test.html │ │ ├── pgpmail_test.js │ │ ├── testingstubs.js │ │ ├── text.js │ │ ├── text_test.html │ │ ├── text_test.js │ │ ├── types.js │ │ ├── utils.js │ │ ├── utils_test.html │ │ └── utils_test.js │ ├── providers │ │ ├── dualkeyprovider.js │ │ ├── hkpkeyprovider.js │ │ ├── hkpkeyprovider_test.html │ │ ├── hkpkeyprovider_test.js │ │ ├── keyprovider.js │ │ ├── keyringkeyprovider.js │ │ ├── keyringkeyprovider_test.html │ │ ├── keyringkeyprovider_test.js │ │ ├── publickeyprovider.js │ │ └── secretkeyprovider.js │ ├── s2k.js │ ├── s2k_test.html │ ├── scheme │ │ └── ecdh.js │ ├── types.js │ ├── workercontextimpl.js │ └── workercontextimpl_test.html │ ├── otr │ ├── constants.js │ ├── context.js │ ├── contextimpl.js │ ├── contextimpl_test.html │ ├── data.js │ ├── data_test.html │ ├── error.js │ ├── integration_test.html │ ├── keymanager.js │ ├── message │ │ ├── data.js │ │ ├── dhcommit.js │ │ ├── dhcommit_test.html │ │ ├── dhkey.js │ │ ├── dhkey_test.html │ │ ├── encoded.js │ │ ├── encoded_test.html │ │ ├── handler.js │ │ ├── handler_test.html │ │ ├── message.js │ │ ├── query.js │ │ ├── query_test.html │ │ ├── revealsignature.js │ │ ├── signature.js │ │ └── tlv.js │ ├── mpi.js │ ├── mpi_test.html │ ├── otr.js │ ├── otr_test.html │ ├── pubkey.js │ ├── pubkey_dsa.js │ ├── pubkey_test.html │ ├── serializable.js │ ├── session.js │ ├── session_test.html │ ├── sig.js │ ├── storable.js │ ├── testing.js │ ├── types.js │ └── util │ │ ├── aes128ctr.js │ │ ├── iterator.js │ │ ├── iterator_test.html │ │ ├── tee.js │ │ └── tee_test.html │ ├── pkcs │ ├── eme.js │ ├── eme_test.html │ ├── emsa.js │ ├── emsa_test.html │ └── pkcs.js │ ├── random │ ├── hmacprf.js │ ├── hmacprf_test.html │ ├── random.js │ └── random_test.html │ ├── scheme │ ├── ec_perf_test.html │ ├── ecdh.js │ ├── ecdh_test.html │ ├── ecdsa.js │ ├── ecdsa_test.html │ ├── eme.js │ ├── rsa_sign.js │ ├── rsaes.js │ ├── rsaes_test.html │ └── scheme.js │ ├── symmetric │ ├── aes.js │ ├── aes_test.html │ ├── blowfish.js │ ├── blowfish_test.html │ ├── cast5.js │ ├── cast5_test.html │ ├── des.js │ ├── des_test.html │ ├── idea.js │ └── idea_test.html │ ├── testing │ ├── util.js │ ├── util_test.html │ └── util_test.js │ └── transparency │ ├── commitment.js │ ├── commitment_test.js │ ├── merkle.js │ ├── merkle_test.js │ ├── vrf.js │ └── vrf_test.js └── test_server.py /.gitignore: -------------------------------------------------------------------------------- 1 | build/* 2 | docs/* 3 | node_modules/* 4 | lib/closure-templates-compiler/* 5 | lib/typedarray/* 6 | src/javascript/crypto/e2e/compatibility_tests/drivers/bc/lib/* 7 | src/javascript/crypto/e2e/compatibility_tests/drivers/bc/build/* 8 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lib/zlib.js"] 2 | path = lib/zlib.js 3 | url = https://github.com/imaya/zlib.js 4 | branch = b99bd33d485d63e93310b911a1f8dbf9ceb265d5 5 | [submodule "lib/closure-compiler"] 6 | path = lib/closure-compiler 7 | url = https://github.com/google/closure-compiler 8 | branch = maven-release-v20150315 9 | [submodule "lib/closure-library"] 10 | path = lib/closure-library 11 | url = https://github.com/google/closure-library 12 | branch = 35c9311042b95796d7b12f58cd2bec6086052f7e 13 | [submodule "lib/closure-stylesheets"] 14 | path = lib/closure-stylesheets 15 | url = https://github.com/google/closure-stylesheets 16 | branch = fd1095b9a5e84a9a6a9c00cf24949cabe33478b6 17 | [submodule "lib/js-dossier"] 18 | path = lib/js-dossier 19 | url = https://github.com/jleyba/js-dossier 20 | [submodule "src/javascript/crypto/e2e/compatibility_tests/openpgp-interop"] 21 | path = src/javascript/crypto/e2e/compatibility_tests/openpgp-interop 22 | url = https://github.com/google/openpgp-interop 23 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | env: 4 | global: 5 | - NODEJS_VERSION=0.10 6 | - NODEJS_CMD=node 7 | 8 | install: 9 | - export PATH=$HOME/.local/bin:$PATH 10 | - pip install --user six 11 | - pip install --user git+https://github.com/google/closure-linter.git 12 | - nvm install ${NODEJS_VERSION} && nvm alias default ${NODEJS_VERSION} 13 | - ./do.sh install_deps 14 | 15 | script: 16 | - ./do.sh lint 17 | - ./do.sh build_app debug 18 | - ./do.sh test_compat_e2e 19 | - ./do.sh test_compat_bc 20 | - ./do.sh clean 21 | - ./do.sh build_extension debug 22 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of End-To-End authors for copyright purposes. 2 | # This file is distinct from the CONTRIBUTORS files. 3 | # See the latter for an explanation. 4 | 5 | # Names should be added to this file as: 6 | # Name or Organization 7 | # The email address is not required for organizations. 8 | 9 | Google Inc. 10 | Yahoo! Inc. 11 | 12 | David Leon Gil 13 | Dominic Hamon 14 | KB Sriram 15 | Ryan Chan 16 | -------------------------------------------------------------------------------- /CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # People who have agreed to one of the CLAs and can contribute patches. 2 | # The AUTHORS file lists the copyright holders; this file 3 | # lists people. For example, Google employees are listed here 4 | # but not in AUTHORS, because Google holds the copyright. 5 | # 6 | # https://developers.google.com/open-source/cla/individual 7 | # https://developers.google.com/open-source/cla/corporate 8 | # 9 | # Names should be added to this file as: 10 | # Name 11 | 12 | David Leon Gil 13 | Dominic Hamon 14 | Drew Hintz 15 | Eduardo Vela Nava 16 | Frank Yellin 17 | KB Sriram 18 | Krzysztof Kotowicz 19 | Quan Nguyen 20 | Radoslav Vasilev 21 | Ryan Chan 22 | Ryan Chan 23 | Thai Duong 24 | Yan Zhu 25 | -------------------------------------------------------------------------------- /Copybara: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Google Inc. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | /** 15 | * @fileoverview Gruntfile for building End-To-End targets 16 | * 17 | * @author koto@google.com (Krzysztof Kotowicz) 18 | */ 19 | module.exports = function(grunt) { 20 | grunt.initConfig({ 21 | shell: { 22 | doScript: { 23 | options: {}, 24 | command: function(target) { 25 | if (target.match(/^[-a-z_]+$/)) { 26 | return 'bash ./do.sh ' + target; 27 | } 28 | } 29 | } 30 | } 31 | }); 32 | 33 | grunt.loadNpmTasks('grunt-shell'); 34 | 35 | grunt.registerTask('build-extension', [ 36 | 'shell:doScript:build_extension' 37 | ]); 38 | 39 | grunt.registerTask('build-library', [ 40 | 'shell:doScript:build_library' 41 | ]); 42 | 43 | grunt.registerTask('build-templates', [ 44 | 'shell:doScript:build_templates' 45 | ]); 46 | 47 | grunt.registerTask('check-deps', [ 48 | 'shell:doScript:check_deps' 49 | ]); 50 | 51 | grunt.registerTask('install-deps', [ 52 | 'shell:doScript:install_deps' 53 | ]); 54 | 55 | grunt.registerTask('clean', [ 56 | 'shell:doScript:clean' 57 | ]); 58 | 59 | grunt.registerTask('update', [ 60 | 'shell:doScript:update' 61 | ]); 62 | 63 | grunt.registerTask('testserver', [ 64 | 'shell:doScript:testserver' 65 | ]); 66 | 67 | grunt.registerTask('lint', [ 68 | 'shell:doScript:lint' 69 | ]); 70 | 71 | grunt.registerTask('default', [ 72 | 'build-extension' 73 | ]); 74 | }; 75 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | End-To-End 2 | ========== 3 | 4 | ![Travis Build](https://travis-ci.org/google/end-to-end.svg "End to End Travis Build") 5 | 6 | End-To-End is a crypto library to encrypt, decrypt, digital sign, and verify signed messages (implementing OpenPGP and OTR). 7 | 8 | This is the source code for the End-To-End library. It's built upon a newly developed, JavaScript-based crypto library. End-To-End implements the OpenPGP standard, IETF RFC 4880, enabling key generation, encryption, decryption, digital signature, and signature verification. 9 | 10 | We're releasing this library to enable community review. 11 | 12 | For more background, please see [our blog post](http://googleonlinesecurity.blogspot.com/2014/06/making-end-to-end-encryption-easier-to.html). 13 | 14 | Documentation for the project is stored in our [Wiki](https://github.com/google/end-to-end/wiki/). If you're planning to contribute to the project, check out our [Contributor guide](CONTRIBUTING.md). 15 | 16 | A few projects have been built on top of this library, to list a few: 17 | - [E2EMail](https://github.com/e2email-org/e2email) - A Gmail client that exchanges OpenPGP mail. 18 | - [Freedom JS](https://github.com/freedomjs/freedom-pgp-e2e) - A framework for building peer-to-peer (P2P) web apps. 19 | - [uProxy](https://github.com/uProxy/uproxy) - A browser extension that lets users share their internet connection. 20 | - [Google End-to-End Extension](https://github.com/google/end-to-end/tree/master/src/javascript/crypto/e2e/extension) - Google End-to-End Chrome Extension (not ready for general use). 21 | - [Yahoo End-to-End Extension](https://github.com/yahoo/end-to-end) - A fork of Google's End-to-End for Yahoo mail. 22 | -------------------------------------------------------------------------------- /compiler.flags: -------------------------------------------------------------------------------- 1 | --language_in=ECMASCRIPT5 2 | --jscomp_error=accessControls 3 | --jscomp_error=ambiguousFunctionDecl 4 | --jscomp_error=checkDebuggerStatement 5 | --jscomp_error=checkEventfulObjectDisposal 6 | --jscomp_error=checkRegExp 7 | --jscomp_error=checkTypes 8 | --jscomp_error=checkVars 9 | --jscomp_error=const 10 | --jscomp_error=constantProperty 11 | --jscomp_error=duplicate 12 | --jscomp_error=duplicateMessage 13 | --jscomp_error=es5Strict 14 | --jscomp_error=es3 15 | --jscomp_error=externsValidation 16 | --jscomp_error=fileoverviewTags 17 | --jscomp_error=globalThis 18 | --jscomp_error=internetExplorerChecks 19 | --jscomp_error=invalidCasts 20 | --jscomp_error=missingProperties 21 | --jscomp_error=nonStandardJsDocs 22 | --jscomp_error=strictModuleDepCheck 23 | --jscomp_error=undefinedNames 24 | --jscomp_error=undefinedVars 25 | --jscomp_error=unknownDefines 26 | --jscomp_error=uselessCode 27 | --jscomp_error=visibility 28 | --jscomp_warning=deprecated 29 | --externs=lib/closure-compiler/contrib/externs/chrome_extensions.js 30 | --only_closure_dependencies 31 | --manage_closure_dependencies 32 | --js build/deps.js 33 | -------------------------------------------------------------------------------- /lib/docs-build/dossier-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "output": "docs/api/", 3 | "sources": ["src/javascript/crypto/e2e", "build/templates", "lib/closure-templates-compiler/soyutils_usegoog.js","lib/docs-build/zlib_externs.js"], 4 | "externs" : ["lib/closure-compiler/contrib/externs/chrome_extensions.js"], 5 | "closureLibraryDir": "lib/closure-library/closure/goog/", 6 | "excludes": [ 7 | "src/**_test.js", 8 | "src/javascript/crypto/e2e/compatibility_tests/**" 9 | ], 10 | "typeFilters": [ 11 | "^goog", 12 | "^soy", 13 | "^soydata" 14 | ], 15 | "readme": "README.md" 16 | } 17 | -------------------------------------------------------------------------------- /lib/docs-build/zlib_externs.js: -------------------------------------------------------------------------------- 1 | // Zlib.js deps files are confusing js-dossier. These one are fixed. 2 | goog.provide('Zlib'); 3 | goog.provide('Zlib.Deflate'); 4 | goog.provide('Zlib.Inflate'); 5 | goog.provide('Zlib.RawInflate'); 6 | goog.provide('Zlib.RawDeflate'); 7 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "end-to-end", 3 | "devDependencies": { 4 | "grunt": "^0.4.5", 5 | "grunt-shell": "^0.7.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/algorithm/all_ciphers.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2013 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Requires all ciphers to load them all into the factory. 19 | */ 20 | goog.provide('e2e.cipher.all'); 21 | 22 | /** @suppress {extraRequire} intentional import */ 23 | goog.require('e2e.cipher.Aes'); 24 | /** @suppress {extraRequire} intentional import */ 25 | goog.require('e2e.cipher.Blowfish'); 26 | /** @suppress {extraRequire} intentional import */ 27 | goog.require('e2e.cipher.Cast5'); 28 | /** @suppress {extraRequire} intentional import */ 29 | goog.require('e2e.cipher.Des'); 30 | /** @suppress {extraRequire} intentional import */ 31 | goog.require('e2e.cipher.Ecdh'); 32 | /** @suppress {extraRequire} intentional import */ 33 | goog.require('e2e.cipher.ElGamal'); 34 | /** @suppress {extraRequire} intentional import */ 35 | goog.require('e2e.cipher.Idea'); 36 | /** @suppress {extraRequire} intentional import */ 37 | goog.require('e2e.cipher.Rsa'); 38 | /** @suppress {extraRequire} intentional import */ 39 | goog.require('e2e.cipher.RsaEncrypt'); 40 | /** @suppress {extraRequire} intentional import */ 41 | goog.require('e2e.cipher.TripleDes'); 42 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/algorithm/all_signers.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2013 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Requires all signers to load them into the factory. 19 | */ 20 | 21 | goog.provide('e2e.signer.all'); 22 | 23 | /** @suppress {extraRequire} intentional import */ 24 | goog.require('e2e.signer.Dsa'); 25 | /** @suppress {extraRequire} intentional import */ 26 | goog.require('e2e.signer.Ecdsa'); 27 | /** @suppress {extraRequire} intentional import */ 28 | goog.require('e2e.signer.RsaSign'); 29 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/algorithm/signature.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Provides the type definitions of signatures. 19 | */ 20 | 21 | goog.provide('e2e.signer.signature.Signature'); 22 | goog.provide('e2e.signer.signature.SignatureAsync'); 23 | 24 | 25 | /** 26 | * @typedef {?{s: !e2e.ByteArray, r:(!e2e.ByteArray|undefined), 27 | * hashValue: (!e2e.ByteArray|undefined)}} 28 | */ 29 | e2e.signer.signature.Signature; 30 | 31 | 32 | /** 33 | * @typedef {e2e.async.Result.} 34 | */ 35 | e2e.signer.signature.SignatureAsync; 36 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/asymmetric/rsa_sign.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2013 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Extension of textbook RSA cipher, but restricted to 19 | * sign/verify operations. 20 | */ 21 | 22 | goog.provide('e2e.signer.RsaSign'); 23 | 24 | goog.require('e2e.cipher.Rsa'); 25 | goog.require('e2e.signer.Algorithm'); 26 | goog.require('e2e.signer.Error'); 27 | goog.require('e2e.signer.Signer'); 28 | goog.require('e2e.signer.factory'); 29 | goog.require('goog.asserts'); 30 | 31 | 32 | 33 | /** 34 | * Representation of an RSA public and/or private key, but 35 | * restricted to signing operations. 36 | * @param {e2e.signer.Algorithm} algorithm The algorithm to retrieve. 37 | * @param {e2e.signer.key.Key=} opt_key The public or private key. 38 | * @constructor 39 | * @implements {e2e.signer.Signer} 40 | * @extends {e2e.cipher.Rsa} 41 | */ 42 | e2e.signer.RsaSign = function(algorithm, opt_key) { 43 | goog.asserts.assert(algorithm == e2e.signer.Algorithm.RSA_SIGN, 44 | 'Algorithm should be RSA_SIGN.'); 45 | e2e.signer.RsaSign.base(this, 'constructor', algorithm, opt_key); 46 | }; 47 | goog.inherits(e2e.signer.RsaSign, e2e.cipher.Rsa); 48 | 49 | 50 | /** @override */ 51 | e2e.signer.RsaSign.prototype.encrypt = function(data) { 52 | throw new e2e.signer.Error('Cannot encrypt with this key.'); 53 | }; 54 | 55 | 56 | /** @override */ 57 | e2e.signer.RsaSign.prototype.decrypt = function(data) { 58 | throw new e2e.signer.Error('Cannot decrypt with this key.'); 59 | }; 60 | 61 | 62 | e2e.signer.factory.add(e2e.signer.RsaSign, e2e.signer.Algorithm.RSA_SIGN); 63 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/async/async.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2012 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | /** 19 | * @fileoverview Defines general purpose utilities for async communication. 20 | * @author evn@google.com (Eduardo Vela) 21 | */ 22 | 23 | goog.provide('e2e.async.Bid'); 24 | goog.provide('e2e.async.BidResponse'); 25 | goog.provide('e2e.async.ServiceLookupResponse'); 26 | goog.provide('e2e.async.ServiceLookupResponseResult'); 27 | 28 | 29 | /** 30 | * Holds service-specific requirements to the service at discovery time. 31 | * @typedef {Object} 32 | */ 33 | e2e.async.Bid; 34 | 35 | 36 | /** 37 | * Holds service-specific response to the client at discovery time. 38 | * @typedef {Object} 39 | */ 40 | e2e.async.BidResponse; 41 | 42 | 43 | /** 44 | * Holds service response to the client at discovery time. 45 | * @typedef {{port: !MessagePort, response: !e2e.async.BidResponse}} 46 | */ 47 | e2e.async.ServiceLookupResponse; 48 | 49 | 50 | /** 51 | * Holds an asynchronous result of a service discovery. 52 | * @typedef {!e2e.async.Result.} 53 | */ 54 | e2e.async.ServiceLookupResponseResult; 55 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/async/asyncrespondingchannel_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | e2e.messaging.AsyncRespondingChannelTest 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/async/childpeer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2012 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | /** 19 | * @fileoverview Converts a Window or a Worker to a Peer. 20 | * @author evn@google.com (Eduardo Vela) 21 | */ 22 | 23 | goog.provide('e2e.async.ChildPeer'); 24 | 25 | goog.require('e2e.async.Peer'); 26 | 27 | 28 | 29 | /** 30 | * Class to represent a peer as a descendant of the current scope. 31 | * @extends {e2e.async.Peer} 32 | * @constructor 33 | */ 34 | e2e.async.ChildPeer = function() { 35 | e2e.async.ChildPeer.base(this, 'constructor'); 36 | }; 37 | goog.inherits(e2e.async.ChildPeer, e2e.async.Peer); 38 | 39 | 40 | /** 41 | * Create a new port. 42 | * @return {!MessagePort} 43 | */ 44 | e2e.async.ChildPeer.prototype.createPort = function() { 45 | var mc = new MessageChannel(); 46 | // port1/port2 are entangled, what is sent to port1 comes out on port2. 47 | this.addPort(mc.port1); 48 | return mc.port2; 49 | }; 50 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/async/foreignpeer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2012 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | /** 19 | * @fileoverview A Foreign Peer is a peer that has ports it didn't create. 20 | * @author evn@google.com (Eduardo Vela) 21 | */ 22 | goog.provide('e2e.async.ForeignPeer'); 23 | 24 | goog.require('e2e.async.Peer'); 25 | 26 | 27 | 28 | /** 29 | * Class to represent a peer outside of the current scope. 30 | * @param {Window} self Target to use for getting ports. 31 | * @extends {e2e.async.Peer} 32 | * @constructor 33 | */ 34 | e2e.async.ForeignPeer = function(self) { 35 | e2e.async.ForeignPeer.base(this, 'constructor'); 36 | this.self_ = self; 37 | }; 38 | goog.inherits(e2e.async.ForeignPeer, e2e.async.Peer); 39 | 40 | 41 | /** @override */ 42 | e2e.async.ForeignPeer.prototype.init = function() { 43 | this.self_.onmessage = goog.bind(function(e) { 44 | if (e.data == e2e.async.Peer.Message.INIT && 45 | this.validateMessage(e)) { 46 | var newPort = e.ports[0]; 47 | this.addPort(newPort); 48 | } 49 | }, this); 50 | }; 51 | 52 | 53 | /** 54 | * Validates that a given message is acceptable to use to register a port. 55 | * @param {MessageEvent.<*>} e The event to validate. 56 | * @return {boolean} Whether it's ok to add it as port. 57 | */ 58 | e2e.async.ForeignPeer.prototype.validateMessage = goog.abstractMethod; 59 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/async/frame.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | /** 19 | * @fileoverview A Frame defined as a Peer. 20 | * @author evn@google.com (Eduardo Vela) 21 | */ 22 | 23 | goog.provide('e2e.async.Frame'); 24 | 25 | goog.require('e2e.async.ForeignPeer'); 26 | 27 | 28 | 29 | /** 30 | * Used to represent a frame as a peer. 31 | * @param {Window} frame The frame to register as a peer. 32 | * @extends {e2e.async.ForeignPeer} 33 | * @constructor 34 | */ 35 | e2e.async.Frame = function(frame) { 36 | this.frame_ = frame; 37 | e2e.async.Frame.base(this, 'constructor', goog.global); 38 | }; 39 | goog.inherits(e2e.async.Frame, e2e.async.ForeignPeer); 40 | 41 | 42 | /** @inheritDoc */ 43 | e2e.async.Frame.prototype.validateMessage = function(e) { 44 | return e.source == this.frame_; 45 | }; 46 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/async/frameself.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview A Frame Peer from the frame's perspective. 19 | */ 20 | 21 | goog.provide('e2e.async.FrameSelf'); 22 | 23 | goog.require('e2e.async.ChildPeer'); 24 | goog.require('e2e.async.Peer'); 25 | 26 | 27 | 28 | /** 29 | * Used to represent a current window as a framed-peer. 30 | * @param {Window} parent The parent of this peer. 31 | * @param {string=} opt_parentOrigin The origin of the parent. 32 | * @extends {e2e.async.ChildPeer} 33 | * @constructor 34 | */ 35 | e2e.async.FrameSelf = function(parent, opt_parentOrigin) { 36 | e2e.async.FrameSelf.base(this, 'constructor'); 37 | this.parent_ = parent; 38 | this.parentOrigin_ = opt_parentOrigin; 39 | }; 40 | goog.inherits(e2e.async.FrameSelf, e2e.async.ChildPeer); 41 | 42 | 43 | /** @override */ 44 | e2e.async.FrameSelf.prototype.init = function() { 45 | var port = this.createPort(); 46 | var origin = this.parentOrigin_ || '*'; 47 | this.parent_.postMessage(e2e.async.Peer.Message.INIT, origin, [port]); 48 | }; 49 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/async/peer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2012 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | /** 19 | * @fileoverview A Peer is a part of a group of peers that wish to communicate. 20 | * @author evn@google.com (Eduardo Vela) 21 | */ 22 | 23 | goog.provide('e2e.async.Peer'); 24 | goog.provide('e2e.async.Peer.Message'); 25 | 26 | goog.require('e2e.async.Broker'); 27 | 28 | 29 | 30 | /** 31 | * A peer among other things, handles the communication among a group of peers. 32 | * @extends {e2e.async.Broker} 33 | * @constructor 34 | */ 35 | e2e.async.Peer = function() { 36 | e2e.async.Peer.base(this, 'constructor', []); 37 | }; 38 | goog.inherits(e2e.async.Peer, e2e.async.Broker); 39 | 40 | 41 | /** 42 | * Messages used by Peers. 43 | * @enum {string} 44 | */ 45 | e2e.async.Peer.Message = { 46 | 'INIT': 'INIT' 47 | }; 48 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/async/router.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Implements service discovery as broadcast in a star network. 19 | */ 20 | 21 | goog.provide('e2e.async.Router'); 22 | 23 | goog.require('e2e.async.Broker'); 24 | goog.require('goog.array'); 25 | 26 | 27 | 28 | /** 29 | * Establishes connections between nodes and helps perform discovery. 30 | * @constructor 31 | * @extends {e2e.async.Broker} 32 | */ 33 | e2e.async.Router = function() { 34 | e2e.async.Router.base(this, 'constructor', []); 35 | }; 36 | goog.inherits(e2e.async.Router, e2e.async.Broker); 37 | 38 | 39 | /** @override */ 40 | e2e.async.Router.prototype.createServices = function(name, bid, port) { 41 | goog.array.forEach(this.findServices(name, bid), function(result) { 42 | result.addCallbacks(function(response) { 43 | this.respondBid(port, response.response, response.port); 44 | }, 45 | goog.bind(this.respondBidError, this, port), 46 | this); 47 | }, this); 48 | this.findService(name, bid); 49 | }; 50 | 51 | 52 | /** 53 | * @define {string} Path to the router worker. 54 | */ 55 | e2e.async.Router.PATH = ''; 56 | 57 | 58 | /** 59 | * Initiates the network. 60 | */ 61 | e2e.async.Router.init = function() { 62 | var router = new e2e.async.Router; 63 | self.onconnect = function(e) { 64 | router.addPort(e.ports[0]); 65 | }; 66 | }; 67 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/async/sharedworker.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview A SharedWorker defined as a Peer. 19 | */ 20 | 21 | goog.provide('e2e.async.SharedWorker'); 22 | 23 | goog.require('e2e.async.ChildPeer'); 24 | 25 | 26 | 27 | /** 28 | * Used to represent a shared worker as a peer. 29 | * @param {string} path The path to the code to run as a SharedWorker. 30 | * @extends {e2e.async.ChildPeer} 31 | * @constructor 32 | */ 33 | e2e.async.SharedWorker = function(path) { 34 | e2e.async.SharedWorker.base(this, 'constructor'); 35 | this.path_ = path; 36 | }; 37 | goog.inherits(e2e.async.SharedWorker, e2e.async.ChildPeer); 38 | 39 | 40 | /** @override */ 41 | e2e.async.SharedWorker.prototype.init = function() { 42 | this.sharedWorker_ = new SharedWorker(this.path_); 43 | this.addPort(this.sharedWorker_.port); 44 | }; 45 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/async/worker.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2012 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | /** 19 | * @fileoverview A Worker defined as a Peer. 20 | * @author evn@google.com (Eduardo Vela) 21 | */ 22 | 23 | goog.provide('e2e.async.Worker'); 24 | 25 | goog.require('e2e.async.ChildPeer'); 26 | goog.require('e2e.async.Peer'); 27 | 28 | 29 | 30 | /** 31 | * Used to represent a worker as a peer. 32 | * @param {string} path The path to the code to run as Worker. 33 | * @extends {e2e.async.ChildPeer} 34 | * @constructor 35 | */ 36 | e2e.async.Worker = function(path) { 37 | e2e.async.Worker.base(this, 'constructor'); 38 | this.path_ = path; 39 | }; 40 | goog.inherits(e2e.async.Worker, e2e.async.ChildPeer); 41 | 42 | 43 | /** @override */ 44 | e2e.async.Worker.prototype.init = function() { 45 | this.worker_ = new Worker(this.path_); 46 | var port = this.createPort(); 47 | this.worker_.postMessage(e2e.async.Peer.Message.INIT, [port]); 48 | }; 49 | 50 | 51 | /** 52 | * Destroys the worker. New messages won't work anymore. 53 | */ 54 | e2e.async.Worker.prototype.destroy = function() { 55 | this.worker_.terminate(); 56 | }; 57 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/async/worker_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | Unit Test of e2e.async.Worker 17 | 18 | 19 | 26 | 50 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/async/workerself.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2012 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | /** 19 | * @fileoverview Represent a Worker from the Worker's perspective. 20 | * @author evn@google.com (Eduardo Vela) 21 | */ 22 | 23 | goog.provide('e2e.async.WorkerSelf'); 24 | 25 | goog.require('e2e.async.ForeignPeer'); 26 | 27 | 28 | 29 | /** 30 | * Class used to represent a worker's own global scope as a foreign peer. 31 | * @extends {e2e.async.ForeignPeer} 32 | * @constructor 33 | */ 34 | e2e.async.WorkerSelf = function() { 35 | e2e.async.WorkerSelf.base(this, 'constructor', self); 36 | }; 37 | goog.inherits(e2e.async.WorkerSelf, e2e.async.ForeignPeer); 38 | 39 | 40 | /** @inheritDoc */ 41 | e2e.async.WorkerSelf.prototype.validateMessage = function(e) { 42 | // A worker can only be invoked by same-origin principals. 43 | return true; 44 | }; 45 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/ciphermode/pkcs7_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | Unit Test of e2e.CipherMode.Pkcs7 17 | 18 | 19 | 23 | 44 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/compatibility_tests/README.md: -------------------------------------------------------------------------------- 1 | # OpenPGP interoperability tests driver 2 | 3 | This directory contains a driver (a nodejs script) which runs the end-to-end 4 | library against the 5 | [OpenPGP interoperability tests](https://github.com/google/openpgp-interop). 6 | 7 | The easiest way to run these tests is to use the [do.sh](../../../../../do.sh) 8 | script as 9 | ``` 10 | $ do.sh test_compat_e2e 11 | ``` 12 | 13 | This will fetch the interoperability test cases if needed, build the library and 14 | run the driver against the test cases. 15 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/compatibility_tests/drivers/bc/build.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/compatibility_tests/drivers/bc/download-libs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2015 Google Inc. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | type sha1sum >/dev/null 2>&1 || { 17 | echo >&2 "sha1sum is needed to verify download dependencies." 18 | exit 1 19 | } 20 | 21 | download() { 22 | if [ ! -f "$2" ]; then 23 | curl -sSL "$1" -o "$2" || { 24 | echo >&2 "Failed to download $1" 25 | exit 1 26 | } 27 | fi 28 | } 29 | 30 | verify() { 31 | actual=$(sha1sum "$1" | awk '{print $1}') 32 | 33 | if [ "$actual" != "$2" ]; then 34 | rm -f "$1" 35 | echo >&2 "Invalid checksum after downloading $1" 36 | exit 1 37 | fi 38 | } 39 | 40 | ensure() { 41 | info=(${2//:/ }) 42 | file="${info[0]}" 43 | sha="${info[1]}" 44 | 45 | download "$1/$file" "lib/$file" 46 | verify "lib/$file" "$sha" 47 | } 48 | 49 | cd ${0%/*} 50 | 51 | if [ ! -d lib ]; then 52 | mkdir lib 53 | fi 54 | 55 | bclibs=(\ 56 | bcpg-jdk15on-161.jar:422656435514ab8a28752b117d5d2646660a0ace \ 57 | bcprov-jdk15on-161.jar:00df4b474e71be02c1349c3292d98886f888d1f7) 58 | 59 | for lib in "${bclibs[@]}"; do 60 | ensure "http://www.bouncycastle.org/download" $lib 61 | done 62 | 63 | ensure \ 64 | "http://central.maven.org/maven2/com/google/code/gson/gson/2.3.1" \ 65 | "gson-2.3.1.jar:ecb6e1f8e4b0e84c4b886c2f14a1500caf309757" 66 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/compression/all.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2013 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Requires all compression algorithms to load them into the 19 | * factory. 20 | */ 21 | goog.provide('e2e.compression.all'); 22 | 23 | /** @suppress {extraRequire} intentional import */ 24 | goog.require('e2e.compression.Bzip2'); 25 | /** @suppress {extraRequire} intentional import */ 26 | goog.require('e2e.compression.Zip'); 27 | /** @suppress {extraRequire} intentional import */ 28 | goog.require('e2e.compression.Zlib'); 29 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/compression/zlib_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | Unit Test of e2e.cryptcompression.Zlib 17 | 18 | 19 | 25 | 42 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/ecc/ecc_perf_test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | ECC Performance Tests 14 | 15 | 16 | 21 | 22 | 23 | 24 |

ECC Performance tests

25 |

26 | User-agent: 27 | 28 |

29 | 30 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/ecc/ed25519_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | Unit Test of e2e.ecc.Ecdsa 17 | 18 | 19 | 26 | 55 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/error.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2013 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview All error types that the ECC module can throw. 19 | */ 20 | 21 | goog.provide('e2e.error.Error'); 22 | goog.provide('e2e.error.InvalidArgumentsError'); 23 | goog.provide('e2e.error.UnsupportedError'); 24 | 25 | goog.require('goog.debug.Error'); 26 | 27 | 28 | 29 | /** 30 | * The base class for crypto errors. 31 | * @param {*=} opt_msg The custom error message. 32 | * @constructor 33 | * @extends {goog.debug.Error} 34 | */ 35 | e2e.error.Error = function(opt_msg) { 36 | e2e.error.Error.base(this, 'constructor', opt_msg); 37 | }; 38 | goog.inherits(e2e.error.Error, goog.debug.Error); 39 | 40 | 41 | 42 | /** 43 | * Exception used when a function receives an invalid argument. 44 | * @param {string} message The message with the error details. 45 | * @constructor 46 | * @extends {e2e.error.Error} 47 | */ 48 | e2e.error.InvalidArgumentsError = function(message) { 49 | e2e.error.InvalidArgumentsError.base(this, 'constructor', message); 50 | }; 51 | goog.inherits(e2e.error.InvalidArgumentsError, 52 | e2e.error.Error); 53 | 54 | 55 | 56 | /** 57 | * Exception used when the client requests an unimplemented feature. 58 | * @param {string} message The message with the error details. 59 | * @constructor 60 | * @extends {e2e.error.Error} 61 | */ 62 | e2e.error.UnsupportedError = function(message) { 63 | e2e.error.UnsupportedError.base(this, 'constructor', message); 64 | }; 65 | goog.inherits(e2e.error.UnsupportedError, 66 | e2e.error.Error); 67 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/actions/action.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Defines the common characteristics of an End-to-End action. 19 | */ 20 | 21 | goog.provide('e2e.ext.actions.Action'); 22 | 23 | goog.requireType('e2e.openpgp.ContextImpl'); 24 | goog.requireType('goog.ui.Component'); 25 | /** @suppress {extraRequire} manually import typedefs due to b/15739810 */ 26 | goog.require('e2e.ext.messages.ApiRequest'); 27 | 28 | goog.scope(function() { 29 | var actions = e2e.ext.actions; 30 | 31 | 32 | 33 | /** 34 | * Interface that defines the common characteristics of an End-to-End action. 35 | * @interface 36 | * @template REQUEST_CONTENT, RESPONSE_CONTENT 37 | */ 38 | actions.Action = function() {}; 39 | 40 | 41 | /** 42 | * Executes the action. 43 | * @param {!e2e.openpgp.ContextImpl} ctx A PGP context that can be used to 44 | * complete the action. 45 | * @param {!e2e.ext.messages.ApiRequest.} request The content 46 | * with which the action is to be executed. 47 | * @param {!goog.ui.Component} requestor The UI component through which the 48 | * action was invoked. 49 | * @param {function(RESPONSE_CONTENT)} callback A callback where successful 50 | * results will be passed to. 51 | * @param {function(Error)} errorCallback A callback where errors will be 52 | * passed to. 53 | */ 54 | actions.Action.prototype.execute; 55 | 56 | }); // goog.scope 57 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/actions/decryptverify_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.actions.DecryptVerify 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/actions/encryptsign_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.actions.EncryptSign 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/actions/executor_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.actions.Executor 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/actions/getkeydescription_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.actions.GetKeyDescription 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/actions/getkeyringbackupdata.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Retrieves the data needed to back up generated ECC keys. 19 | */ 20 | 21 | goog.provide('e2e.ext.actions.GetKeyringBackupData'); 22 | 23 | goog.require('e2e.ext.actions.Action'); 24 | 25 | 26 | goog.scope(function() { 27 | var actions = e2e.ext.actions; 28 | 29 | 30 | 31 | /** 32 | * Constructor for the action. 33 | * @constructor 34 | * @implements {e2e.ext.actions.Action.} 36 | */ 37 | actions.GetKeyringBackupData = function() {}; 38 | 39 | 40 | /** @inheritDoc */ 41 | actions.GetKeyringBackupData.prototype.execute = 42 | function(ctx, request, requestor, callback, errorCallback) { 43 | ctx.getKeyringBackupData().addCallback(callback).addErrback(errorCallback); 44 | }; 45 | 46 | }); // goog.scope 47 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/actions/importkey_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.actions.ImportKey 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/actions/listkeys.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Lists all public or private keys (never both) in the extension. 19 | */ 20 | 21 | goog.provide('e2e.ext.actions.ListKeys'); 22 | 23 | goog.require('e2e.ext.actions.Action'); 24 | goog.require('e2e.ext.utils.Error'); 25 | goog.require('goog.object'); 26 | 27 | goog.scope(function() { 28 | var actions = e2e.ext.actions; 29 | var utils = e2e.ext.utils; 30 | 31 | 32 | 33 | /** 34 | * Constructor for the action. 35 | * @constructor 36 | * @implements {e2e.ext.actions.Action.} 37 | */ 38 | actions.ListKeys = function() {}; 39 | 40 | 41 | /** @inheritDoc */ 42 | actions.ListKeys.prototype.execute = 43 | function(ctx, request, requestor, callback, errorCallback) { 44 | ctx.getAllKeys(request.content == 'private'). 45 | addCallback(function(result) { 46 | if (request.content == 'private') { 47 | // If true, the action is listing private keys. 48 | if (goog.object.isEmpty(result)) { 49 | errorCallback(new utils.Error( 50 | 'No available private keys.', 'promptNoPrivateKeysFound')); 51 | } 52 | } 53 | 54 | callback(result); 55 | }). 56 | addErrback(errorCallback); 57 | }; 58 | 59 | }); // goog.scope 60 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/actions/listkeys_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.actions.ListKeys 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/actions/restorekeyringdata_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.actions.RestoreKeyringData 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/api/api_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.api.Api 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/api/requestthrottle_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.api.RequestThrottle 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/api/requestthrottle_test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Tests for the request throttle. 19 | */ 20 | 21 | /** @suppress {extraProvide} */ 22 | goog.provide('e2e.ext.api.RequestThrottleTest'); 23 | 24 | goog.require('e2e.ext.api.RequestThrottle'); 25 | goog.require('goog.testing.asserts'); 26 | goog.require('goog.testing.jsunit'); 27 | goog.setTestOnly(); 28 | 29 | function testCanProceed() { 30 | var throttle = new e2e.ext.api.RequestThrottle(1); 31 | assertTrue(throttle.canProceed()); 32 | assertFalse(throttle.canProceed()); 33 | } 34 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/app_manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "__MSG_extName__", 4 | "description": "__MSG_extDescription__", 5 | "version": "0.4", 6 | "app": { 7 | "background": {"scripts": ["launcher_binary.js"]} 8 | }, 9 | "permissions": ["webview", "storage", "notifications"], 10 | "icons": { 11 | "16": "images/icon-16.png", 12 | "48": "images/icon-48.png", 13 | "128": "images/icon-128.png" 14 | }, 15 | "webview": { 16 | "partitions": [ 17 | { 18 | "name": "gmail", 19 | "accessible_resources": ["gmonkeystub.js", "glass.html"] 20 | } 21 | ] 22 | }, 23 | "default_locale": "en" 24 | } 25 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/extension_manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "__MSG_extName__", 4 | "description": "__MSG_extDescription__", 5 | "version": "0.31337.2", 6 | "permissions": ["activeTab", "notifications"], 7 | "optional_permissions": [], 8 | "background": {"scripts": ["launcher_binary.js"]}, 9 | "options_page": "settings.html", 10 | "browser_action": { 11 | "default_title": "__MSG_extName__", 12 | "default_icon": "images/icon-128.png", 13 | "default_popup": "prompt.html" 14 | }, 15 | "icons": { 16 | "16": "images/icon-16.png", 17 | "48": "images/icon-48.png", 18 | "128": "images/icon-128.png" 19 | }, 20 | "web_accessible_resources": ["glass.html", "gmonkeystub.js"], 21 | "default_locale": "en", 22 | "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgRnXfhAUW+nb3IcT4Z8UZ4W10qN/3lB65lwDxHLNT4hc3Y0WTwgG81NFWCR8l/O79AMrn028v1x7O6yu1YZ3NmWl2QXo0GKHYmcuQQfHiAZwOLMq7ZBEDJzGlB6IkyFrDdIhaeLK8X9zYDJHRGZ2qruExD1JWVT9oRyXCyy5R+UAwDnNP8xa7X/65ojdZT4RcrBgwfwUhY5SBtBF9vlX4FpoROTVDtlAj2wNXX1Pi74tDL/ZsvERX7Y8E1w/Z2JOYlmZpsHaD9FZuUxB62tbJ7PC2xcSgxy7XNOeWJvi5BlGoG3lUwsLFAfLnXbd9D0txcCEMS2xr7hl4dh+V6+UbwIDAQAB" 23 | } 24 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/helper/bootstrap.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2015 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Bootstraps the helper in a content script. 19 | */ 20 | 21 | goog.require('e2e.ext.Helper'); 22 | goog.require('e2e.ext.WebsiteApi'); 23 | goog.require('e2e.ext.utils'); 24 | 25 | goog.provide('e2e.ext.helper.bootstrap'); 26 | 27 | 28 | /** 29 | * Specifies whether the helper has been bootstrapped. 30 | * @type {boolean} 31 | */ 32 | e2e.ext.helper.bootstrap = false; 33 | 34 | 35 | // Create the helper and start it. 36 | if (e2e.ext.utils.isContentScript() && window.helper === undefined) { 37 | /** @type {!e2e.ext.Helper} */ 38 | window.helper = new e2e.ext.Helper(new e2e.ext.WebsiteApi()); 39 | if (e2e.ext.utils.runsInChromeApp()) { 40 | window.helper.enableWebsiteRequests(); 41 | } 42 | e2e.ext.helper.bootstrap = true; 43 | } 44 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/helper/helper_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.Helper 19 | 20 | 21 | 24 | 25 | 26 |
27 |
28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/helper/websiteapi_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.WebsiteApi 19 | 20 | 21 | 24 | 25 | 26 |
27 |
28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/images/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/end-to-end/de24f353bc2fe00f66ad6b3b0f643cd87cf1ca9d/src/javascript/crypto/e2e/extension/images/close.png -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/images/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/end-to-end/de24f353bc2fe00f66ad6b3b0f643cd87cf1ca9d/src/javascript/crypto/e2e/extension/images/delete.png -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/images/download_item.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/end-to-end/de24f353bc2fe00f66ad6b3b0f643cd87cf1ca9d/src/javascript/crypto/e2e/extension/images/download_item.png -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/images/editortoolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/end-to-end/de24f353bc2fe00f66ad6b3b0f643cd87cf1ca9d/src/javascript/crypto/e2e/extension/images/editortoolbar.png -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/images/ic_launch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/end-to-end/de24f353bc2fe00f66ad6b3b0f643cd87cf1ca9d/src/javascript/crypto/e2e/extension/images/ic_launch.png -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/images/ic_more_vert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/end-to-end/de24f353bc2fe00f66ad6b3b0f643cd87cf1ca9d/src/javascript/crypto/e2e/extension/images/ic_more_vert.png -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/images/icon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/end-to-end/de24f353bc2fe00f66ad6b3b0f643cd87cf1ca9d/src/javascript/crypto/e2e/extension/images/icon-128.png -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/images/icon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/end-to-end/de24f353bc2fe00f66ad6b3b0f643cd87cf1ca9d/src/javascript/crypto/e2e/extension/images/icon-16.png -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/images/icon-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/end-to-end/de24f353bc2fe00f66ad6b3b0f643cd87cf1ca9d/src/javascript/crypto/e2e/extension/images/icon-48.png -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/images/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/end-to-end/de24f353bc2fe00f66ad6b3b0f643cd87cf1ca9d/src/javascript/crypto/e2e/extension/images/screenshot.png -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/launcher_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.Launcher 19 | 20 | 21 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/preferences_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.Preferences 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/preferences_test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2013 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Tests for the preferences handler. 19 | */ 20 | 21 | /** @suppress {extraProvide} */ 22 | goog.provide('e2e.ext.PreferencesTest'); 23 | 24 | goog.require('e2e.ext.Preferences'); 25 | goog.require('e2e.ext.constants'); 26 | goog.require('goog.testing.asserts'); 27 | goog.require('goog.testing.jsunit'); 28 | goog.require('goog.testing.storage.FakeMechanism'); 29 | goog.setTestOnly(); 30 | 31 | var constants = e2e.ext.constants; 32 | var fakeStorage; 33 | var preferences; 34 | 35 | 36 | function setUp() { 37 | fakeStorage = new goog.testing.storage.FakeMechanism(); 38 | preferences = new e2e.ext.Preferences(fakeStorage); 39 | } 40 | 41 | 42 | function testWelcomeScreen() { 43 | assertFalse(preferences.isWelcomePageEnabled()); 44 | preferences.setWelcomePageEnabled(true); 45 | assertTrue(preferences.isWelcomePageEnabled()); 46 | } 47 | 48 | 49 | function testLookingGlass() { 50 | assertFalse(preferences.isLookingGlassEnabled()); 51 | preferences.setLookingGlassEnabled(true); 52 | assertTrue(preferences.isLookingGlassEnabled()); 53 | } 54 | 55 | 56 | function testDefaults() { 57 | preferences.initDefaults(); 58 | assertTrue(preferences.isWelcomePageEnabled()); 59 | assertFalse(preferences.isLookingGlassEnabled()); 60 | } 61 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/dialogs/backupkey/backupkey_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.ui.dialogs.BackupKey 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/dialogs/generic/generic.soy: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Google Inc. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | {namespace e2e.ext.ui.templates.dialogs.generic} 16 | 17 | /** 18 | * Renders the required UI elements for the dialog component. 19 | */ 20 | {template .dialog} 21 | {@param message: ?} /** The message to display. */ 22 | {@param inputFieldType: ?} /** The type of the input field (e.g. text, password, etc.). */ 23 | {@param inputPlaceholder: ?} /** A placeholder to display when asking for the passphrase. */ 24 | {@param actionButtonTitle: ?} /** The title of the prompt button. */ 25 | {@param cancelButtonTitle: ?} /** The title of the cancel button. */ 26 | {if $message} 27 |
{$message|changeNewlineToBr}
28 | {/if} 29 | {if $inputFieldType} 30 | 32 | {/if} 33 | 34 | {if length($cancelButtonTitle) > 0} 35 | 36 | {/if} 37 | {/template} 38 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/dialogs/generic/generic_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.ui.dialogs.Generic 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/dialogs/importconfirmation/importconfirmation.css: -------------------------------------------------------------------------------- 1 | /* Copyright 2014 Google Inc. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | */ 15 | 16 | .select-all-link { 17 | color: #acacac; 18 | cursor: pointer; 19 | margin: 0 3px; 20 | } 21 | 22 | .select-all-link:hover { 23 | color: #0c0c0c; 24 | } 25 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/dialogs/importconfirmation/importconfirmation_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.ui.dialogs.ImportConfirmation 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/dialogs/inputtype.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @fileoverview Lists the supported input types for UI dialogs. 3 | */ 4 | 5 | goog.provide('e2e.ext.ui.dialogs.InputType'); 6 | 7 | 8 | /** 9 | * The type of input the dialog should handle. 10 | * @enum {string} 11 | */ 12 | e2e.ext.ui.dialogs.InputType = { 13 | NONE: '', 14 | TEXT: 'text', 15 | SECURE_TEXT: 'password' 16 | }; 17 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/dialogs/overlay/dialog.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 The Closure Library Authors. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by the Apache License, Version 2.0. 5 | * See the COPYING file for details. 6 | */ 7 | 8 | /* 9 | * Standard styling for goog.ui.Dialog. 10 | * 11 | * @author ssaviano@google.com (Steven Saviano) 12 | * @author attila@google.com (Attila Bodis) 13 | */ 14 | 15 | 16 | .modal-dialog { 17 | background: #c1d9ff; 18 | border: 1px solid #3a5774; 19 | color: #000; 20 | padding: 4px; 21 | position: absolute; 22 | } 23 | 24 | .modal-dialog a, 25 | .modal-dialog a:link, 26 | .modal-dialog a:visited { 27 | color: #06c; 28 | cursor: pointer; 29 | } 30 | 31 | .modal-dialog-bg { 32 | background: #666; 33 | left: 0; 34 | position: absolute; 35 | top: 0; 36 | } 37 | 38 | .modal-dialog-title { 39 | background: #e0edfe; 40 | color: #000; 41 | cursor: pointer; 42 | font-size: 120%; 43 | font-weight: bold; 44 | 45 | /* Add padding on the right to ensure the close button has room. */ 46 | padding: 8px 31px 8px 8px; 47 | 48 | position: relative; 49 | _zoom: 1; /* Ensures proper width in IE6 RTL. */ 50 | } 51 | 52 | .modal-dialog-title-close { 53 | /* Client apps may override the URL at which they serve the sprite. */ 54 | background: #e0edfe url(/images/editortoolbar.png) no-repeat -528px 0; 55 | cursor: default; 56 | height: 15px; 57 | position: absolute; 58 | right: 10px; 59 | top: 8px; 60 | width: 15px; 61 | vertical-align: middle; 62 | } 63 | 64 | .modal-dialog-buttons, 65 | .modal-dialog-content { 66 | background-color: #fff; 67 | padding: 8px; 68 | } 69 | 70 | .goog-buttonset-default { 71 | font-weight: bold; 72 | } 73 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/dialogs/overlay/overlay_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.ui.dialogs.Overlay 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/dialogs/overlay/overlay_test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Tests for the overlay UI 19 | */ 20 | 21 | /** @suppress {extraProvide} */ 22 | goog.provide('e2e.ext.ui.dialogs.OverlayTest'); 23 | 24 | goog.require('e2e.ext.ui.dialogs.Overlay'); 25 | goog.require('goog.testing.MockControl'); 26 | goog.require('goog.testing.asserts'); 27 | goog.require('goog.testing.jsunit'); 28 | goog.setTestOnly(); 29 | 30 | var dialog = null; 31 | 32 | 33 | function setUp() { 34 | mockControl = new goog.testing.MockControl(); 35 | dialog = new e2e.ext.ui.dialogs.Overlay(); 36 | } 37 | 38 | 39 | function tearDown() { 40 | mockControl.$tearDown(); 41 | 42 | goog.dispose(dialog); 43 | dialog = null; 44 | } 45 | 46 | 47 | function testCloseButton() { 48 | dialog.setVisible(true); 49 | var okButton = dialog.getElement().querySelector('button[name=ok]'); 50 | 51 | assertFalse(dialog.isDisposed()); 52 | 53 | okButton.click(); 54 | 55 | assertTrue(dialog.isDisposed()); 56 | } 57 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/glass/bootstrap.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Bootstraps the looking glass. 19 | */ 20 | 21 | goog.require('e2e.ext.ui.Glass'); 22 | goog.require('e2e.ext.utils.action'); 23 | goog.require('e2e.ext.utils.text'); 24 | goog.require('goog.crypt.base64'); 25 | 26 | goog.provide('e2e.ext.ui.glass.bootstrap'); 27 | 28 | e2e.ext.utils.action.getPreferences(function(preferences) { 29 | if (preferences.isLookingGlassEnabled()) { 30 | // Create the looking glass. 31 | window.addEventListener('message', function(evt) { 32 | if (!e2e.ext.utils.text.isGmailOrigin(evt.origin)) { 33 | return; 34 | } 35 | 36 | var pgpMessage = evt.data ? evt.data : ''; 37 | /** @type {e2e.ext.ui.Glass} */ 38 | window.lookingGlass = new e2e.ext.ui.Glass( 39 | goog.crypt.base64.decodeString(pgpMessage, true)); 40 | window.lookingGlass.decorate(document.documentElement); 41 | }); 42 | 43 | e2e.ext.ui.glass.bootstrap = true; 44 | } 45 | }, goog.nullFunction); 46 | 47 | 48 | /** 49 | * Specifies whether the looking glass has been bootstrapped. 50 | * @type {boolean} 51 | */ 52 | e2e.ext.ui.glass.bootstrap = false; 53 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/glass/glass.css: -------------------------------------------------------------------------------- 1 | /* Copyright 2014 Google Inc. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | */ 15 | #errorDiv { 16 | color: #dd4b39; 17 | font-size: 1em; 18 | margin-bottom: 7px; 19 | text-align: center; 20 | } 21 | 22 | body > fieldset { 23 | position: absolute; 24 | width: 95%; 25 | } 26 | 27 | body > div { 28 | height: 100%; 29 | left: 0; 30 | position: fixed; 31 | top: 0; 32 | width: 100%; 33 | } 34 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/glass/glass.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/glass/glass.soy: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Google Inc. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | {namespace e2e.ext.ui.templates.glass} 16 | 17 | /** 18 | * Renders the frame where decrypted PGP content will be displayed. 19 | */ 20 | {template .contentFrame} 21 | {@param label: ?} /** The label for the decrypted content. */ 22 | {@param content: ?} /** The content to display to the user. */ 23 | {@param error: ?} /** The error message (if any) to display to the user. */ 24 | 25 | 26 | 27 | 28 | 29 |
30 | {$label} 31 | {if $error} 32 |
{$error}
33 | {/if} 34 |
{$content|changeNewlineToBr}
35 |
36 |
37 | 38 | 39 | {/template} 40 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/glass/glass_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.ui.Glass 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/glass/glasswrapper_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.ui.GlassWrapper 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/panels/chipholder/chip_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.ui.panels.Chip 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/panels/chipholder/chipholder.soy: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Google Inc. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | {namespace e2e.ext.ui.templates.panels.chipholder} 16 | 17 | 18 | /** 19 | * Renders the chip holder. 20 | */ 21 | {template .renderChipHolder} 22 | {@param recipientsTitle: ?} /** The placeholder text for the recipients field. */ 23 | {@param passphraseEncryptionLinkTitle: ?} /** The title for the passphrase encryption link. */ 24 | {@param passphraseEncryptionLinkTooltip: ?} /** The tooltip for the passphrase encryption link. 25 | */ 26 |
27 |
29 | + {$passphraseEncryptionLinkTitle} 30 |
31 |
32 | {$recipientsTitle} 33 | 34 |
35 |
36 | {/template} 37 | 38 | 39 | /** 40 | * Renders a chip that represents a PGP UID or passphrase. 41 | */ 42 | {template .renderChip} 43 | {@param value: ?} /** The UID or passphrase to render. */ 44 |
45 |
{$value}
46 | 47 |
48 | {/template} 49 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/panels/chipholder/chipholder_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.ui.panels.ChipHolder 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/panels/chipholder/inputhandler_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.ui.panels.ChipHolderInputHandler 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/panels/generatekey/generatekey.soy: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Google Inc. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | {namespace e2e.ext.ui.templates.panels.generatekey} 16 | 17 | 18 | /** 19 | * The form that enables the user to generate new PGP keys. 20 | */ 21 | {template .generateKeyForm} 22 | {@param sectionTitle: ?} /** The title for the current section. */ 23 | {@param emailLabel: ?} /** The label to use when asking for the user's email address. */ 24 | {@param actionButtonTitle: ?} /** The title for the submit button. */ 25 | {@param signupCancelButtonTitle: ?} /** The title for the cancel button. */ 26 | {if $sectionTitle} 27 |

{$sectionTitle}

28 | {/if} 29 |
{$emailLabel|changeNewlineToBr}
30 | 33 | 34 | 37 | {/template} 38 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/panels/generatekey/generatekey_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.ui.panels.GenerateKey 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/panels/keyringmgmt/keyringmgmtfull_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.ui.panels.KeyringMgmtFull 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/panels/keyringmgmt/keyringmgmtmini_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.ui.panels.KeyringMgmtMini 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/panels/preferences/preferenceentry_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.ui.panels.PreferenceEntry 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/panels/preferences/preferenceentry_test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Tests for the PreferenceEntry. 19 | */ 20 | 21 | /** @suppress {extraProvide} */ 22 | goog.provide('e2e.ext.ui.panels.PreferenceEntryTest'); 23 | 24 | /** @suppress {extraRequire} since the dependent soy files don't do this */ 25 | goog.require('e2e.ext.constants.CssClass'); 26 | goog.require('e2e.ext.ui.panels.PreferenceEntry'); 27 | goog.require('goog.testing.MockControl'); 28 | goog.require('goog.testing.asserts'); 29 | goog.require('goog.testing.jsunit'); 30 | goog.setTestOnly(); 31 | 32 | var stubs = null; 33 | var mockControl = null; 34 | 35 | 36 | function setUp() { 37 | mockControl = new goog.testing.MockControl(); 38 | } 39 | 40 | 41 | function tearDown() { 42 | mockControl.$tearDown(); 43 | } 44 | 45 | 46 | function testRender() { 47 | var panel = new e2e.ext.ui.panels.PreferenceEntry('name', 48 | 'description', mockControl.createFunctionMock('setPreference'), true); 49 | 50 | panel.setterCallback_(false); 51 | mockControl.$replayAll(); 52 | 53 | panel.render(document.body); 54 | 55 | 56 | var inputElem = document.getElementById('preference-name'); 57 | assertNotNull(inputElem); 58 | assertContains('description', document.body.textContent); 59 | 60 | inputElem.click(); 61 | mockControl.$verifyAll(); 62 | } 63 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/panels/preferences/preferences.soy: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Google Inc. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | {namespace e2e.ext.ui.templates.panels.preferences} 16 | 17 | /** 18 | * Enables the user to set preferences. 19 | */ 20 | {template .listPreferences} 21 | {@param sectionTitle: ?} /** The title for the current section. */ 22 |

{$sectionTitle}

23 | {/template} 24 | 25 | 26 | /** 27 | * Renders an individual preference that the user has set. 28 | */ 29 | {template .preferenceEntry} 30 | {@param name: ?} /** The name of the preference. */ 31 | {@param description: ?} /** The description of the preference. */ 32 | {@param checked: ?} /** True if the preference is set. Otherwise false. */ 33 |
34 | 35 | 36 |
37 | {/template} 38 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/panels/preferences/preferencespanel_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.ui.panels.PreferencesPanel 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/panels/preferences/preferencespanel_test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Tests for the PreferencesPanel. 19 | */ 20 | 21 | /** @suppress {extraProvide} */ 22 | goog.provide('e2e.ext.ui.panels.PreferencesPanelTest'); 23 | 24 | goog.require('e2e.ext.Preferences'); 25 | goog.require('e2e.ext.testingstubs'); 26 | goog.require('e2e.ext.ui.panels.PreferencesPanel'); 27 | goog.require('goog.array'); 28 | goog.require('goog.testing.PropertyReplacer'); 29 | goog.require('goog.testing.asserts'); 30 | goog.require('goog.testing.jsunit'); 31 | goog.require('goog.testing.storage.FakeMechanism'); 32 | goog.setTestOnly(); 33 | 34 | var panel = null; 35 | var preferences = null; 36 | var storage = null; 37 | var stubs = null; 38 | 39 | 40 | function setUp() { 41 | stubs = new goog.testing.PropertyReplacer(); 42 | e2e.ext.testingstubs.initStubs(stubs); 43 | storage = new goog.testing.storage.FakeMechanism(); 44 | preferences = new e2e.ext.Preferences(storage); 45 | panel = new e2e.ext.ui.panels.PreferencesPanel(preferences); 46 | } 47 | 48 | 49 | function tearDown() { 50 | stubs.reset(); 51 | stubs = null; 52 | } 53 | 54 | function testRender() { 55 | panel.render(document.body); 56 | 57 | assertContains('preferencesSectionTitle', document.body.textContent); 58 | 59 | goog.array.forEach(document.querySelectorAll('input'), function(elem) { 60 | elem.click(); 61 | }); 62 | 63 | assertTrue(preferences.isWelcomePageEnabled()); 64 | } 65 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/panels/prompt/decryptverify_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.ui.panels.prompt.DecryptVerifyTest 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/panels/prompt/encryptsign_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.ui.panels.prompt.EncryptSignTest 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/panels/prompt/importkey_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.ui.panels.prompt.ImportKeyTest 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/panels/prompt/panelbase_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.ui.panels.prompt.PanelBaseTest 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/prompt/prompt.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | End-To-End 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/prompt/prompt.soy: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Google Inc. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | {namespace e2e.ext.ui.templates.prompt} 16 | 17 | 18 | /** 19 | * Renders the base layout for the Prompt UI. 20 | */ 21 | {template .main} 22 | {@param menuLabel: ?} /** The label for the menu icon. */ 23 | {@param popoutLabel: ?} /** The label for the popout icon. */ 24 |
25 |
26 |
28 | 30 | 32 |
33 |

34 |
35 |
36 |
37 |
38 |
39 | {/template} 40 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/prompt/prompt_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.ui.Prompt 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/settings/bootstrap.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2015 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Starts the settings page. 19 | */ 20 | 21 | goog.require('e2e.ext.ui.Settings'); 22 | goog.require('e2e.ext.utils'); 23 | 24 | goog.provide('e2e.ext.ui.settings.bootstrap'); 25 | 26 | 27 | /** 28 | * Specifies whether the settings page has been bootstrapped. 29 | * @type {boolean} 30 | */ 31 | e2e.ext.ui.settings.bootstrap = false; 32 | 33 | // Create the settings page. 34 | if (e2e.ext.utils.isChromeExtensionWindow() || 35 | e2e.ext.utils.isChromeAppWindow()) { 36 | /** @type {e2e.ext.ui.Settings} */ 37 | window.settingsPage = new e2e.ext.ui.Settings(); 38 | window.settingsPage.decorate(document.documentElement); 39 | e2e.ext.ui.settings.bootstrap = true; 40 | } 41 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/settings/settings.css: -------------------------------------------------------------------------------- 1 | /* Copyright 2013 Google Inc. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | */ 15 | /** 16 | * Defines the styles that are used by the settings page. 17 | */ 18 | 19 | #pgpBody { 20 | padding: 0 15px; 21 | } 22 | 23 | #pgpBody h1 { 24 | color: #222; 25 | font-size: 16px; 26 | margin-top: 25px; 27 | } 28 | 29 | #pgpBody input { 30 | margin-right: 15px; 31 | } 32 | 33 | #pgpBody input[type="checkbox"] { 34 | margin-right: 5px; 35 | } 36 | 37 | #pgpBody input[type="text"] { 38 | margin-top: 10px; 39 | } 40 | 41 | #pgpBody input[type="file"] { 42 | margin-top: 8px; 43 | } 44 | 45 | #pgpBody .email { 46 | width: 300px; 47 | } 48 | 49 | #pgpBody .preference-div { 50 | padding: 5px; 51 | } 52 | 53 | #pgpBody .preference-div > div, 54 | #pgpBody .preference-div > input { 55 | display: inline-block; 56 | vertical-align: middle; 57 | } 58 | 59 | #storedKeys table { 60 | border-spacing: 0; 61 | margin-top: 15px; 62 | } 63 | 64 | #storedKeys tr>td { 65 | vertical-align: top; 66 | } 67 | 68 | 69 | #storedKeys tr img { 70 | cursor: auto; 71 | opacity: .1; 72 | padding: 5px 3px 1px 0; 73 | } 74 | 75 | #storedKeys tr:hover { 76 | background-color: #f5f5f5; 77 | } 78 | 79 | #storedKeys tr:hover img { 80 | cursor: pointer; 81 | opacity: .6; 82 | } 83 | 84 | #errorDiv { 85 | color: #dd4b39; 86 | font-size: 1em; 87 | margin-bottom: 7px; 88 | text-align: center; 89 | } 90 | 91 | .passphrase { 92 | width: 300px; 93 | } 94 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/settings/settings.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/settings/settings_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.ui.Settings 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/templates.soy: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Google Inc. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | {namespace e2e.ext.ui.templates} 16 | 17 | 18 | /** 19 | * The base layout for the settings page. 20 | */ 21 | {template .settings} 22 | {@param pageTitle: ?} /** The title for the settings page. */ 23 | 24 | 25 | {$pageTitle} 26 | 27 | 28 | 29 |
30 |
31 |

{$pageTitle}

32 |
33 |
34 |
35 |
36 |
37 | 38 | 39 | {/template} 40 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/webview/bootstrap.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2015 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Starts the website container page. 19 | */ 20 | 21 | goog.require('e2e.ext.ui.WebsiteContainer'); 22 | goog.require('e2e.ext.utils'); 23 | goog.require('goog.events'); 24 | goog.require('goog.events.EventType'); 25 | 26 | goog.provide('e2e.ext.ui.webview.bootstrap'); 27 | 28 | 29 | /** 30 | * Specifies whether the prompt page has been bootstrapped. 31 | * @type {boolean} 32 | */ 33 | e2e.ext.ui.webview.bootstrap = false; 34 | 35 | // Create the prompt page. 36 | if (e2e.ext.utils.isChromeAppWindow()) { 37 | goog.events.listen(window, goog.events.EventType.LOAD, function() { 38 | /** @type {e2e.ext.ui.WebsiteContainer} */ 39 | window.websiteContainer = new e2e.ext.ui.WebsiteContainer( 40 | 'https://mail.google.com/'); 41 | window.websiteContainer.decorate(document.body); 42 | e2e.ext.ui.webview.bootstrap = true; 43 | }); 44 | } 45 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/webview/websitecontainer_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.ui.WebsiteContainer 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/webview/webview.css: -------------------------------------------------------------------------------- 1 | #prompt { 2 | background: white; 3 | border: 1px solid #888; 4 | border-bottom: none; 5 | bottom: 0; 6 | height: 500px; 7 | left: 0; 8 | margin: auto; 9 | overflow: auto; 10 | padding: 0; 11 | position: absolute; 12 | right: 0; 13 | width: 800px; 14 | z-index: 2; 15 | } 16 | 17 | #webview { 18 | height: 93vh; 19 | margin-bottom: 1vh; 20 | width: 100%; 21 | transition: all 0.1s ease-out; 22 | } 23 | 24 | #webview-container { 25 | width: 100%; 26 | position: relative; 27 | z-index: 1; 28 | } 29 | 30 | .typing-allowed { 31 | -webkit-filter: grayscale(1); 32 | } 33 | 34 | .blurred { 35 | -webkit-filter: blur(3px); 36 | } 37 | 38 | #show-prompt { 39 | bottom: 0; 40 | position: absolute; 41 | right: 10px; 42 | z-index: 2; 43 | } 44 | 45 | #options { 46 | bottom: 0; 47 | left: 10px; 48 | position: absolute; 49 | z-index: 2; 50 | } 51 | 52 | #focus-stealer { 53 | position: absolute; 54 | top: -100px; 55 | visibility: hidden; 56 | } 57 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/webview/webview.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/webview/webview.soy: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Google Inc. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | {namespace e2e.ext.ui.templates.webview} 16 | 17 | 18 | /** 19 | * Renders the base layout for the Webview UI. 20 | */ 21 | {template .main} 22 | 23 | 24 |
25 |
26 | 27 |
28 |
29 | 30 | {/template} 31 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/welcome/bootstrap.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2015 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Starts the welcome page. 19 | */ 20 | 21 | goog.require('e2e.ext.ui.Welcome'); 22 | goog.require('e2e.ext.utils'); 23 | 24 | goog.provide('e2e.ext.ui.welcome.bootstrap'); 25 | 26 | 27 | /** 28 | * Specifies whether the welcome page has been bootstrapped. 29 | * @type {boolean} 30 | */ 31 | e2e.ext.ui.welcome.bootstrap = false; 32 | 33 | // Create the welcome page. 34 | if (e2e.ext.utils.isChromeExtensionWindow() || 35 | e2e.ext.utils.isChromeAppWindow()) { 36 | /** @type {e2e.ext.ui.Welcome} */ 37 | var welcomePage = new e2e.ext.ui.Welcome(); 38 | welcomePage.decorate(document.documentElement); 39 | e2e.ext.ui.welcome.bootstrap = true; 40 | } 41 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/welcome/welcome.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/ui/welcome/welcome_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.ui.Welcome 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/utils/action_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.utils.action 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/utils/callbacksmap_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.utils.CallbacksMap 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/utils/callbacksmap_test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2015 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Tests for the CallbacksMap. 19 | */ 20 | 21 | /** @suppress {extraProvide} */ 22 | goog.provide('e2e.ext.utils.CallbacksMapTest'); 23 | 24 | goog.require('e2e.ext.utils.CallbacksMap'); 25 | goog.require('goog.testing.asserts'); 26 | goog.require('goog.testing.jsunit'); 27 | 28 | goog.setTestOnly(); 29 | 30 | var map; 31 | 32 | function setUp() { 33 | map = new e2e.ext.utils.CallbacksMap(); 34 | } 35 | 36 | function testAddCallbacks() { 37 | var anotherFunction = function() {}; 38 | 39 | var key = map.addCallbacks(goog.nullFunction, anotherFunction); 40 | assertTrue(map.containsKey(key)); 41 | assertEquals(map.get(key).callback, goog.nullFunction); 42 | assertEquals(map.get(key).errback, anotherFunction); 43 | var keyTwo = map.addCallbacks(goog.nullFunction, goog.nullFunction); 44 | assertTrue(keyTwo != key); 45 | } 46 | 47 | 48 | function testGetAndRemove() { 49 | assertThrows(function() { 50 | map.getAndRemove('notexisting'); 51 | }); 52 | 53 | var one = function() {}; 54 | var two = function() {}; 55 | var key = map.addCallbacks(one, two); 56 | keys = map.getAndRemove(key); 57 | assertEquals(one, keys.callback); 58 | assertEquals(two, keys.errback); 59 | assertFalse(map.containsKey(key)); 60 | } 61 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/utils/helperproxy_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.utils.HelperProxy 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/utils/text_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.utils.text 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/utils/utils_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.ext.utils 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/extension/worker_bootstrap.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2015 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview OpenPGP Context WebWorker bootstrap file. 19 | */ 20 | 21 | goog.provide('e2e.openpgp.worker.bootstrap'); 22 | 23 | goog.require('e2e.async.Result'); 24 | goog.require('e2e.async.WorkerSelf'); 25 | goog.require('e2e.ext.utils.IndexedDbStorage'); 26 | goog.require('e2e.openpgp.ContextImpl'); 27 | goog.require('e2e.openpgp.ContextService'); 28 | 29 | 30 | /** 31 | * Bootstrap function for the code in the Web Worker. 32 | */ 33 | e2e.openpgp.worker.bootstrap = function() { 34 | var contextPromise = new e2e.async.Result(); 35 | new e2e.ext.utils.IndexedDbStorage('keyring', function(storage) { 36 | contextPromise.callback(new e2e.openpgp.ContextImpl(storage)); 37 | }); 38 | var workerPeer = new e2e.async.WorkerSelf(); 39 | e2e.openpgp.ContextService.launch(workerPeer, contextPromise); 40 | }; 41 | 42 | e2e.openpgp.worker.bootstrap(); 43 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/hash/all.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2013 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Requires all blocks to load them into the factory. 19 | */ 20 | goog.provide('e2e.hash.all'); 21 | 22 | /** @suppress {extraRequire} intentional import */ 23 | goog.require('e2e.hash.Md5'); 24 | /** @suppress {extraRequire} intentional import */ 25 | goog.require('e2e.hash.Sha1'); 26 | /** @suppress {extraRequire} intentional import */ 27 | goog.require('e2e.hash.Sha224'); 28 | /** @suppress {extraRequire} intentional import */ 29 | goog.require('e2e.hash.Sha256'); 30 | /** @suppress {extraRequire} intentional import */ 31 | goog.require('e2e.hash.Sha384'); 32 | /** @suppress {extraRequire} intentional import */ 33 | goog.require('e2e.hash.Sha512'); 34 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/hash/md5.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2013 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | /** 19 | * @fileoverview Wraps the original Md5 implementation to conform to e2e. 20 | * @author adhintz@google.com (Drew Hintz) 21 | */ 22 | 23 | goog.provide('e2e.hash.Md5'); 24 | 25 | goog.require('e2e.hash.Algorithm'); 26 | goog.require('e2e.hash.Hash'); 27 | goog.require('e2e.hash.factory'); 28 | goog.require('goog.crypt.Md5'); 29 | 30 | 31 | /** 32 | * Wrapper around the goog.crypt.Md5 implementation. 33 | */ 34 | e2e.hash.Md5 = class extends e2e.hash.Hash { 35 | constructor() { 36 | super(); 37 | this.inst_ = new goog.crypt.Md5(); 38 | this.blockSize = this.inst_.blockSize; 39 | } 40 | }; 41 | 42 | 43 | /** @inheritDoc */ 44 | e2e.hash.Md5.prototype.algorithm = e2e.hash.Algorithm.MD5; 45 | 46 | e2e.hash.factory.add(e2e.hash.Md5); 47 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/hash/sha1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2012 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | /** 19 | * @fileoverview Wraps the original Sha1 implementation to conform to e2e. 20 | * @author evn@google.com (Eduardo Vela) 21 | */ 22 | 23 | goog.provide('e2e.hash.Sha1'); 24 | 25 | goog.require('e2e.hash.Algorithm'); 26 | goog.require('e2e.hash.Hash'); 27 | goog.require('e2e.hash.factory'); 28 | goog.require('goog.crypt.Sha1'); 29 | 30 | 31 | /** 32 | * Wrapper around the goog.crypt.Sha1 implementation. 33 | */ 34 | e2e.hash.Sha1 = class extends e2e.hash.Hash { 35 | constructor() { 36 | super(); 37 | this.inst_ = new goog.crypt.Sha1(); 38 | this.blockSize = this.inst_.blockSize; 39 | } 40 | }; 41 | 42 | 43 | /** @inheritDoc */ 44 | e2e.hash.Sha1.prototype.algorithm = e2e.hash.Algorithm.SHA1; 45 | 46 | e2e.hash.factory.add(e2e.hash.Sha1); 47 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/math/bignum_perf_test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | BigNum Performance Tests 14 | 15 | 16 | 21 | 22 | 23 |

BigNum Performance tests

24 |

25 | User-agent: 26 | 27 |

28 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/math/fixedtiming.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Best-effort fixed-timing utility functions. 19 | * @author thaidn@google.com (Thai Duong). 20 | */ 21 | 22 | goog.provide('e2e.fixedtiming'); 23 | 24 | 25 | /** 26 | * Selects a if bit is 1, or selects b if bit is 0. Undefined if bit has other 27 | * values. Copied from "Fast Elliptic Curve Cryptography in OpenSSL". 28 | * @param {number} a 29 | * @param {number} b 30 | * @param {number} bit 31 | * @return {number} 32 | */ 33 | e2e.fixedtiming.select = function(a, b, bit) { 34 | /* -0 = 0, -1 = 0xff....ff */ 35 | var mask = (-bit) | 0; 36 | var ret = mask & (a ^ b); 37 | ret = ret ^ b; 38 | return ret; 39 | }; 40 | 41 | 42 | /** 43 | * Returns a if a > b; otherwise b. 44 | * @param {number} a 45 | * @param {number} b 46 | * @return {number} 47 | */ 48 | e2e.fixedtiming.max = function(a, b) { 49 | return e2e.fixedtiming.select(a, b, (a > b) | 0); 50 | }; 51 | 52 | /** 53 | * Returns a if a >= 0; otherwise -a. 54 | * @param {number} a 55 | * @return {number} 56 | */ 57 | e2e.fixedtiming.abs = function(a) { 58 | return e2e.fixedtiming.select(a, -a, (a >= 0) | 0); 59 | }; 60 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/math/fixedtiming_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | Unit Test of e2e.fixedtiming 17 | 18 | 19 | 23 | 56 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/openpgp/block/all.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2013 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Requires all blocks to load them into the factory. 19 | */ 20 | /** @suppress {extraProvide} this aggregation needs a namespace */ 21 | goog.provide('e2e.openpgp.block.all'); 22 | 23 | /** @suppress {extraRequire} intentional import */ 24 | goog.require('e2e.openpgp.block.Compressed'); 25 | /** @suppress {extraRequire} intentional import */ 26 | goog.require('e2e.openpgp.block.EncryptedMessage'); 27 | /** @suppress {extraRequire} intentional import */ 28 | goog.require('e2e.openpgp.block.LiteralMessage'); 29 | /** @suppress {extraRequire} intentional import */ 30 | goog.require('e2e.openpgp.block.TransferablePublicKey'); 31 | /** @suppress {extraRequire} intentional import */ 32 | goog.require('e2e.openpgp.block.TransferableSecretKey'); 33 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/openpgp/block/armorable.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2015 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | goog.provide('e2e.openpgp.block.Armorable'); 18 | 19 | 20 | 21 | /** 22 | * The interface representing OpenPGP blocks that can be ASCII-armored. 23 | * This will include common OpenPGP blocks and a Clearsign message. 24 | * @interface 25 | */ 26 | e2e.openpgp.block.Armorable = function() {}; 27 | 28 | 29 | /** 30 | * Text to use in the ASCII Armor message header for this type of block. 31 | * @type {string} 32 | */ 33 | e2e.openpgp.block.Armorable.prototype.header; 34 | 35 | 36 | /** 37 | * Returns the block signatures to include in the separate section of the 38 | * ASCII armor. Only useful in clearsign messages. 39 | * @return {!Array.} 41 | */ 42 | e2e.openpgp.block.Armorable.prototype.getArmorSignatures = goog.abstractMethod; 43 | 44 | 45 | /** 46 | * Returns the armorable block body. This is different than {@link #serialize} 47 | * for clearsign messages. 48 | * @return {!e2e.ByteArray} 49 | */ 50 | e2e.openpgp.block.Armorable.prototype.getArmorBody = goog.abstractMethod; 51 | 52 | 53 | /** 54 | * Serializes the block to a byte array. 55 | * @return {!e2e.ByteArray} The serialization of the block. 56 | */ 57 | e2e.openpgp.block.Armorable.prototype.serialize = goog.abstractMethod; 58 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/openpgp/block/transferablepublickey.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2013 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * 19 | * @fileoverview TransferablePublicKey block. 20 | * 21 | */ 22 | 23 | goog.provide('e2e.openpgp.block.TransferablePublicKey'); 24 | 25 | goog.require('e2e.openpgp.block.TransferableKey'); 26 | goog.require('e2e.openpgp.packet.Key'); 27 | goog.require('e2e.openpgp.packet.PublicKey'); 28 | 29 | 30 | 31 | /** 32 | * Transferable Public Key Block. 33 | * @constructor 34 | * @extends {e2e.openpgp.block.TransferableKey} 35 | */ 36 | e2e.openpgp.block.TransferablePublicKey = function() { 37 | e2e.openpgp.block.TransferablePublicKey.base(this, 'constructor', e2e.openpgp.packet.PublicKey); 38 | }; 39 | goog.inherits(e2e.openpgp.block.TransferablePublicKey, 40 | e2e.openpgp.block.TransferableKey); 41 | 42 | 43 | /** @override */ 44 | e2e.openpgp.block.TransferablePublicKey.prototype.SERIALIZE_IN_KEY_OBJECT = 45 | true; 46 | 47 | 48 | /** @override */ 49 | e2e.openpgp.block.TransferablePublicKey.prototype.getKeyToEncrypt = 50 | function() { 51 | return this.getKeyTo( 52 | e2e.openpgp.packet.Key.Usage.ENCRYPT, 53 | e2e.openpgp.packet.PublicKey); 54 | }; 55 | 56 | 57 | /** @inheritDoc */ 58 | e2e.openpgp.block.TransferablePublicKey.prototype.header = 59 | 'PUBLIC KEY BLOCK'; 60 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/openpgp/bytestream_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | Unit Test of e2e.openpgp.ByteStream 17 | 18 | 19 | 23 | 51 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/openpgp/contextimpl_perf_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | ContextImpl Performance Tests 17 | 18 | 19 | 23 |

ContextImpl Performance tests

24 |

25 | User-agent: 26 | 27 |

28 | 29 | 40 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/openpgp/keyprovidercipher_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit of e2e.openpgp.KeyProviderCipher 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/openpgp/managers/simplekeymanager_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit test of e2e.openpgp.managers.SimpleKeyManager 19 | 20 | 21 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/openpgp/mpi_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | Unit Test of e2e.openpgp.Mpi 17 | 18 | 19 | 24 | 36 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/openpgp/packet/data.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2013 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Packet to represent a message data packet or a literal data 19 | * packet. 20 | */ 21 | 22 | goog.provide('e2e.openpgp.packet.Data'); 23 | 24 | goog.require('e2e.openpgp.packet.Packet'); 25 | 26 | 27 | 28 | /** 29 | * @constructor 30 | * @extends {e2e.openpgp.packet.Packet} 31 | */ 32 | e2e.openpgp.packet.Data = function() { 33 | e2e.openpgp.packet.Data.base(this, 'constructor'); 34 | }; 35 | goog.inherits(e2e.openpgp.packet.Data, 36 | e2e.openpgp.packet.Packet); 37 | 38 | 39 | /** 40 | * The unencrypted data contained in the packet. 41 | * @type {!e2e.ByteArray} 42 | */ 43 | e2e.openpgp.packet.Data.prototype.data; 44 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/openpgp/packet/encrypteddata.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2013 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Encrypted Data packet. Parent class for 19 | * Symmetrically Encrypted Data Packet (Tag 9) and 20 | * Symmetrically Encrypted Integrity Protected Data Packet (Tag 18). 21 | * @author adhintz@google.com (Drew Hintz) 22 | */ 23 | 24 | goog.provide('e2e.openpgp.packet.EncryptedData'); 25 | 26 | goog.require('e2e.openpgp.packet.Data'); 27 | 28 | 29 | 30 | /** 31 | * Representation of an Encrypted Data Packet. 32 | * @param {!e2e.ByteArray} encryptedData The encrypted data. 33 | * @extends {e2e.openpgp.packet.Data} 34 | * @constructor 35 | */ 36 | e2e.openpgp.packet.EncryptedData = function( 37 | encryptedData) { 38 | e2e.openpgp.packet.EncryptedData.base(this, 'constructor'); 39 | 40 | /** 41 | * The encrypted data. 42 | * @type {!e2e.ByteArray} 43 | * @protected 44 | */ 45 | this.encryptedData = encryptedData; 46 | 47 | /** @inheritDoc */ 48 | this.data = []; 49 | }; 50 | goog.inherits(e2e.openpgp.packet.EncryptedData, 51 | e2e.openpgp.packet.Data); 52 | 53 | 54 | /** 55 | * Decrypts the encryptedData and populates this.data. 56 | * @param {e2e.cipher.Algorithm} algorithm The encryption algorithm. 57 | * @param {e2e.cipher.key.Key=} opt_keyObj The key object 58 | * to decrypt the data. 59 | */ 60 | e2e.openpgp.packet.EncryptedData.prototype.decrypt = 61 | goog.abstractMethod; 62 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/openpgp/packet/marker.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Marker packet. 19 | */ 20 | 21 | goog.provide('e2e.openpgp.packet.Marker'); 22 | 23 | goog.require('e2e.openpgp.packet.Packet'); 24 | goog.require('e2e.openpgp.packet.factory'); 25 | 26 | 27 | 28 | /** 29 | * @constructor 30 | * @extends {e2e.openpgp.packet.Packet} 31 | */ 32 | e2e.openpgp.packet.Marker = function() { 33 | e2e.openpgp.packet.Marker.base(this, 'constructor'); 34 | }; 35 | goog.inherits(e2e.openpgp.packet.Marker, 36 | e2e.openpgp.packet.Packet); 37 | 38 | 39 | /** @inheritDoc */ 40 | e2e.openpgp.packet.Marker.prototype.tag = 10; 41 | 42 | 43 | /** @override */ 44 | e2e.openpgp.packet.Marker.prototype.serializePacketBody = function() { 45 | return [0x50, 0x47, 0x50]; 46 | }; 47 | 48 | 49 | /** 50 | * @param {!e2e.ByteArray} body 51 | * @return {!e2e.openpgp.packet.Marker} 52 | */ 53 | e2e.openpgp.packet.Marker.parse = function(body) { 54 | return new e2e.openpgp.packet.Marker; 55 | }; 56 | 57 | 58 | e2e.openpgp.packet.factory.add(e2e.openpgp.packet.Marker); 59 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/openpgp/packet/packet_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | Unit Test of e2e.openpgp.packet.Packet 17 | 18 | 19 | 23 | 48 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/openpgp/packet/privateuse_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | Unit Test of e2e.packet.PrivateUse 17 | 18 | 19 | 28 | 47 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/openpgp/packet/secretkeyinterface.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2015 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | goog.provide('e2e.openpgp.packet.SecretKeyInterface'); 17 | 18 | 19 | 20 | /** 21 | * An interface representing a secret key packet that is used only for the 22 | * purpose of using its cipher (i.e. the secret key that might not have the key 23 | * material and is not serializable). 24 | * @interface 25 | */ 26 | e2e.openpgp.packet.SecretKeyInterface = function() {}; 27 | 28 | 29 | /** 30 | * @type {!e2e.openpgp.KeyId|undefined} Key ID. 31 | */ 32 | e2e.openpgp.packet.SecretKeyInterface.prototype.keyId; 33 | 34 | 35 | /** 36 | * @type {e2e.cipher.Cipher|e2e.signer.Signer} The cipher. 37 | */ 38 | e2e.openpgp.packet.SecretKeyInterface.prototype.cipher; 39 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/openpgp/packet/surrogatesecretkey_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.openpgp.packet.SurrogateSecretKey 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/openpgp/packet/symmetricallyencrypteddata_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | Unit Test of e2e.openpgp.SymmetricallyEncrypted and 17 | e2e.openpg.SymmetricallyEncryptedIntegrity 18 | 19 | 20 | 30 | 46 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/openpgp/packet/trust.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Trust packet. Not currently used, and ignored when imported. 19 | */ 20 | 21 | goog.provide('e2e.openpgp.packet.Trust'); 22 | 23 | goog.require('e2e.openpgp.packet.Packet'); 24 | goog.require('e2e.openpgp.packet.factory'); 25 | 26 | 27 | 28 | /** 29 | * @constructor 30 | * @extends {e2e.openpgp.packet.Packet} 31 | */ 32 | e2e.openpgp.packet.Trust = function() { 33 | e2e.openpgp.packet.Trust.base(this, 'constructor'); 34 | }; 35 | goog.inherits(e2e.openpgp.packet.Trust, 36 | e2e.openpgp.packet.Packet); 37 | 38 | 39 | /** @inheritDoc */ 40 | e2e.openpgp.packet.Trust.prototype.tag = 12; 41 | 42 | 43 | /** @override */ 44 | e2e.openpgp.packet.Trust.prototype.serializePacketBody = function() { 45 | return []; 46 | }; 47 | 48 | 49 | /** 50 | * @param {!e2e.ByteArray} body 51 | * @return {!e2e.openpgp.packet.Trust} 52 | */ 53 | e2e.openpgp.packet.Trust.parse = function(body) { 54 | return new e2e.openpgp.packet.Trust; 55 | }; 56 | 57 | 58 | e2e.openpgp.packet.factory.add(e2e.openpgp.packet.Trust); 59 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/openpgp/pgpmime/mimenode_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.openpgp.pgpmime.MimeNode 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/openpgp/pgpmime/pgpmail_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.openpgp.pgpmime.PgpMail 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/openpgp/pgpmime/text_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.openpgp.pgpmime.utils.Text 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/openpgp/pgpmime/text_test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2015 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Tests for the text utility methods. 19 | */ 20 | 21 | /** @suppress {extraProvide} */ 22 | goog.provide('e2e.openpgp.pgpmime.textTest'); 23 | 24 | goog.require('e2e.openpgp.pgpmime.Text'); 25 | goog.require('goog.testing.asserts'); 26 | goog.require('goog.testing.jsunit'); 27 | goog.setTestOnly(); 28 | 29 | var utils = e2e.openpgp.pgpmime.Text; 30 | 31 | var delimiter = '\r\n'; 32 | 33 | function testPrettyTextWrap() { 34 | var inputStr = '123 456 7890 12 3456 7890'; 35 | var expectedStr = '123 456' + delimiter + '7890 12' + delimiter + '3456 7890'; 36 | assertEquals(expectedStr, utils.prettyTextWrap(inputStr, 10, delimiter)); 37 | 38 | inputStr = '123456789' + delimiter + 'a b c'; 39 | expectedStr = '123456789' + delimiter + 'a b c'; 40 | assertEquals(expectedStr, utils.prettyTextWrap(inputStr, 10, delimiter)); 41 | 42 | inputStr = '123 456789abcd'; 43 | expectedStr = '123' + delimiter + '456789abcd'; 44 | assertEquals(expectedStr, utils.prettyTextWrap(inputStr, 10, delimiter)); 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/openpgp/pgpmime/utils_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Unit Test of e2e.openpgp.pgpmime.Utils 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/openpgp/providers/dualkeyprovider.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2015 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | goog.provide('e2e.openpgp.providers.DualKeyProvider'); 18 | 19 | goog.require('e2e.openpgp.providers.PublicKeyProvider'); 20 | goog.require('e2e.openpgp.providers.SecretKeyProvider'); 21 | 22 | 23 | 24 | /** 25 | * KeyProvider interface for both secret and public keys. 26 | * @interface 27 | * @extends {e2e.openpgp.providers.PublicKeyProvider} 28 | * @extends {e2e.openpgp.providers.SecretKeyProvider} 29 | */ 30 | e2e.openpgp.providers.DualKeyProvider = function() {}; 31 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/otr/context.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | /** 19 | * @fileoverview OTR context manager. 20 | * 21 | * @author rcc@google.com (Ryan Chan) 22 | */ 23 | 24 | goog.provide('e2e.otr.Context'); 25 | 26 | 27 | 28 | /** 29 | * Constructor for the context manager. 30 | * @interface 31 | */ 32 | e2e.otr.Context = function() {}; 33 | 34 | 35 | /** 36 | * Creates a signer based on the long term private key. 37 | * @return {!function(new: e2e.otr.Sig, !e2e.ByteArray)} The signer. 38 | */ 39 | e2e.otr.Context.prototype.getSigner; 40 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/otr/message/message.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Defines the Message interface. 19 | * 20 | * @author rcc@google.com (Ryan Chan) 21 | */ 22 | 23 | goog.provide('e2e.otr.message.Message'); 24 | 25 | 26 | 27 | goog.scope(function() { 28 | 29 | 30 | 31 | /** 32 | * An OTRv3 message. 33 | * @constructor 34 | * @param {!e2e.otr.Session} session The enclosing session. 35 | */ 36 | e2e.otr.message.Message = function(session) { 37 | //TODO(rcc): Remove when closure compiler issue #104 (@abstract) is resolved. 38 | assert(this.constructor != e2e.otr.message.Message); 39 | assert(goog.isFunction(this.constructor.process)); 40 | 41 | this.session_ = session; 42 | }; 43 | 44 | 45 | /** 46 | * Method called by session to prepare for sending. 47 | * @return {string} The message being sent. 48 | */ 49 | e2e.otr.message.Message.prototype.prepareSend = function() { 50 | return this.toString(); 51 | }; 52 | 53 | 54 | /** 55 | * Serializes a message to string. 56 | * @return {string} The serialized message. 57 | */ 58 | e2e.otr.message.Message.prototype.toString = goog.abstractMethod; 59 | 60 | 61 | }); // goog.scope 62 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/otr/serializable.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Defines the types used in the OTR protocol. 19 | * 20 | * @author rcc@google.com (Ryan Chan) 21 | */ 22 | 23 | goog.provide('e2e.otr.Serializable'); 24 | 25 | 26 | 27 | /** 28 | * An interface for serializing to Uint8Array. 29 | * @interface 30 | */ 31 | e2e.otr.Serializable = function() {}; 32 | 33 | 34 | /** 35 | * Provides a Uint8Array representation of the class. 36 | * @return {!Uint8Array} The serialized data. 37 | */ 38 | e2e.otr.Serializable.prototype.serialize = goog.abstractMethod; 39 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/otr/storable.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Defines types that can be safely serialized and deserialized 19 | * to/from JSON. 20 | * 21 | * @author rcc@google.com (Ryan Chan) 22 | */ 23 | 24 | goog.provide('e2e.otr.Storable'); 25 | 26 | 27 | 28 | /** 29 | * An interface for serializing to Uint8Array. 30 | * @constructor 31 | */ 32 | e2e.otr.Storable = function() { 33 | assert(this.constructor != e2e.otr.Storable); 34 | assert(goog.isFunction(this.constructor.unpack)); 35 | }; 36 | 37 | 38 | /** 39 | * Provides a JSON.stringify-able representation of the class. 40 | * @return {*} The serialized data. 41 | */ 42 | e2e.otr.Storable.prototype.pack = goog.abstractMethod; 43 | 44 | 45 | /** 46 | * Instantiates a class from a parsed JSON representation. 47 | * @param {*} json The parsed JSON representation. 48 | * @return {!e2e.otr.Storable} The class instance. 49 | */ 50 | e2e.otr.Storable.unpack = goog.abstractMethod; 51 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/otr/testing.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Defines tests for the OTR related helper functions. 19 | * 20 | * @author rcc@google.com (Ryan Chan) 21 | */ 22 | 23 | goog.setTestOnly('e2e.otr.testing'); 24 | goog.provide('e2e.otr.testing'); 25 | 26 | goog.require('goog.array'); 27 | goog.require('goog.testing.asserts'); 28 | 29 | 30 | /** 31 | * Compares two Uint8Arrays. 32 | * @param {*} a The expected array (2 args) or the debug message (3 args). 33 | * @param {*} b The actual array (2 args) or the expected array (3 args). 34 | * @param {*=} opt_c The actual array (3 args only). 35 | */ 36 | e2e.otr.testing.assertTypedArrayEquals = function(a, b, opt_c) { 37 | assertArrayEquals.apply(null, goog.array.map(arguments, function(e) { 38 | return e instanceof Uint8Array ? goog.array.clone(e) : e; 39 | })); 40 | }; 41 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/otr/types.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @fileoverview Defines the types used in the OTR protocol. 19 | * 20 | * @author rcc@google.com (Ryan Chan) 21 | */ 22 | 23 | goog.provide('e2e.otr.Byte'); 24 | goog.provide('e2e.otr.Ctr'); 25 | goog.provide('e2e.otr.Int'); 26 | goog.provide('e2e.otr.Mac'); 27 | goog.provide('e2e.otr.Policy'); 28 | goog.provide('e2e.otr.PublicKeyAny'); 29 | goog.provide('e2e.otr.Short'); 30 | 31 | 32 | /** 33 | * OTR protocol type Byte. 34 | * @typedef {Uint8Array} 35 | */ 36 | e2e.otr.Byte; 37 | 38 | 39 | /** 40 | * OTR protocol type Ctr. (8 bytes) 41 | * @typedef {Uint8Array} 42 | */ 43 | e2e.otr.Ctr; 44 | 45 | 46 | /** 47 | * OTR protocol type Int. (4 bytes) 48 | * @typedef {Uint8Array} 49 | */ 50 | e2e.otr.Int; 51 | 52 | 53 | /** 54 | * OTR protocol type Mac. (20 bytes) 55 | * @typedef {Uint8Array} 56 | */ 57 | e2e.otr.Mac; 58 | 59 | 60 | /** 61 | * OTR protocol type Short. (2 bytes) 62 | * @typedef {Uint8Array} 63 | */ 64 | e2e.otr.Short; 65 | 66 | 67 | /** 68 | * OTR policy configuration. 69 | * TODO: Clean up the typedef when closure-compiler #126 is resolved. 70 | * @typedef {{ALLOW_V1: boolean, ALLOW_V2: boolean, ALLOW_V3: boolean, 71 | * REQUIRE_ENCRYPTION: boolean, SEND_WHITESPACE_TAG: boolean, 72 | * WHITESPACE_START_AKE: boolean, ERROR_START_AKE: boolean}} 73 | */ 74 | e2e.otr.Policy; 75 | 76 | 77 | /** 78 | * Represents any public key type. 79 | * @typedef {e2e.signer.key.DsaPublicKey} 80 | */ 81 | e2e.otr.PublicKeyAny; 82 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/otr/util/tee.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | /** 19 | * @fileoverview Tee helper class. 20 | * 21 | * @author rcc@google.com (Ryan Chan) 22 | */ 23 | 24 | 25 | goog.provide('e2e.otr.util.Tee'); 26 | 27 | 28 | 29 | /** 30 | * Creates an instance of a Tee. Changing the underlying storage modifies data. 31 | * @constructor 32 | * @param {!e2e.ByteArray=} opt_storage Use a given ByteArray for storage. 33 | */ 34 | e2e.otr.util.Tee = function(opt_storage) { 35 | this.storage_ = opt_storage || []; 36 | }; 37 | 38 | 39 | /** 40 | * Tees the given data. 41 | * @template T 42 | * @param {T} data The data to tee. 43 | * @return {T} The data that was passed in. 44 | */ 45 | e2e.otr.util.Tee.prototype.tee = function(data) { 46 | /** 47 | * @param {!Uint8Array|!e2e.ByteArray} data The data to tee. 48 | * @return {!Uint8Array|!e2e.ByteArray} 49 | */ 50 | var fn = goog.bind(function() { 51 | Array.prototype.push.apply(this.storage_, data); 52 | return data; 53 | }, this); 54 | 55 | return fn(data); 56 | }; 57 | 58 | 59 | /** 60 | * Dumps the stored data. 61 | * @return {!e2e.ByteArray} The stored data. 62 | */ 63 | e2e.otr.util.Tee.prototype.dump = function() { 64 | return this.storage_; 65 | }; 66 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/otr/util/tee_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | Unit Test of e2e.otr.util.tee/ 17 | 18 | 19 | 24 | 49 | 50 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/pkcs/emsa_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | Unit test of e2e.pkcs.EMSA_PKCS1_v1_5 17 | 18 | 19 | 26 | 44 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/pkcs/pkcs.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2012 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | /** 19 | * @fileoverview Encodes. 20 | * @author evn@google.com (Eduardo Vela) 21 | */ 22 | 23 | goog.provide('e2e.pkcs.Error'); 24 | 25 | goog.require('goog.debug.Error'); 26 | 27 | 28 | /** 29 | * Represents errors triggered by PKCS. 30 | */ 31 | e2e.pkcs.Error = class extends goog.debug.Error { 32 | /** 33 | * @param {string} msg The message generated form pkcs. 34 | */ 35 | constructor(msg) { 36 | super(msg); 37 | } 38 | }; 39 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/random/hmacprf.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2013 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | /** 19 | * @fileoverview Implements a fixed-length PseudoRandom Function (PRF) based on 20 | * HMAC. 21 | * @see http://dl.acm.org/citation.cfm?id=2165352 22 | */ 23 | 24 | goog.provide('e2e.HmacPRF'); 25 | 26 | goog.require('e2e.hash.Algorithm'); 27 | goog.require('e2e.hash.Sha256'); 28 | goog.require('goog.asserts'); 29 | goog.require('goog.crypt.Hmac'); 30 | goog.require('goog.structs'); 31 | 32 | 33 | 34 | /** 35 | * @param {e2e.hash.Hash=} opt_hash Instance of hash to use. If not 36 | * specified, it is set to Sha256. 37 | * @constructor 38 | */ 39 | e2e.HmacPRF = function(opt_hash) { 40 | if (opt_hash != null) { 41 | goog.asserts.assert(goog.structs.contains(e2e.hash.Algorithm, 42 | opt_hash.algorithm), 43 | 'Invalid hash function.'); 44 | } 45 | this.hash_ = opt_hash || new e2e.hash.Sha256(); 46 | }; 47 | 48 | 49 | /** 50 | * Computes HmacPRF according to the formula HMAC(key, input). 51 | * @param {!e2e.ByteArray} key The secret key. 52 | * @param {!e2e.ByteArray} input The input to the HmacPRF. 53 | * @return {!e2e.ByteArray} Pseudorandom bytes with length is the digest 54 | * size of the underlying hash function. 55 | */ 56 | e2e.HmacPRF.prototype.getHmacPRF = function(key, input) { 57 | goog.asserts.assertObject(this.hash_, 'Hash function must be specified.'); 58 | 59 | var hmacer = new goog.crypt.Hmac(this.hash_, key, 64); 60 | return hmacer.getHmac(input); 61 | }; 62 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/random/hmacprf_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | Unit Test of e2e.hmacprf 17 | 18 | 19 | 25 | 35 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/scheme/eme.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014 Google Inc. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | /** 19 | * @fileoverview Simple wrapper for a cipher and EME PKCS1 v1.5. 20 | */ 21 | 22 | goog.require('e2e.pkcs.eme.Pkcs1'); 23 | goog.require('e2e.scheme.EncryptionScheme'); 24 | 25 | goog.provide('e2e.scheme.Eme'); 26 | 27 | 28 | 29 | /** 30 | * JavaScript implementation of EME PKCS1 v1.5. 31 | * @param {e2e.cipher.Cipher} cipher 32 | * @constructor 33 | * @extends {e2e.scheme.EncryptionScheme} 34 | */ 35 | e2e.scheme.Eme = function(cipher) { 36 | e2e.scheme.Eme.base(this, 'constructor', cipher); 37 | this.cipher = cipher; 38 | }; 39 | goog.inherits(e2e.scheme.Eme, e2e.scheme.EncryptionScheme); 40 | 41 | 42 | /** @override */ 43 | e2e.scheme.Eme.prototype.encryptJavaScript = function(plaintext) { 44 | return this.cipher.encrypt( 45 | new e2e.pkcs.eme.Pkcs1().encode( 46 | this.cipher.keySize, plaintext)); 47 | }; 48 | 49 | 50 | /** @override */ 51 | e2e.scheme.Eme.prototype.decryptJavaScript = function(ciphertext) { 52 | return this.cipher.decrypt(ciphertext).addCallback(function(m) { 53 | return new e2e.pkcs.eme.Pkcs1().decode(m); 54 | }); 55 | }; 56 | -------------------------------------------------------------------------------- /src/javascript/crypto/e2e/testing/util_test.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | Unit Test of e2e.testing.Util 17 | 18 | 19 | 22 | --------------------------------------------------------------------------------