1 /* 2 * Copyright (C) 2007 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #ifndef _ASSET_H 17 #define _ASSET_H 18 19 #include <ustring.h> 20 #include <uvector.h> 21 #include <Drm2CommonTypes.h> 22 #include <rights/Right.h> 23 using namespace ustl; 24 25 class Asset { 26 public: 27 /** 28 * Constructor for asset. 29 */ 30 Asset(); 31 32 /** 33 * Destructor for asset. 34 */ 35 ~Asset(); 36 37 /** 38 * Test whether asset has parent or not. 39 * @return true/false to indicate the result. 40 */ 41 bool hasParent(); 42 43 /** 44 * Set id of asset. 45 * @param id the id of asset. 46 */ 47 void setID(const string &id); 48 49 /** 50 * Get the id of content. 51 * @return asset id. 52 */ 53 const string& getID() const; 54 55 /** 56 * Set contend id related to asset. 57 * @param id the id of content. 58 */ 59 void setContentID(const string &id); 60 61 /** 62 * Get content id. 63 * @return content id. 64 */ 65 const string& getContentID() const; 66 67 /** 68 * Set digest value of DCF. 69 * @param value the DCF digest value. 70 */ 71 void setDCFDigest(const string &value); 72 73 /** 74 * Get the DCF digest value. 75 * @return the digest value of DCF. 76 */ 77 const string& getDCFDigest() const; 78 79 /** 80 * Set encrypted key in asset. 81 * @param the encrypted key. 82 */ 83 void setEncryptedKey(const string &key); 84 85 /** 86 * Get encrypted key. 87 * @return encypted key. 88 */ 89 const string& getEncrytedKey() const; 90 91 /** 92 * Get cek. 93 * @return cek. 94 */ 95 const char* getCek() const; 96 97 /** 98 * Set the retrieval method of key. 99 * @param rm the retrieval method of the key. 100 */ 101 void setKeyRetrievalMethod(const string &rm); 102 103 /** 104 * Set parent content id for asset. 105 * @param id the parent content id. 106 */ 107 void setParentContentID(const string &id); 108 109 /** 110 * Get the parent content id of the asset. 111 * @return the parent content id. 112 */ 113 const string& getParentContentID() const; 114 115 /** 116 * Recover the CEK using private key. 117 */ 118 void recoverCek(); 119 120 PRIVATE: 121 string mAssetID; 122 string mContentID; 123 string mDigestMethod; 124 string mDigestValue; 125 string mEncryptedMethod; 126 string mEncryptedKey; 127 string mRetrievalMethod; 128 string mParentContentID; 129 string mCek; 130 }; 131 132 #endif 133