INNER CODE UNIT · Go

func

aead/minisign · private.go:132

func (p *PrivateKey) UnmarshalText(text []byte) error {
	text = trimUntrustedComment(text)
	b := make([]byte, base64.StdEncoding.DecodedLen(len(text)))
	n, err := base64.StdEncoding.Decode(b, text)
	if err != nil {
		return fmt.Errorf("minisign: invalid private key: %v", err)
	}
	b = b[:n]

	if len(b) != privateKeySize {
		return errors.New("minisign: invalid private key")
	}

	var (
		kType = binary.LittleEndian.Uint16(b)
		kdf   = binary.LittleEndian.Uint16(b[2:])
		hType = binary.LittleEndian.Uint16(b[4:])
		key   = b[54:126]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…