All Projects → go-piv → Go Ykpiv

go-piv / Go Ykpiv

Licence: mit
Golang interface to manage Yubikeys, including a crypto.Signer & crypto.Decrypter interface

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Go Ykpiv

Decentralized Internet
A SDK/library for decentralized web and distributing computing projects
Stars: ✭ 406 (+107.14%)
Mutual labels:  library, cryptography
Datasafe
Datasafe - flexible and secure data storage and document sharing using cryptographic message syntax for data encryption
Stars: ✭ 32 (-83.67%)
Mutual labels:  library, cryptography
Pgsodium
Modern cryptography for PostgreSQL using libsodium.
Stars: ✭ 202 (+3.06%)
Mutual labels:  library, cryptography
Nim Libsodium
Nim wrapper for the libsodium library
Stars: ✭ 32 (-83.67%)
Mutual labels:  library, cryptography
Bitcoin Cryptography Library
Nayuki's implementation of cryptographic primitives used in Bitcoin.
Stars: ✭ 81 (-58.67%)
Mutual labels:  library, cryptography
Yubikey Agent
yubikey-agent is a seamless ssh-agent for YubiKeys.
Stars: ✭ 1,744 (+789.8%)
Mutual labels:  cryptography, yubikey
Rando.js
The world's easiest, most powerful random function.
Stars: ✭ 659 (+236.22%)
Mutual labels:  library, cryptography
Quantumgate
QuantumGate is a peer-to-peer (P2P) communications protocol, library and API written in C++.
Stars: ✭ 62 (-68.37%)
Mutual labels:  library, cryptography
Yubikeylockd
Simple daemon for locking and unlocking macOS with Yubikey
Stars: ✭ 78 (-60.2%)
Mutual labels:  cryptography, yubikey
Libsodium Go
A complete overhaul of the Golang wrapper for libsodium
Stars: ✭ 105 (-46.43%)
Mutual labels:  library, cryptography
Piv Go
Keys and certificates for YubiKeys, written in Go
Stars: ✭ 172 (-12.24%)
Mutual labels:  cryptography, yubikey
Blockchain Crypto Mpc
Protecting cryptographic signing keys and seed secrets with Multi-Party Computation.
Stars: ✭ 193 (-1.53%)
Mutual labels:  cryptography
Ruma
A set of Rust crates for interacting with the Matrix chat network.
Stars: ✭ 189 (-3.57%)
Mutual labels:  library
Rpi Backlight
🔆 A Python module for controlling power and brightness of the official Raspberry Pi 7" touch display
Stars: ✭ 190 (-3.06%)
Mutual labels:  library
Ctf Tools
Useful CTF Tools
Stars: ✭ 190 (-3.06%)
Mutual labels:  cryptography
Nginx Sso
SSO authentication provider for the auth_request nginx module
Stars: ✭ 195 (-0.51%)
Mutual labels:  yubikey
Awesome Iam
👤 Identity and Access Management Knowledge for Cloud Platforms
Stars: ✭ 186 (-5.1%)
Mutual labels:  cryptography
Libmoji
📚 Bitmoji's API made easy for everyone
Stars: ✭ 189 (-3.57%)
Mutual labels:  library
Oauthlib
A generic, spec-compliant, thorough implementation of the OAuth request-signing logic
Stars: ✭ 2,323 (+1085.2%)
Mutual labels:  library
Simple Web Server
A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio. Created to be an easy way to make REST resources available from C++ applications.
Stars: ✭ 2,261 (+1053.57%)
Mutual labels:  library

go-ykpiv

go-ykpiv is a high level cgo wrapper around libykpiv.so.1 that implements an idiomatic go API fit for use when applications need to communicate with a Yubikey in PIV mode.

What's PIV?

PIV Cards are cards defined by FIPS 201, a Federal US Government standard defining the ID cards employees use. At its core, it's a set of x509 Certificates and corresponding private keys in a configuration that is standardized across implementations.

For more details on how PIV Tokens can be used, the FICAM (Federal Identity, Credential, and Access Management) team at GSA (General Services Administration) has published some guides on GitHub under GSA/piv-guides

How is this different than OpenSC?

Most PIV tokens, Yubikeys included, can be used as a PKCS#11 device using OpenSC, and Yubikeys are even capable of doing Signing and Decryption through that interface. However, some management functions are not exposed in the PKCS#11 OpenSC interface, so this library may be of use when one wants to write a new Certificate, or set PINs.

Development

Testing

To run the tests, you'll need to find a Yubikey that you're willing to wipe clean, and destroy all data on it. After you've found such a key, remove all other Yubikeys from your machine.

The tests will panic if the YKPIV_YES_DESTROY_MY_KEY environment variable is unset.

Running the tests will reset your Yubikey a few times (once per test), and you will wind up with a key with the default PIN, PUK and Management Key.

Installation

Debian

sudo apt install build-essential libykpiv-dev
go get pault.ag/go/ykpiv

MacOS X

brew install yubico-piv-tool
go get pault.ag/go/ykpiv

Examples

package main

import (
	"fmt"

	"pault.ag/go/ykpiv"
)

func main() {
	yubikey, err := ykpiv.New(ykpiv.Options{
		// Verbose: true,
		Reader: "Yubico Yubikey NEO U2F+CCID 01 00",
	})
	if err != nil {
		panic(err)
	}
	defer yubikey.Close()

	version, err := yubikey.Version()
	if err != nil {
		panic(err)
	}
	fmt.Printf("Application version %s found.\n", version)
}

Running on Windows

  1. Download yubico-piv-tool-1.7.0-win64.zip from the official site
  2. Create directory win in the root of the project
  3. Copy lib and include directories from the downloaded archive to the win directory
  4. Copy all DLLs from the bin directory in the archive to the root of your project
  5. Copy libwinpthread-1.dll from C:\TDM-GCC-64\bin to the root of your project

Related work

Eric Chiang has published piv-go, a go implementation of the yubikey piv bindings.

LICENSE

Copyright (c) Paul R. Tagliamonte <[email protected]>, 2017

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].