go.crypto/ssh: introduce PublicKey interface type.

Public functions affected:
-AgentKey.Key
-AgentClient.SignRequest
-ClientKeyring.Key
-MarshalPublicKey
-ParsePublicKey

R=agl, jpsugar, jmpittman
CC=golang-dev
https://golang.org/cl/13642043
This commit is contained in:
Han-Wen Nienhuys
2013-09-13 14:25:14 -04:00
committed by Adam Langley
parent 6a743c56c7
commit e62b2aead4
12 changed files with 448 additions and 439 deletions
+3 -3
View File
@@ -99,7 +99,7 @@ func (ak *AgentKey) String() string {
}
// Key returns an agent's public key as one of the supported key or certificate types.
func (ak *AgentKey) Key() (interface{}, error) {
func (ak *AgentKey) Key() (PublicKey, error) {
if key, _, ok := parsePubKey(ak.blob); ok {
return key, nil
}
@@ -204,9 +204,9 @@ func (ac *AgentClient) RequestIdentities() ([]*AgentKey, error) {
// SignRequest requests the signing of data by the agent using a protocol 2 key
// as defined in [PROTOCOL.agent] section 2.6.2.
func (ac *AgentClient) SignRequest(key interface{}, data []byte) ([]byte, error) {
func (ac *AgentClient) SignRequest(key PublicKey, data []byte) ([]byte, error) {
req := marshal(agentSignRequest, signRequestAgentMsg{
KeyBlob: serializePublicKey(key),
KeyBlob: MarshalPublicKey(key),
Data: data,
})