Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions agent/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type Key struct {
}

// Public returns this key's public key.
func (key Key) Public() crypto.PublicKey {
func (key *Key) Public() crypto.PublicKey {
return key.publicKey
}

Expand All @@ -58,7 +58,7 @@ func (key Key) Public() crypto.PublicKey {
// opts must have type *OAEPOptions and OAEP decryption is done.
//
// This function is basically a copy of rsa.Decrypt().
func (key Key) Decrypt(rand io.Reader, ciphertext []byte, opts crypto.DecrypterOpts) (plaintext []byte, err error) {
func (key *Key) Decrypt(rand io.Reader, ciphertext []byte, opts crypto.DecrypterOpts) (plaintext []byte, err error) {
switch pub := key.publicKey.(type) {
case *rsa.PublicKey:
priv := &internalrsa.PrivateKey{
Expand Down Expand Up @@ -105,7 +105,7 @@ func (key Key) Decrypt(rand io.Reader, ciphertext []byte, opts crypto.DecrypterO
// will be used.
//
// This function is basically a copy of rsa.Sign().
func (key Key) Sign(rand io.Reader, msg []byte, opts crypto.SignerOpts) (signature []byte, err error) {
func (key *Key) Sign(rand io.Reader, msg []byte, opts crypto.SignerOpts) (signature []byte, err error) {
switch pub := key.publicKey.(type) {
case *rsa.PublicKey:
priv := &internalrsa.PrivateKey{
Expand All @@ -126,7 +126,7 @@ func (key Key) Sign(rand io.Reader, msg []byte, opts crypto.SignerOpts) (signatu
}
}

func (key Key) decrypt(c *big.Int) (*big.Int, error) {
func (key *Key) decrypt(c *big.Int) (*big.Int, error) {
encCipherText, err := encodeRSACipherText(c.Bytes())
if err != nil {
return nil, err
Expand Down Expand Up @@ -175,7 +175,7 @@ func (key Key) decrypt(c *big.Int) (*big.Int, error) {
return (&big.Int{}).SetBytes(plaintext), nil
}

func (key Key) signPKCS1v15(msg []byte, opts crypto.SignerOpts) ([]byte, error) {
func (key *Key) signPKCS1v15(msg []byte, opts crypto.SignerOpts) ([]byte, error) {
var hashType string
switch opts.HashFunc() {
case crypto.MD5:
Expand Down