mirror of
https://github.com/gregtwallace/apc-p15-tool.git
synced 2025-01-22 16:14:09 +00:00
25 lines
493 B
Go
25 lines
493 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"crypto/sha256"
|
||
|
|
||
|
"golang.org/x/crypto/pbkdf2"
|
||
|
)
|
||
|
|
||
|
// makeKEK creates the APC KEK for a given Salt; APC uses a fixed
|
||
|
// password, iteration count, and hash function
|
||
|
func makeKEK(salt []byte) (KEK []byte) {
|
||
|
// password is known constant for APC files
|
||
|
password := "user"
|
||
|
|
||
|
// fixed values for APC files
|
||
|
iterations := 5000
|
||
|
hash := sha256.New
|
||
|
|
||
|
// size of 3DES key (k1 + k2 + k3)
|
||
|
size := 24
|
||
|
|
||
|
// kek
|
||
|
return pbkdf2.Key([]byte(password), salt, iterations, size, hash)
|
||
|
}
|