From 2ed7da8cfdd27a2305b577088034e7031aecb74a Mon Sep 17 00:00:00 2001 From: Brian Tiger Chow Date: Wed, 22 Oct 2014 21:41:58 -0700 Subject: [PATCH] refactor(crypto) mv proto PBPublicKey -> PublicKey, etc. --- crypto/internal/pb/crypto.pb.go | 28 ++++++++++++++-------------- crypto/internal/pb/crypto.proto | 4 ++-- crypto/key.go | 4 ++-- crypto/rsa.go | 4 ++-- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/crypto/internal/pb/crypto.pb.go b/crypto/internal/pb/crypto.pb.go index 0b0718d16..0bd3bc26f 100644 --- a/crypto/internal/pb/crypto.pb.go +++ b/crypto/internal/pb/crypto.pb.go @@ -9,8 +9,8 @@ It is generated from these files: crypto.proto It has these top-level messages: - PBPublicKey - PBPrivateKey + PublicKey + PrivateKey */ package crypto_pb @@ -51,48 +51,48 @@ func (x *KeyType) UnmarshalJSON(data []byte) error { return nil } -type PBPublicKey struct { +type PublicKey struct { Type *KeyType `protobuf:"varint,1,req,enum=crypto.pb.KeyType" json:"Type,omitempty"` Data []byte `protobuf:"bytes,2,req" json:"Data,omitempty"` XXX_unrecognized []byte `json:"-"` } -func (m *PBPublicKey) Reset() { *m = PBPublicKey{} } -func (m *PBPublicKey) String() string { return proto.CompactTextString(m) } -func (*PBPublicKey) ProtoMessage() {} +func (m *PublicKey) Reset() { *m = PublicKey{} } +func (m *PublicKey) String() string { return proto.CompactTextString(m) } +func (*PublicKey) ProtoMessage() {} -func (m *PBPublicKey) GetType() KeyType { +func (m *PublicKey) GetType() KeyType { if m != nil && m.Type != nil { return *m.Type } return KeyType_RSA } -func (m *PBPublicKey) GetData() []byte { +func (m *PublicKey) GetData() []byte { if m != nil { return m.Data } return nil } -type PBPrivateKey struct { +type PrivateKey struct { Type *KeyType `protobuf:"varint,1,req,enum=crypto.pb.KeyType" json:"Type,omitempty"` Data []byte `protobuf:"bytes,2,req" json:"Data,omitempty"` XXX_unrecognized []byte `json:"-"` } -func (m *PBPrivateKey) Reset() { *m = PBPrivateKey{} } -func (m *PBPrivateKey) String() string { return proto.CompactTextString(m) } -func (*PBPrivateKey) ProtoMessage() {} +func (m *PrivateKey) Reset() { *m = PrivateKey{} } +func (m *PrivateKey) String() string { return proto.CompactTextString(m) } +func (*PrivateKey) ProtoMessage() {} -func (m *PBPrivateKey) GetType() KeyType { +func (m *PrivateKey) GetType() KeyType { if m != nil && m.Type != nil { return *m.Type } return KeyType_RSA } -func (m *PBPrivateKey) GetData() []byte { +func (m *PrivateKey) GetData() []byte { if m != nil { return m.Data } diff --git a/crypto/internal/pb/crypto.proto b/crypto/internal/pb/crypto.proto index ffa1d2a40..7491362d6 100644 --- a/crypto/internal/pb/crypto.proto +++ b/crypto/internal/pb/crypto.proto @@ -4,12 +4,12 @@ enum KeyType { RSA = 0; } -message PBPublicKey { +message PublicKey { required KeyType Type = 1; required bytes Data = 2; } -message PBPrivateKey { +message PrivateKey { required KeyType Type = 1; required bytes Data = 2; } diff --git a/crypto/key.go b/crypto/key.go index 5393848e5..1c6bba926 100644 --- a/crypto/key.go +++ b/crypto/key.go @@ -206,7 +206,7 @@ func KeyStretcher(cmp int, cipherType string, hashType string, secret []byte) ([ } func UnmarshalPublicKey(data []byte) (PubKey, error) { - pmes := new(pb.PBPublicKey) + pmes := new(pb.PublicKey) err := proto.Unmarshal(data, pmes) if err != nil { return nil, err @@ -221,7 +221,7 @@ func UnmarshalPublicKey(data []byte) (PubKey, error) { } func UnmarshalPrivateKey(data []byte) (PrivKey, error) { - pmes := new(pb.PBPrivateKey) + pmes := new(pb.PrivateKey) err := proto.Unmarshal(data, pmes) if err != nil { return nil, err diff --git a/crypto/rsa.go b/crypto/rsa.go index 5cb38cb44..f76df125e 100644 --- a/crypto/rsa.go +++ b/crypto/rsa.go @@ -36,7 +36,7 @@ func (pk *RsaPublicKey) Bytes() ([]byte, error) { return nil, err } - pbmes := new(pb.PBPublicKey) + pbmes := new(pb.PublicKey) typ := pb.KeyType_RSA pbmes.Type = &typ pbmes.Data = b @@ -69,7 +69,7 @@ func (sk *RsaPrivateKey) GetPublic() PubKey { func (sk *RsaPrivateKey) Bytes() ([]byte, error) { b := x509.MarshalPKCS1PrivateKey(sk.k) - pbmes := new(pb.PBPrivateKey) + pbmes := new(pb.PrivateKey) typ := pb.KeyType_RSA pbmes.Type = &typ pbmes.Data = b