Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/martinlindhe/jwt-go into …
Browse files Browse the repository at this point in the history
…patch_109
  • Loading branch information
dgrijalva committed Jun 7, 2016
2 parents c5c24ad + f728899 commit 6fd0370
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions ecdsa.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (m *SigningMethodECDSA) Verify(signingString, signature string, key interfa
case *ecdsa.PublicKey:
ecdsaKey = k
default:
return ErrInvalidKey
return ErrInvalidKeyType
}

if len(sig) != 2*m.KeySize {
Expand Down Expand Up @@ -103,7 +103,7 @@ func (m *SigningMethodECDSA) Sign(signingString string, key interface{}) (string
case *ecdsa.PrivateKey:
ecdsaKey = k
default:
return "", ErrInvalidKey
return "", ErrInvalidKeyType
}

// Create the hasher
Expand Down
3 changes: 2 additions & 1 deletion errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import (

// Error constants
var (
ErrInvalidKey = errors.New("key is invalid or of invalid type")
ErrInvalidKey = errors.New("key is invalid")
ErrInvalidKeyType = errors.New("key is of invalid type")
ErrHashUnavailable = errors.New("the requested hash function is unavailable")
)

Expand Down
2 changes: 1 addition & 1 deletion hmac.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (m *SigningMethodHMAC) Verify(signingString, signature string, key interfac
// Verify the key is the right type
keyBytes, ok := key.([]byte)
if !ok {
return ErrInvalidKey
return ErrInvalidKeyType
}

// Decode signature, for comparison
Expand Down
2 changes: 1 addition & 1 deletion rsa.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (m *SigningMethodRSA) Verify(signingString, signature string, key interface
var ok bool

if rsaKey, ok = key.(*rsa.PublicKey); !ok {
return ErrInvalidKey
return ErrInvalidKeyType
}

// Create hasher
Expand Down
2 changes: 1 addition & 1 deletion rsa_pss.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (m *SigningMethodRSAPSS) Sign(signingString string, key interface{}) (strin
case *rsa.PrivateKey:
rsaKey = k
default:
return "", ErrInvalidKey
return "", ErrInvalidKeyType
}

// Create the hasher
Expand Down

0 comments on commit 6fd0370

Please sign in to comment.