Initial cloud-services repo - gateway service + pkg modules
This commit is contained in:
33
pkg/security/ecu_files_decrypt.go
Normal file
33
pkg/security/ecu_files_decrypt.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package security
|
||||
|
||||
import "fiskerinc.com/modules/common"
|
||||
|
||||
func DecryptKeys(ecu *common.UpdateManifestECU) error {
|
||||
keys := ecu.ECCKeys
|
||||
if keys == nil {
|
||||
return nil
|
||||
}
|
||||
enc := Encrypt{}
|
||||
encryptor, err := enc.GetEncryptor()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
priv1, err := encryptor.DecryptChunk(keys.PrivKey1.Bytes())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
keys.PrivKey1.SetBytes(priv1)
|
||||
|
||||
priv2, err := encryptor.DecryptChunk(keys.PrivKey2.Bytes())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
keys.PrivKey2.SetBytes(priv2)
|
||||
|
||||
priv3, err := encryptor.DecryptChunk(keys.PrivKey3.Bytes())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
keys.PrivKey3.SetBytes(priv3)
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user