Пример #1
0
// NewSignatureVerifierFromAuthorizedKeysFile return SignatureVerifier which uses authorized key file to verify
func NewSignatureVerifierFromAuthorizedKeysFile(filepath string) (*SignatureVerifier, error) {
	out, err := ioutil.ReadFile(pkg.ParseFilepath(filepath))
	if err != nil {
		return nil, err
	}

	pubkeys, err := parseAuthorizedKeys(out)
	if err != nil {
		return nil, err
	}

	return &SignatureVerifier{pubkeys}, nil
}
Пример #2
0
// NewSignatureVerifierFromAuthorizedKeysFile creates a
// SignatureVerifier which uses public keys from the specified
// authorized_keys file to verify signatures
func NewSignatureVerifierFromAuthorizedKeysFile(filepath string) (*SignatureVerifier, error) {
	out, err := ioutil.ReadFile(pkg.ParseFilepath(filepath))
	if err != nil {
		return nil, err
	}

	pubkeys, err := parseAuthorizedKeys(out)
	if err != nil {
		return nil, err
	}
	if len(pubkeys) == 0 {
		return nil, errors.New("no authorized keys found in file")
	}

	return &SignatureVerifier{pubkeys}, nil
}
Пример #3
0
// NewHostKeyFile returns a new HostKeyFile using the given file path
func NewHostKeyFile(path string) *HostKeyFile {
	return &HostKeyFile{pkg.ParseFilepath(path)}
}