1 // Copyright 2016 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //      http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef KEYSTORE_INCLUDE_KEYSTORE_KEYATTESTATIONPACKAGEINFO_H_
16 #define KEYSTORE_INCLUDE_KEYSTORE_KEYATTESTATIONPACKAGEINFO_H_
17 
18 #include "Signature.h"
19 #include "utils.h"
20 #include <binder/Parcelable.h>
21 #include <memory>
22 #include <stdint.h>
23 #include <vector>
24 
25 namespace android {
26 namespace security {
27 namespace keymaster {
28 
29 class KeyAttestationPackageInfo : public Parcelable {
30   public:
31     typedef SharedNullableIterator<const content::pm::Signature, std::vector>
32         ConstSignatureIterator;
33 
34     status_t writeToParcel(Parcel*) const override;
35     status_t readFromParcel(const Parcel* parcel) override;
36 
package_name()37     const std::unique_ptr<String16>& package_name() const { return packageName_; }
version_code()38     int32_t version_code() const { return versionCode_; }
39 
sigs_begin()40     ConstSignatureIterator sigs_begin() const { return ConstSignatureIterator(signatures_); }
sigs_end()41     ConstSignatureIterator sigs_end() const { return ConstSignatureIterator(); }
42 
43   private:
44     std::unique_ptr<String16> packageName_;
45     int32_t versionCode_;
46     std::shared_ptr<std::vector<std::unique_ptr<content::pm::Signature>>> signatures_;
47 };
48 
49 }  // namespace keymaster
50 }  // namespace security
51 }  // namespace android
52 
53 #endif  // KEYSTORE_INCLUDE_KEYSTORE_KEYATTESTATIONPACKAGEINFO_H_
54