Validate rand key length before 3des operations
Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package session
|
||||
|
||||
import (
|
||||
"errors"
|
||||
ghomemodel "honoka-chan/internal/model/ghome"
|
||||
)
|
||||
|
||||
@@ -37,3 +38,11 @@ func (ss *Session) SetRandKey(key string) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (ss *Session) Get3DESRandKey() ([]byte, error) {
|
||||
randKey := ss.GetRandKey()
|
||||
if len(randKey) < 24 {
|
||||
return nil, errors.New("invalid rand key")
|
||||
}
|
||||
return randKey[:24], nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user