Fix ticket generation

This commit is contained in:
Xpl0itU 2023-07-21 21:01:24 +02:00
parent ab32b122ea
commit 418e3e9cf9
3 changed files with 15 additions and 22 deletions

View file

@ -141,7 +141,9 @@ func DownloadTitle(titleID string, outputDirectory string, doDecryption bool, pr
progressWindow.cancelled = true
})
progressWindow.gameLabel.SetText(getTitleEntryFromTid(titleID).Name)
titleEntry := getTitleEntryFromTid(titleID)
progressWindow.gameLabel.SetText(titleEntry.Name)
outputDir := strings.TrimRight(outputDirectory, "/\\")
baseURL := fmt.Sprintf("http://ccs.cdn.c.shop.nintendowifi.net/ccs/download/%s", titleID)
titleIDBytes, err := hex.DecodeString(titleID)
@ -177,7 +179,7 @@ func DownloadTitle(titleID string, outputDirectory string, doDecryption bool, pr
if err != nil {
return err
}
if err := generateTicket(tikPath, titleID, titleKey, titleVersion); err != nil {
if err := generateTicket(tikPath, titleEntry.TitleID, titleKey, titleVersion); err != nil {
return err
}
}

View file

@ -5,7 +5,6 @@ import (
"crypto/cipher"
"crypto/md5"
"crypto/sha1"
"encoding/hex"
"golang.org/x/crypto/pbkdf2"
)
@ -33,7 +32,7 @@ func encryptAES(data []byte, key []byte, iv []byte) ([]byte, error) {
return encrypted, nil
}
func generateKey(tid string) (string, error) {
func generateKey(tid string) ([]byte, error) {
tmp := []byte(tid)
for tmp[0] == '0' && tmp[1] == '0' {
tmp = tmp[2:]
@ -61,10 +60,10 @@ func generateKey(tid string) (string, error) {
encrypted, err := encryptAES(key, commonKey, iv)
if err != nil {
return "", err
return []byte{}, err
}
return hex.EncodeToString(encrypted), nil
return encrypted, nil
}
func pbkdf2WithSHA1(password, salt []byte, iterations, keyLength int) []byte {

File diff suppressed because one or more lines are too long