sqrl

package module
v0.0.0-...-6042bb2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2014 License: MIT Imports: 21 Imported by: 0

README

sqrl

Go client and server implementation of the Secure QR Login (SQRL) protocol. See https://www.grc.com/sqrl/sqrl.htm for more information regarding SQRL.

Server implementation has a AuthHandler to verify signatures generated by https://github.com/geir54/android-sqrl

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Xor

func Xor(a, b []byte)

Xor sets a equal to a XOR b.

Types

type Client

type Client struct {
}

func (*Client) Authenticate

func (this *Client) Authenticate(id *Identity, password, siteUrl string, options Option) (request *http.Request, err error)

Authenticate

type Identity

type Identity struct {
	*Key
	Check   [checkLen]byte
	Salt    [saltLen]byte
	N, R, P int
}

func (*Identity) Authenticate

func (this *Identity) Authenticate(key *Key) bool

func (*Identity) ChangePassword

func (this *Identity) ChangePassword(old, new string) (ok bool, err error)

ChangePassword

type Key

type Key [keyLen]byte

Key represents a 256-bit cryptographic key.

func DeriveKey

func DeriveKey(password, salt []byte, N, r, p, n int) (key *Key, err error)

func (*Key) DomainKey

func (k *Key) DomainKey(domain string) (key *Key)

DomainKey returns the private key for domain. HMAC-SHA256 using k as the key and domain as the message to generate the 256-bit private key.

func (*Key) Hash

func (k *Key) Hash() []byte

Hash returns the SHA256 hash

func (*Key) PublicKey

func (k *Key) PublicKey() *Key

PublicKey returns the corresponding public key.

func (*Key) Sign

func (k *Key) Sign(msg []byte) (sig *Signature)

Sign returns the cryptographic signature of the []byte msg.

func (*Key) Verify

func (k *Key) Verify(msg []byte, sig *Signature) bool

Verify returns true if the cryptographic signature sig.

func (*Key) Xor

func (k *Key) Xor(key *Key)

type Nonce

type Nonce struct {
	// contains filtered or unexported fields
}

func NewNonce

func NewNonce() *Nonce

func (*Nonce) Generate

func (r *Nonce) Generate(remoteAddr string) string

Generate a 32 bytes (128 bits) nonce from ipv4 address, timestamp, counter and random as suggested in SQRL documentation (https://www.grc.com/sqrl/server.htm) Encode this with AES key generated at server start and return

type Option

type Option int
const (
	None Option = 1<<iota - 1
	Enforce
)

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer() *Server

func (*Server) AuthHandler

func (s *Server) AuthHandler() http.Handler

func (*Server) QRHandler

func (s *Server) QRHandler(path string) http.Handler

type Signature

type Signature [64]byte

Signature represents a 512-bit cryptographic signature.

type Version

type Version int
const (
	SQRL1 Version = iota
)

Directories

Path Synopsis
Examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL