cose

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseSecretPrivateKey

func ParseSecretPrivateKey(data []byte) (pk *ecdsa.PrivateKey, err error)

ParseSecretPrivateKey parses ecdsa priv key from encrypted data. Data is encrypted with our master key. If it isn't or data is corrupted function returns error.

func SetMasterKey

func SetMasterKey(hexKey string) (err error)

SetMasterKey set the master secret for this crypter. Need to be called before acator can be used. See AuthnCmd for more info.

func VerifyHashSig

func VerifyHashSig(key *ecdsa.PublicKey, data, sig []byte) bool

VerifyHashSig verifies signature of data's hash with ecdsa public key. The function is currently used only for testing our signatures are right.

Types

type Key

type Key struct {
	webauthncose.EC2PublicKeyData
	// contains filtered or unexported fields
}

func New

func New() (k *Key, err error)

New creates a new key.

func NewFromData

func NewFromData(data []byte) (k *Key, err error)

NewFromData used in testing.

func NewFromPrivateKey

func NewFromPrivateKey(priKey *ecdsa.PrivateKey) *Key

NewFromPrivateKey returns instance of our cose.Key where given priKey is in ecdsa fmt.

func (*Key) Marshal

func (k *Key) Marshal() ([]byte, error)

Marshal returns CBOR marshaled public key data.

func (*Key) NewPrivateKey

func (k *Key) NewPrivateKey() (err error)

func (*Key) ParseSecretPrivateKey

func (k *Key) ParseSecretPrivateKey(data []byte) (err error)

ParseSecretPrivateKey parses ecdsa priv key from encrypted data. Data is encrypted with our master key. If it isn't or data is corrupted function returns error. Called from acator!

func (*Key) Sign

func (k *Key) Sign(data []byte) (s []byte, err error)

Sign signs the data. Called from acator!

func (*Key) TryMarshalSecretPrivateKey

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

TryMarshalSecretPrivateKey marhalls our private key and encrypts it with the master key.

func (*Key) TryParseSecretPrivateKey

func (k *Key) TryParseSecretPrivateKey(data []byte)

TryParseSecretPrivateKey used from tests

func (*Key) Verify

func (k *Key) Verify(data, sig []byte) (ok bool)

Jump to

Keyboard shortcuts

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