Documentation
¶
Index ¶
- Variables
- func GetRealForce() bool
- func ImportManagementKey(b []byte) (*proto.YubiManagementKey, error)
- func IsDefaultPIN(pin proto.YubiPIN) bool
- func SenseCard() bool
- type Bus
- type BusBase
- type BusType
- type Card
- type Dispatch
- func (d *Dispatch) AccessPQKey(ctx context.Context, i proto.YubiKeyInfo) (*KeySuitePQ, error)
- func (d *Dispatch) ClearSecrets()
- func (d *Dispatch) Explore(ctx context.Context, i proto.YubiCardID) (*proto.YubiCardInfo, error)
- func (d *Dispatch) FindCardBySerial(ctx context.Context, serial proto.YubiSerial) (*proto.YubiCardInfo, error)
- func (d *Dispatch) FindCardIDBySerial(ctx context.Context, serial proto.YubiSerial) (*proto.YubiCardID, error)
- func (d *Dispatch) GenerateKey(ctx context.Context, i proto.YubiCardID, slot proto.YubiSlot, r proto.Role, ...) (*KeySuite, error)
- func (d *Dispatch) GenerateKeyHybrid(ctx context.Context, i proto.YubiCardID, slot proto.YubiSlot, ...) (*KeySuiteHybrid, error)
- func (d *Dispatch) GenerateKeyPQ(ctx context.Context, i proto.YubiCardID, slot proto.YubiSlot, ...) (*KeySuitePQ, error)
- func (d *Dispatch) GetBusType() BusType
- func (d *Dispatch) GetManagementKey(ctx context.Context, i proto.YubiCardID) (*proto.YubiManagementKey, error)
- func (d *Dispatch) HasDefaultManagementKey(ctx context.Context, id proto.YubiCardID) (bool, error)
- func (d *Dispatch) InputPIN(ctx context.Context, id proto.YubiCardID, pin proto.YubiPIN) (proto.ManagementKeyState, error)
- func (d *Dispatch) ListCards(ctx context.Context) ([]proto.YubiCardID, error)
- func (d *Dispatch) Load(ctx context.Context, i proto.YubiKeyInfo, r proto.Role, h proto.HostID) (*KeySuite, error)
- func (d *Dispatch) LoadHybrid(ctx context.Context, i proto.YubiKeyInfoHybrid, r proto.Role, h proto.HostID) (*KeySuiteHybrid, error)
- func (d *Dispatch) LoadPQ(ctx context.Context, i proto.YubiKeyInfoHybrid) (*KeySuitePQ, error)
- func (d *Dispatch) NextTestKey(ctx context.Context, t *testing.T, role proto.Role, h proto.HostID) *KeySuiteHybrid
- func (d *Dispatch) ResetPINandPUK(ctx context.Context, id proto.YubiCardID, mk proto.YubiManagementKey, ...) error
- func (d *Dispatch) SenseCard() bool
- func (d *Dispatch) SetManagementKey(ctx context.Context, id proto.YubiCardID, old *proto.YubiManagementKey, ...) error
- func (d *Dispatch) SetOrGetManagementKey(ctx context.Context, id proto.YubiCardID, pin proto.YubiPIN) (*proto.YubiManagementKey, bool, error)
- func (d *Dispatch) SetPIN(ctx context.Context, id proto.YubiCardID, old proto.YubiPIN, new proto.YubiPIN) error
- func (d *Dispatch) SetPUK(ctx context.Context, id proto.YubiCardID, old proto.YubiPUK, new proto.YubiPUK) error
- func (d *Dispatch) ValidatePIN(ctx context.Context, id proto.YubiCardID, pin proto.YubiPIN, doUnlock bool) error
- func (d *Dispatch) ValidatePUK(ctx context.Context, id proto.YubiCardID, puk proto.YubiPUK) error
- type ECDSAKeypair
- type GenerateKeyOpts
- type Handle
- type KeyLoc
- type KeySuite
- func (k *KeySuite) BoxFor(o core.CryptoPayloader, r core.PublicBoxer, opts core.BoxOpts) (*proto.Box, error)
- func (k *KeySuite) CertSigner() (core.EntityPrivate, error)
- func (k *KeySuite) DHType() proto.DHType
- func (k *KeySuite) EntityID() (proto.EntityID, error)
- func (k *KeySuite) EntityPublic() (core.EntityPublic, error)
- func (k *KeySuite) ExportDHPublicKey(inContextOfSigKey bool) proto.DHPublicKey
- func (k *KeySuite) ExportHEPK() (*proto.HEPK, error)
- func (k *KeySuite) ExportKeySuite() (*proto.KeySuite, error)
- func (k *KeySuite) ExportToMember(h proto.HostID) (*proto.Member, error)
- func (k *KeySuite) Fuse(kks *KeySuitePQ) *KeySuiteHybrid
- func (k *KeySuite) GetRole() proto.Role
- func (k *KeySuite) HasSubkey() bool
- func (k *KeySuite) HostID() proto.HostID
- func (k *KeySuite) ID() proto.YubiID
- func (k *KeySuite) PrivateKeyForCert() (crypto.PrivateKey, error)
- func (k *KeySuite) Publicize(hostID *proto.HostID) (core.PublicSuiter, error)
- func (k *KeySuite) PublicizeToBoxer() (core.PublicBoxer, error)
- func (k *KeySuite) Role() proto.Role
- func (k *KeySuite) RollingEntityID() (proto.EntityID, error)
- func (k *KeySuite) Sign(obj core.Verifiable) (*proto.Signature, error)
- func (k *KeySuite) UnboxFor(o core.CryptoPayloader, box proto.Box, sender core.PublicBoxer) (core.DHPublicKey, error)
- func (k *KeySuite) UnboxForEphemeral(o core.CryptoPayloader, box proto.Box, sender proto.DHPublicKey) error
- func (k *KeySuite) UnboxForIncludedEphemeral(o core.CryptoPayloader, box proto.Box) error
- func (k *KeySuite) Verify(s proto.Signature, obj core.Verifiable) error
- type KeySuiteCore
- type KeySuiteHybrid
- func (k *KeySuiteHybrid) BoxFor(o core.CryptoPayloader, rec core.PublicBoxer, opts core.BoxOpts) (*proto.Box, error)
- func (k *KeySuiteHybrid) ExportHEPK() (*proto.HEPK, error)
- func (k *KeySuiteHybrid) ExportKeySuite() (*proto.KeySuite, error)
- func (k *KeySuiteHybrid) ExportToMember(h proto.HostID) (*proto.Member, error)
- func (k *KeySuiteHybrid) ExportToYubiKeyInfo(ctx context.Context) (*proto.YubiKeyInfoHybrid, error)
- func (k *KeySuiteHybrid) KemDecap() proto.KemDecapKey
- func (k *KeySuiteHybrid) Publicize(hostID *proto.HostID) (core.PublicSuiter, error)
- func (k *KeySuiteHybrid) PublicizeToBoxer() (core.PublicBoxer, error)
- func (k *KeySuiteHybrid) UnboxFor(o core.CryptoPayloader, box proto.Box, sender core.PublicBoxer) (core.DHPublicKey, error)
- func (k *KeySuiteHybrid) UnboxForEphemeral(o core.CryptoPayloader, box proto.Box, sender proto.DHPublicKey) error
- type KeySuitePQ
- type MockBus
- type MockCard
- func (m *MockCard) Attest(slot piv.Slot) (*x509.Certificate, error)
- func (c *MockCard) ClearPIN()
- func (m *MockCard) Close() error
- func (m *MockCard) GenerateKey(mks []byte, slot piv.Slot, desc piv.Key) (crypto.PublicKey, error)
- func (c *MockCard) GetManagementKey(pin proto.YubiPIN) (*proto.YubiManagementKey, error)
- func (c *MockCard) HasDefaultManagementKey() (bool, error)
- func (k *MockCard) Name() string
- func (m *MockCard) PrivateKey(slot piv.Slot, pub crypto.PublicKey, auth piv.KeyAuth) (crypto.PrivateKey, error)
- func (m *MockCard) Serial() (proto.YubiSerial, error)
- func (c *MockCard) SetManagementKey(old *proto.YubiManagementKey, key proto.YubiManagementKey) error
- func (c *MockCard) SetOrGetManagementKey(pin proto.YubiPIN) (*proto.YubiManagementKey, bool, error)
- func (c *MockCard) SetPIN(old, new proto.YubiPIN) error
- func (c *MockCard) SetPUK(old, new proto.YubiPUK) error
- func (c *MockCard) SetRetries(mk proto.YubiManagementKey, pin int, puk int) error
- func (m *MockCard) SharedKey(priv crypto.PrivateKey, pub *ecdsa.PublicKey) ([]byte, error)
- func (c *MockCard) ValidatePIN(p proto.YubiPIN) error
- func (c *MockCard) ValidatePUK(puk proto.YubiPUK) error
- type MockYubiSeed
- type Prepper
- type RealBus
- type RealCard
- func (c *RealCard) Attest(slot piv.Slot) (*x509.Certificate, error)
- func (c *RealCard) Close() error
- func (c *RealCard) GenerateKey(mgmtKey []byte, slot piv.Slot, key piv.Key) (crypto.PublicKey, error)
- func (c *RealCard) GetManagementKey(pin proto.YubiPIN) (*proto.YubiManagementKey, error)
- func (c *RealCard) HasDefaultManagementKey() (bool, error)
- func (c *RealCard) PrivateKey(slot piv.Slot, pk crypto.PublicKey, auth piv.KeyAuth) (crypto.PrivateKey, error)
- func (c *RealCard) Serial() (proto.YubiSerial, error)
- func (c *RealCard) SetManagementKey(oldp *proto.YubiManagementKey, new proto.YubiManagementKey) error
- func (c *RealCard) SetOrGetManagementKey(pin proto.YubiPIN) (*proto.YubiManagementKey, bool, error)
- func (c *RealCard) SetPIN(old, new proto.YubiPIN) error
- func (c *RealCard) SetPUK(old, new proto.YubiPUK) error
- func (c *RealCard) SetRetries(mk proto.YubiManagementKey, pinRetries, pukRetries int) error
- func (c *RealCard) SharedKey(priv crypto.PrivateKey, receiver *ecdsa.PublicKey) ([]byte, error)
- func (c *RealCard) ValidatePIN(pin proto.YubiPIN) error
- func (c *RealCard) ValidatePUK(puk proto.YubiPUK) error
Constants ¶
This section is empty.
Variables ¶
var SlotMax = proto.YubiSlot(0x95)
var SlotMin = proto.YubiSlot(0x82)
Functions ¶
func GetRealForce ¶
func GetRealForce() bool
func ImportManagementKey ¶
func ImportManagementKey(b []byte) (*proto.YubiManagementKey, error)
func IsDefaultPIN ¶
Types ¶
type BusBase ¶
func (*BusBase) ClearSecrets ¶
func (b *BusBase) ClearSecrets()
type Card ¶
type Card interface { Serial() (proto.YubiSerial, error) PrivateKey(piv.Slot, crypto.PublicKey, piv.KeyAuth) (crypto.PrivateKey, error) Attest(piv.Slot) (*x509.Certificate, error) Close() error GenerateKey([]byte, piv.Slot, piv.Key) (crypto.PublicKey, error) // PIN/PUK etc: ValidatePIN(pin proto.YubiPIN) error ValidatePUK(puk proto.YubiPUK) error SetPIN(old, new proto.YubiPIN) error SetPUK(old, new proto.YubiPUK) error HasDefaultManagementKey() (bool, error) GetManagementKey(pin proto.YubiPIN) (*proto.YubiManagementKey, error) SetManagementKey(old *proto.YubiManagementKey, new proto.YubiManagementKey) error // SetOrGetManagement key is a mix of both Get and Set above, but keeps a lock // between the two operations. Return true if made a new key, and false if // just returning the existing key. SetOrGetManagementKey(pin proto.YubiPIN) (*proto.YubiManagementKey, bool, error) // Resets the PIN and PUK SetRetries(proto.YubiManagementKey, int, int) error }
type Dispatch ¶
type Dispatch struct {
// contains filtered or unexported fields
}
func AllocDispatch ¶
func AllocDispatch( seed MockYubiSeed, ) ( *Dispatch, error, )
func AllocDispatchTest ¶
func (*Dispatch) AccessPQKey ¶
func (d *Dispatch) AccessPQKey( ctx context.Context, i proto.YubiKeyInfo, ) ( *KeySuitePQ, error, )
AccessPQKey uses a preexsiting ECDSA key as a PQ KEM seed slot. It should not be used to create new keys, since that would imply reusing an ECDSA key as a PQKey, which is dangerous. However, it can be used safely in "yubi provision", which accesses a previously-allocated PQKey.
func (*Dispatch) ClearSecrets ¶
func (d *Dispatch) ClearSecrets()
func (*Dispatch) Explore ¶
func (d *Dispatch) Explore( ctx context.Context, i proto.YubiCardID, ) (*proto.YubiCardInfo, error)
func (*Dispatch) FindCardBySerial ¶
func (d *Dispatch) FindCardBySerial( ctx context.Context, serial proto.YubiSerial, ) (*proto.YubiCardInfo, error)
func (*Dispatch) FindCardIDBySerial ¶
func (d *Dispatch) FindCardIDBySerial( ctx context.Context, serial proto.YubiSerial, ) (*proto.YubiCardID, error)
func (*Dispatch) GenerateKey ¶
func (*Dispatch) GenerateKeyHybrid ¶
func (*Dispatch) GenerateKeyPQ ¶
func (d *Dispatch) GenerateKeyPQ( ctx context.Context, i proto.YubiCardID, slot proto.YubiSlot, opts *GenerateKeyOpts, ) ( *KeySuitePQ, error, )
func (*Dispatch) GetBusType ¶
func (*Dispatch) GetManagementKey ¶
func (d *Dispatch) GetManagementKey( ctx context.Context, i proto.YubiCardID, ) ( *proto.YubiManagementKey, error, )
func (*Dispatch) HasDefaultManagementKey ¶
func (*Dispatch) InputPIN ¶
func (d *Dispatch) InputPIN( ctx context.Context, id proto.YubiCardID, pin proto.YubiPIN, ) ( proto.ManagementKeyState, error, )
func (*Dispatch) LoadHybrid ¶
func (*Dispatch) LoadPQ ¶
func (d *Dispatch) LoadPQ( ctx context.Context, i proto.YubiKeyInfoHybrid, ) ( *KeySuitePQ, error, )
func (*Dispatch) NextTestKey ¶
func (*Dispatch) ResetPINandPUK ¶
func (*Dispatch) SetManagementKey ¶
func (d *Dispatch) SetManagementKey( ctx context.Context, id proto.YubiCardID, old *proto.YubiManagementKey, new proto.YubiManagementKey, ) error
func (*Dispatch) SetOrGetManagementKey ¶
func (*Dispatch) ValidatePIN ¶
func (*Dispatch) ValidatePUK ¶
type ECDSAKeypair ¶
type ECDSAKeypair struct {
// contains filtered or unexported fields
}
func NewECDSAKeyPair ¶
func NewECDSAKeyPair(pp piv.PINPolicy) (*ECDSAKeypair, error)
type GenerateKeyOpts ¶
type GenerateKeyOpts struct {
LockWithPIN bool
}
func (*GenerateKeyOpts) PINPolicy ¶
func (o *GenerateKeyOpts) PINPolicy() piv.PINPolicy
type Handle ¶
func (*Handle) ManagementKey ¶
func (h *Handle) ManagementKey() *proto.YubiManagementKey
func (*Handle) SetManagementKey ¶
func (h *Handle) SetManagementKey(mk *proto.YubiManagementKey)
type KeySuite ¶
type KeySuite struct { KeySuiteCore // contains filtered or unexported fields }
func NewKeySuite ¶
func (*KeySuite) BoxFor ¶
func (k *KeySuite) BoxFor(o core.CryptoPayloader, r core.PublicBoxer, opts core.BoxOpts) (*proto.Box, error)
func (*KeySuite) CertSigner ¶
func (k *KeySuite) CertSigner() (core.EntityPrivate, error)
func (*KeySuite) EntityPublic ¶
func (k *KeySuite) EntityPublic() (core.EntityPublic, error)
func (*KeySuite) ExportDHPublicKey ¶
func (k *KeySuite) ExportDHPublicKey(inContextOfSigKey bool) proto.DHPublicKey
func (*KeySuite) ExportToMember ¶
func (*KeySuite) Fuse ¶
func (k *KeySuite) Fuse(kks *KeySuitePQ) *KeySuiteHybrid
func (*KeySuite) PrivateKeyForCert ¶
func (k *KeySuite) PrivateKeyForCert() (crypto.PrivateKey, error)
func (*KeySuite) PublicizeToBoxer ¶
func (k *KeySuite) PublicizeToBoxer() (core.PublicBoxer, error)
func (*KeySuite) UnboxFor ¶
func (k *KeySuite) UnboxFor( o core.CryptoPayloader, box proto.Box, sender core.PublicBoxer, ) ( core.DHPublicKey, error, )
func (*KeySuite) UnboxForEphemeral ¶
func (k *KeySuite) UnboxForEphemeral( o core.CryptoPayloader, box proto.Box, sender proto.DHPublicKey, ) error
func (*KeySuite) UnboxForIncludedEphemeral ¶
type KeySuiteCore ¶
type KeySuiteCore struct {
// contains filtered or unexported fields
}
func (*KeySuiteCore) ExportToYubiKeyInfo ¶
func (k *KeySuiteCore) ExportToYubiKeyInfo(ctx context.Context) (*proto.YubiKeyInfoHybrid, error)
func (*KeySuiteCore) GenerateSelfSecret ¶
func (k *KeySuiteCore) GenerateSelfSecret(ctx context.Context) (*proto.SecretSeed32, error)
Outputs g^x^2, which is roughly as secret as x if g^x isn't used anywhere else. We can in turn use this 32-byte secret as a seed for a PQ key. I wish there were a better way to put/get a secret to a yubikey, but so far, this is the best bet. The issue here is that this key might be used down the line somewhere else, opening existing FOKS data to quantum attacks. But the hope here is that all necessary FOKS information is contained on the yubikey, and never written down to storage locally, so this is a reasonable compromise, for now. Once yubikeys support PQ algorithms, we can do way better.
type KeySuiteHybrid ¶
type KeySuiteHybrid struct { KeySuite Pq KeySuitePQ }
func (*KeySuiteHybrid) BoxFor ¶
func (k *KeySuiteHybrid) BoxFor(o core.CryptoPayloader, rec core.PublicBoxer, opts core.BoxOpts) (*proto.Box, error)
func (*KeySuiteHybrid) ExportHEPK ¶
func (k *KeySuiteHybrid) ExportHEPK() (*proto.HEPK, error)
func (*KeySuiteHybrid) ExportKeySuite ¶
func (k *KeySuiteHybrid) ExportKeySuite() (*proto.KeySuite, error)
func (*KeySuiteHybrid) ExportToMember ¶
func (*KeySuiteHybrid) ExportToYubiKeyInfo ¶
func (k *KeySuiteHybrid) ExportToYubiKeyInfo(ctx context.Context) (*proto.YubiKeyInfoHybrid, error)
func (*KeySuiteHybrid) KemDecap ¶
func (k *KeySuiteHybrid) KemDecap() proto.KemDecapKey
func (*KeySuiteHybrid) Publicize ¶
func (k *KeySuiteHybrid) Publicize(hostID *proto.HostID) (core.PublicSuiter, error)
func (*KeySuiteHybrid) PublicizeToBoxer ¶
func (k *KeySuiteHybrid) PublicizeToBoxer() (core.PublicBoxer, error)
func (*KeySuiteHybrid) UnboxFor ¶
func (k *KeySuiteHybrid) UnboxFor( o core.CryptoPayloader, box proto.Box, sender core.PublicBoxer, ) ( core.DHPublicKey, error, )
func (*KeySuiteHybrid) UnboxForEphemeral ¶
func (k *KeySuiteHybrid) UnboxForEphemeral( o core.CryptoPayloader, box proto.Box, sender proto.DHPublicKey, ) error
type KeySuitePQ ¶
type KeySuitePQ struct { KeySuiteCore // contains filtered or unexported fields }
func NewKeySuitePQ ¶
func NewKeySuitePQ(ksc *KeySuiteCore, ss *proto.SecretSeed32) (*KeySuitePQ, error)
func (*KeySuitePQ) ExportToYubiSlotAndPQKey ¶
func (k *KeySuitePQ) ExportToYubiSlotAndPQKey() (*proto.YubiSlotAndPQKeyID, error)
func (*KeySuitePQ) PQKeyID ¶
func (k *KeySuitePQ) PQKeyID() (*proto.YubiPQKeyID, error)
type MockBus ¶
type MockBus struct { *BusBase // contains filtered or unexported fields }
func NewMockBus ¶
func NewMockBusWithSeed ¶
func NewMockBusWithSeed(seed MockYubiSeed, cardCount int) (*MockBus, error)
type MockCard ¶
func (*MockCard) GenerateKey ¶
func (*MockCard) GetManagementKey ¶
func (*MockCard) HasDefaultManagementKey ¶
func (*MockCard) PrivateKey ¶
func (*MockCard) SetManagementKey ¶
func (c *MockCard) SetManagementKey(old *proto.YubiManagementKey, key proto.YubiManagementKey) error
func (*MockCard) SetOrGetManagementKey ¶
func (*MockCard) SetRetries ¶
type MockYubiSeed ¶
type MockYubiSeed []byte
func NewMockYubiSeed ¶
func NewMockYubiSeed() (MockYubiSeed, error)
func (MockYubiSeed) String ¶
func (s MockYubiSeed) String() string
type Prepper ¶
type RealBus ¶
type RealBus struct {
*BusBase
}
func NewRealBus ¶
func NewRealBus() *RealBus
type RealCard ¶
func (*RealCard) GenerateKey ¶
func (*RealCard) GetManagementKey ¶
func (*RealCard) HasDefaultManagementKey ¶
func (*RealCard) PrivateKey ¶
func (*RealCard) SetManagementKey ¶
func (c *RealCard) SetManagementKey( oldp *proto.YubiManagementKey, new proto.YubiManagementKey, ) error
func (*RealCard) SetOrGetManagementKey ¶
func (*RealCard) SetRetries ¶
func (c *RealCard) SetRetries( mk proto.YubiManagementKey, pinRetries, pukRetries int, ) error