Upstream version 10.39.233.0
[platform/framework/web/crosswalk.git] / src / xwalk / application / common / package / xpk_package.h
1 // Copyright (c) 2013 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef XWALK_APPLICATION_COMMON_PACKAGE_XPK_PACKAGE_H_
6 #define XWALK_APPLICATION_COMMON_PACKAGE_XPK_PACKAGE_H_
7
8 #include <vector>
9
10 #include "base/files/file_path.h"
11 #include "xwalk/application/common/package/package.h"
12
13 namespace xwalk {
14 namespace application {
15
16 class XPKPackage : public Package {
17  public:
18   static const char kXPKPackageHeaderMagic[];
19   static const size_t kXPKPackageHeaderMagicSize = 4;
20   static const uint32 kMaxPublicKeySize = 1 << 16;
21   static const uint32 kMaxSignatureKeySize = 1 << 16;
22
23   struct Header {
24     char magic[kXPKPackageHeaderMagicSize];
25     uint32 key_size;
26     uint32 signature_size;
27   };
28   virtual ~XPKPackage();
29   explicit XPKPackage(const base::FilePath& path);
30   virtual bool ExtractToTemporaryDir(base::FilePath* target_path) OVERRIDE;
31
32  private:
33   // verify the signature in the xpk package
34   virtual bool VerifySignature();
35
36   Header header_;
37   std::vector<uint8> signature_;
38   std::vector<uint8> key_;
39   // It's the beginning address of the zip file
40   int zip_addr_;
41 };
42
43 }  // namespace application
44 }  // namespace xwalk
45
46 #endif  // XWALK_APPLICATION_COMMON_PACKAGE_XPK_PACKAGE_H_