Documentation
¶
Overview ¶
Package crypto implements cryptographic operations for CTAP PIN/UV and large-blob workflows.
Index ¶
- Constants
- Variables
- func Authenticate(number protocol.PinUvAuthProtocol, sharedSecret []byte, message []byte) []byte
- func CompressLargeBlobData(data []byte) ([]byte, error)
- func DecompressLargeBlobData(compressed []byte, originalSize uint) ([]byte, error)
- func DecryptCredentialStoreState(persistentPinUvAuthToken, encCredStoreState []byte) ([getInfoEncryptedMemberPlaintextSize]byte, error)
- func DecryptDeviceIdentifier(persistentPinUvAuthToken, encIdentifier []byte) ([getInfoEncryptedMemberPlaintextSize]byte, error)
- func DecryptLargeBlob(key []byte, blob protocol.LargeBlob) ([]byte, error)
- func EncryptLargeBlob(key []byte, origData []byte) (protocol.LargeBlob, error)
- func OpenLargeBlob(key []byte, blob protocol.LargeBlob) ([]byte, error)
- type PinUvAuthProtocol
- func (p *PinUvAuthProtocol) Decrypt(sharedSecret []byte, demCiphertext []byte) ([]byte, error)
- func (p *PinUvAuthProtocol) ECDH(peerCoseKey cose.Key) ([]byte, error)
- func (p *PinUvAuthProtocol) Encapsulate(peerCoseKey cose.Key) (cose.Key, []byte, error)
- func (p *PinUvAuthProtocol) Encrypt(sharedSecret []byte, demPlaintext []byte) ([]byte, error)
- func (p *PinUvAuthProtocol) KDF(z []byte) ([]byte, error)
Constants ¶
const MaxLargeBlobDataSize uint = 1 << 20
Variables ¶
var (
ErrInvalidAuthProtocol = errors.New("invalid auth protocol")
)
Functions ¶
func Authenticate ¶
func Authenticate(number protocol.PinUvAuthProtocol, sharedSecret []byte, message []byte) []byte
func CompressLargeBlobData ¶
CompressLargeBlobData applies the raw DEFLATE encoding required by the CTAP largeBlob extension.
func DecompressLargeBlobData ¶
DecompressLargeBlobData decodes raw DEFLATE data and verifies the size reported by the authenticator. The limit prevents decompression bombs.
func DecryptCredentialStoreState ¶
func DecryptCredentialStoreState( persistentPinUvAuthToken, encCredStoreState []byte, ) ([getInfoEncryptedMemberPlaintextSize]byte, error)
DecryptCredentialStoreState decrypts the credential store state returned in authenticatorGetInfo's encCredStoreState member.
func DecryptDeviceIdentifier ¶
func DecryptDeviceIdentifier( persistentPinUvAuthToken, encIdentifier []byte, ) ([getInfoEncryptedMemberPlaintextSize]byte, error)
DecryptDeviceIdentifier decrypts the device identifier returned in authenticatorGetInfo's encIdentifier member.
func EncryptLargeBlob ¶
func OpenLargeBlob ¶
OpenLargeBlob authenticates and decrypts a large-blob array element without decompressing its plaintext. Callers that scan an array can use a successful return to distinguish an AEAD key match from a malformed DEFLATE stream.
Types ¶
type PinUvAuthProtocol ¶
type PinUvAuthProtocol struct {
Number protocol.PinUvAuthProtocol
// contains filtered or unexported fields
}
func NewPinUvAuthProtocol ¶
func NewPinUvAuthProtocol(number protocol.PinUvAuthProtocol) (*PinUvAuthProtocol, error)
func (*PinUvAuthProtocol) Decrypt ¶
func (p *PinUvAuthProtocol) Decrypt(sharedSecret []byte, demCiphertext []byte) ([]byte, error)
func (*PinUvAuthProtocol) ECDH ¶
func (p *PinUvAuthProtocol) ECDH(peerCoseKey cose.Key) ([]byte, error)
ECDH returns a caller-owned derived shared secret.
func (*PinUvAuthProtocol) Encapsulate ¶
Encapsulate returns the platform public key and a caller-owned derived shared secret.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package protocolone implements PIN/UV Auth Protocol One cryptographic operations.
|
Package protocolone implements PIN/UV Auth Protocol One cryptographic operations. |
|
Package protocoltwo implements PIN/UV Auth Protocol Two cryptographic operations.
|
Package protocoltwo implements PIN/UV Auth Protocol Two cryptographic operations. |