INNER CODE UNIT · Go

validatePublicKeyIntegrity

andrearaponi/dito · cmd/plugin-signer/main.go:35

func validatePublicKeyIntegrity() error {
	data, err := os.ReadFile("ed25519_public.key")
	if err != nil {
		return fmt.Errorf("failed to read public key: %w", err)
	}

	hash := sha256.Sum256(data)
	if hex.EncodeToString(hash[:]) != predefinedHash {
		return fmt.Errorf("public key integrity check failed")
	}

	return nil
}

// signFile generates a SHA-256 hash of the file and signs it with the private key.
func signFile(filename string) error {
	data, err := os.ReadFile(filename)
	if err != nil {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…