Giter Club home page Giter Club logo

pkcs11mod's Introduction

Namecoin

Namecoin is a decentralized key/value registration and transfer system based on Bitcoin technology (a decentralized cryptocurrency).

It can be used for multiple purposes, for example a secure and censorship resistant replacement for DNS.

Ownership of a name is based on ownership of a coin, which is in turn based on public key cryptography. The namecoin network reaches consensus every few minutes as to which names have been reserved or updated.

There is a FAQ.md to answer some general questions.

See http://namecoin.info or http://dot-bit.org for more information.

Technical

The Bitcoin protocol is augmented with namecoin operations, to reserve, register and update names. In addition to DNS like entries, arbitrary name/value pairs are allowed and multiple namespaces will be available. This will include a personal handle namespace mapping handles to public keys and personal address data.

The protocol differences from bitcoin include:

  • Different blockchain, port, IRC bootstrap and message header
  • New transaction types: new, first-update, update
  • Validation on the new transaction types
  • RPC calls for managing names
  • Network fees to slow down the initial rush

Please read DESIGN-namecoind.md for details.

BUILDING

Building is supported on Linux, Windows and Mac. For building on windows you can use the scripts in ./contrib/easywinbuilder. Find build instructions on https://wiki.namecoin.info/index.php?title=Build_Namecoin_From_Source.

pkcs11mod's People

Contributors

aerth avatar bernard-wagner avatar jeremyrand avatar robertmin1 avatar yorubad-dev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pkcs11mod's Issues

Add p11tool tests

p11tool is the GnuTLS equivalent of NSS's certutil. We should add tests for it, by having it open modules via pkcs11proxy and p11proxy and making sure the behavior doesn't change.

Test p11proxy with OpenDNSSEC

We currently test OpenDNSSEC with pkcs11proxy, but not p11proxy. We should add tests for p11proxy with OpenDNSSEC.

C_GetFunctionList not exported on Windows

According to Dependencies, pkcs11proxy.dll is not exporting C_GetFunctionList on Windows. This is probably why I can't get the module to load in Firefox and certutil on Windows. Probably this is due to the changes introduced by golang/go#30674 , which makes sense given that this worked a few years ago.

Find more software to test with

Potential places to look:

  • Search GitHub or https://sources.debian.org/ or https://searchfox.org/ for C_GetFunctionList and other PKCS#11 function names (especially function names that we currently don't implement in p11mod).
  • Search GitHub or package repos or Repology for pkcs11 or p11.
  • Search the dependency graph for other software that uses the PKCS#11 libs that are used in our current tests.

Once you find something, create an issue, or jump right in and add integration tests in a PR. If your integration tests don't pass (perhaps because of a bug in pkcs11mod) but you believe they are useful, that's fine, you can submit them anyway, and we can just instruct Cirrus to allow failure on them.

Add Debian tests

Debian's p11-kit situation is less mature than Fedora's, so worth testing there.

Remove log file paths

The log file paths in init() should really be part of the backend implementation (e.g. ncp11), not pkcs11mod.

Relicense to LGPLv2+?

@aerth @bernard-wagner are you okay with relicensing pkcs11mod (and ncp11) from LGPLv3+ to LGPLv2+? This would allow pkcs11mod to be used with applications licensed under GPLv2. While I am personally very skeptical that loading a PKCS#11 module into an application is legally capable of creating a derivative work (I think PKCS#11 is an interface, so a copyright license like GPL cannot jump across it), there is not much (if any?) case law on this, and the legal uncertainty is not really desirable for us. Also it's not great that pkcs11mod is more compatible with non-free software than with GPLv2 software.

Test more Chromium variants

Test multiple modules

We should test what happens if two PKCS#11 modules that are both created via pkcs11mod are loaded simultaneously by the same application. (It is conceivable that their Go runtimes might conflict.)

Log process ID + process name

We should consider logging the PID (os.Getpid()) and process name (os.Args[0] and os.Executable()). This would help for debugging things such as Chromium-specific "built-in trust anchor" disabling, and per-process Tor stream isolation. Maybe also the thread ID (syscall.Gettid()).

Test tstclnt on Windows

We should test NSS tstclnt on Windows. This would be easier if tstclnt binaries were readily available.

Investigate PKCS#11 support in GnuTLS on Debian

Running strace gnutls-cli www.namecoin.org on Fedora 34 finds a bunch of references to PKCS#11 modules, including p11-kit-trust.so. These references don't appear on Debian 11, which seems to indicate that PKCS#11 is not being used for certificate trust in GnuTLS on Debian. This might be related to Debian not using the --with-default-trust-store-pkcs11=pkcs11: configure flag. However, on Debian, the library libp11-kit.so.0 is loaded, which might indicate some kind of p11-kit misconfiguration rather than a GnuTLS issue. Not sure. We should investigate further. The p11-kit devs might be able to help.

Add Softoken tests

Softoken is the NSS mutable (sqlite-based) certificate database PKCS#11 module. We should add tests for it, by putting it behind pkcs11proxy and p11proxy and making sure the behavior doesn't change.

Add wget tests

wget appears to use GnuTLS, so we should be able to test it easily.

Support tracing in logs

It would be helpful for debugging purposes if pkcs11mod and p11mod could log traces of which functions are being called, with what arguments. This could be enabled via an environment variable. Such functionality is a privacy risk (e.g. it could be used to investigate which .bit domains were accessed in ncp11), so it should come with a warning.

Implement missing p11mod functions

A lot of functions that exist in pkcs11mod are unimplemented in p11mod. The easy way to find them is by grepping p11mod.go for CKR_FUNCTION_NOT_SUPPORTED. It would be desirable to implement them.

Note that some of those functions may be impossible to implement due to limitations of the p11 API. There are plenty that will work fine though, so if you see one that looks problematic, pick another one -- lots of low-hanging fruit.

Test p11proxy with Chromium

We currently test Chromium with pkcs11proxy, but not p11proxy. We should add tests for p11proxy with Chromium.

Add Chromium tests

We should be able to use the screenshot trick like we did for Firefox.

"p11mod": support for high-level miekg/pkcs11/p11 API

miekg/pkcs11 includes a high-level API under the p11 subpackage. It would be interesting to produce a PKCS#11 module using pkcs11mod that proxies the commands to a package that exposes the p11 API. So the end-to-end testing would look like:

(PKCS#11 test app in C) --> (C ABI PKCS#11 commands) --> (pkcs11mod) --> (p11mod) --> (p11) --> (pkcs11) --> (C ABI PKCS#11 commands) --> (PKCS#11 module in C)

The main benefit here is that the p11 API is much more user-friendly to implement modules with than the pkcs11 API, which makes it easier to audit the modules.

Add pkcs11-tool tests

pkcs11-tool is the OpenSC equivalent of NSS's certutil and GnuTLS's p11tool. We should add tests for it, by having it open modules via pkcs11proxy and p11proxy and making sure the behavior doesn't change.

Add Base Browser tests

Base Browser is a browser maintained by the Tor Browser Team; it's basically Tor Browser without Tor. Similar in concept to Kicksecure's SecBrowser. We should add tests for Base Browser.

Add certutil+CKBI tests

We should add some tests that use certutil to dump certs and trust objects from CKBI. Probably the tlsrestrictnss code is a good guide for what commands to run.

Missing license file

The license is specified in the readme, but not in a dedicated file, which makes it hard for bots to determine the license. We should fix that.

pkcs11proxy triggers a Go panic if the target module isn't found

If pkcs11proxy is built with a target module path that doesn't exist, it will cause a Go panic:

pkcs11proxy changed line:

backend := pkcs11.New("/usr/lib64/pkcs11/p11-kit-trustX.so") // This path does not exist

Result:

$ /usr/lib64/nss/unsupported-tools/tstclnt -R ./libmypkcs11module.so  -D -h www.namecoin.org

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7fffbc461d68]

goroutine 17 [running, locked to thread]:
github.com/miekg/pkcs11.(*Ctx).Initialize.func1(0x0, 0x7fffbc3c191c)
	/home/user/go/pkg/mod/github.com/miekg/[email protected]/pkcs11.go:805 +0x38
github.com/miekg/pkcs11.(*Ctx).Initialize(0x0, 0x1, 0x7fffbc540001)
	/home/user/go/pkg/mod/github.com/miekg/[email protected]/pkcs11.go:805 +0x40
github.com/namecoin/pkcs11mod.Go_Initialize(...)
	/home/user/Downloads/pkcs11mod/pkcs11mod.go:68
Aborted (core dumped)

Obviously a nil backend isn't expected to do anything useful, but pkcs11mod should handle this more gracefully than panicking; the application may be able to cope with an erroring PKCS#11 module as long as the module doesn't panic.

Add osclientcerts tests

osclientcerts is the Firefox PKCS#11 module that reflects client certificates from the Windows and macOS OS-wide cert store. We should add tests for it, by putting it behind pkcs11proxy and p11proxy and making sure the behavior doesn't change.

Add gccgo builds

We should add gccgo builds. AFAIK gccgo handles cgo somewhat differently from Google's compiler, so this might require refactoring the build scripts.

Rename Cirrus tasks with prefixes

Currently, naming of Cirrus tasks doesn't follow a clear convention, which makes sorting difficult. We should rename them with common prefixes like Lint, Test, and Compile.

CloseAllSessions is unimplemented

Currently, CloseAllSessions is unimplemented. NSS's modutil and certutil seem to call it, so it's somewhat relevant to Namecoin, although nothing obviously bad seems to happen when it's unimplemented.

Retry browser tests when they report a conection failure

The browser tests (Chromium/Firefox) seem to be very sensitive to network issues, and will often report a connection failure; this causes spurious Cirrus failures for us. It would be desirable to retry those tests a few times if a connection failure happens. Preferably do not retry if a certificate error is reported (not sure how easy it is to disambiguate the two).

Add GNOME Web tests

GNOME Web uses GnuTLS, so we should be able to test it. Not sure if headless operation will be a problem though.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.