INNER CODE UNIT · Go

encodedBytes

aead/minisign · private.go:122

	encodedBytes := make([]byte, len(comment)+base64.StdEncoding.EncodedLen(len(b)))
	copy(encodedBytes, []byte(comment))
	base64.StdEncoding.Encode(encodedBytes[len(comment):], b[:])
	return encodedBytes, nil
}

// UnmarshalText decodes a textual representation of the private key into p.
//
// It returns an error if the private key is encrypted. For decrypting
// password-protected private keys refer to [DecryptKey].
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]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…