Removing mnc-brillo-dev specific changes to weaved
Moved recent changes to weaved from Brillo branch to AOSP and used
conditional compilation to compile Brillo-specific code on Brillo only.
This eliminates differences in source files for the branch and future
code merge issues.
Change-Id: I355a1022cb0d31ea1ab7e0c476824ebbad1af43c
diff --git a/buffet/encryptor.h b/buffet/encryptor.h
new file mode 100644
index 0000000..96f4f71
--- /dev/null
+++ b/buffet/encryptor.h
@@ -0,0 +1,53 @@
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef BUFFET_ENCRYPTOR_H_
+#define BUFFET_ENCRYPTOR_H_
+
+#include <memory>
+#include <string>
+
+#include <base/macros.h>
+
+namespace buffet {
+
+// An abstract class to perform authenticated encryption.
+class Encryptor {
+ public:
+ Encryptor() = default;
+ virtual ~Encryptor() = default;
+
+ // Encrypts and authenticates the given |plaintext| and emits the
+ // |ciphertext|. Returns true on success.
+ virtual bool EncryptWithAuthentication(const std::string& plaintext,
+ std::string* ciphertext) = 0;
+
+ // Decrypts and authenticates the given |ciphertext| and emits the
+ // |plaintext|. Returns true on success.
+ virtual bool DecryptWithAuthentication(const std::string& ciphertext,
+ std::string* plaintext) = 0;
+
+ // A factory method to be exported by the default Encryptor implementation
+ // for a given platform. Like a constructor, this method should not perform
+ // any significant initialization work. The caller assumes ownership of the
+ // pointer.
+ static std::unique_ptr<Encryptor> CreateDefaultEncryptor();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Encryptor);
+};
+
+} // namespace buffet
+
+#endif // BUFFET_ENCRYPTOR_H_