public static Result EncryptV10(string pwd, string encryptedKey, out byte[] password) { Result res = ExtractEncryptedKey(encryptedKey, out byte[] encryptedBytes); if (res != Result.Success) { password = null; return(res); } byte[] version = Encoding.ASCII.GetBytes(MODE_V10); string ver = Encoding.ASCII.GetString(version); if (ver != MODE_V10) { password = null; return(Result.UnsupportedProtocol); } byte[] nonce = AesGcm256.Nonce(12); res = AesGcm256.Encrypt(pwd, encryptedBytes, nonce, out byte[] ciphertextTag); if (res != Result.Success) { password = null; return(res); } res = CombineCipherText(version, nonce, ciphertextTag, out password); if (res != Result.Success) { password = null; return(res); } return(Result.Success); }