hancock

Check-in [77d3d4e49a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:add check that authority public key is set
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 77d3d4e49a71f3a55b9a8e7815aabc857e2b5a2f59b6805dc8a58615abdf9c2e
User & Date: dnc 2019-09-26 14:26:10
Context
2019-09-26
14:27
create manifest from io.Reader check-in: 6df3601824 user: dnc tags: trunk
14:26
add check that authority public key is set check-in: 77d3d4e49a user: dnc tags: trunk
2019-06-09
11:40
manifest.Check() imposes limits on manifest data check-in: d3764da499 user: dnc tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to model/testimony.go.

15
16
17
18
19
20
21



22

23
24
25
26
27
28
29
..
37
38
39
40
41
42
43



44
45
46
47
48
49
50

// Testmimony
//
// Testimony is an attestation by an authority regarding the status of
// a source file.
package model




import "golang.org/x/crypto/ssh"


// Type Testimony, when produced by a trusted authority, allows a
// verifier to authenticate a source file.
type Testimony struct {
	// The signer's public key.
	Public string `json:"public"`

................................................................................
	publicKey ssh.PublicKey
}

// Verify returns nil when the manifest, signature, and public key are
// consistent.  This checks only the tag data, and does not check that
// the key corresponds to an authorized entity.
func (this *Testimony) Verify() error {



	public, err := this.PublicKey()
	if err != nil {
		return err
	}
	err = public.Verify(this.Encoded, &this.Signature)
	return err
}







>
>
>
|
>







 







>
>
>







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
..
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

// Testmimony
//
// Testimony is an attestation by an authority regarding the status of
// a source file.
package model

import (
	"errors"

	"golang.org/x/crypto/ssh"
)

// Type Testimony, when produced by a trusted authority, allows a
// verifier to authenticate a source file.
type Testimony struct {
	// The signer's public key.
	Public string `json:"public"`

................................................................................
	publicKey ssh.PublicKey
}

// Verify returns nil when the manifest, signature, and public key are
// consistent.  This checks only the tag data, and does not check that
// the key corresponds to an authorized entity.
func (this *Testimony) Verify() error {
	if this.Public == "" {
		return errors.New("testimony without public key")
	}
	public, err := this.PublicKey()
	if err != nil {
		return err
	}
	err = public.Verify(this.Encoded, &this.Signature)
	return err
}