// Decrypt decrypts a encoded profile encrypted under AES ECB func Decrypt(profile, key []byte) ([]byte, error) { decrypted, err := crypto.EcbDecrypt(profile, key) if err != nil { return nil, err } return decrypted, nil }
/* Implement AES in ECB mode, then decrypt a ciphertext encrypted under * a known key. */ func c7() (actual, expected Result) { input, _ := ioutil.ReadFile("input/7.txt") output, _ := utils.ReadAndStripFile("output/7.txt") expected = string(output) key := []byte("YELLOW SUBMARINE") text := string(input) ciphertext, err := base64.StdEncoding.DecodeString(text) if err != nil { log.Fatal(err) } plaintext, err := crypto.EcbDecrypt(ciphertext, key) if err != nil { log.Fatal(err) } return string(utils.Strip(plaintext)), expected }