1 #ifndef DRM_PLUGIN_H_ 2 #define DRM_PLUGIN_H_ 3 4 #include <aidl/android/hardware/drm/BnDrmPlugin.h> 5 #include <aidl/android/hardware/drm/IDrmPluginListener.h> 6 #include <aidl/android/hardware/drm/Status.h> 7 8 #include <stdio.h> 9 #include <map> 10 11 #include <utils/List.h> 12 13 namespace aidl { 14 namespace android { 15 namespace hardware { 16 namespace drm { 17 namespace castkey { 18 19 using namespace castkeydrm; 20 using ::aidl::android::hardware::drm::KeyType; 21 using ::aidl::android::hardware::drm::Status; 22 23 struct DrmPlugin : public BnDrmPlugin { 24 public: 25 explicit DrmPlugin(); 26 virtual ~DrmPlugin(); 27 28 ::ndk::ScopedAStatus closeSession(const std::vector<uint8_t>& in_sessionId) override; 29 ::ndk::ScopedAStatus decrypt(const std::vector<uint8_t>& in_sessionId, 30 const std::vector<uint8_t>& in_keyId, 31 const std::vector<uint8_t>& in_input, 32 const std::vector<uint8_t>& in_iv, 33 std::vector<uint8_t>* _aidl_return) override; 34 ::ndk::ScopedAStatus encrypt(const std::vector<uint8_t>& in_sessionId, 35 const std::vector<uint8_t>& in_keyId, 36 const std::vector<uint8_t>& in_input, 37 const std::vector<uint8_t>& in_iv, 38 std::vector<uint8_t>* _aidl_return) override; 39 ::ndk::ScopedAStatus getHdcpLevels( 40 ::aidl::android::hardware::drm::HdcpLevels* _aidl_return) override; 41 ::ndk::ScopedAStatus getKeyRequest( 42 const std::vector<uint8_t>& in_scope, 43 const std::vector<uint8_t>& in_initData, 44 const std::string& in_mimeType, 45 ::aidl::android::hardware::drm::KeyType in_keyType, 46 const std::vector<::aidl::android::hardware::drm::KeyValue>& in_optionalParameters, 47 ::aidl::android::hardware::drm::KeyRequest* _aidl_return) override; 48 ::ndk::ScopedAStatus getLogMessages( 49 std::vector<::aidl::android::hardware::drm::LogMessage>* _aidl_return) override; 50 51 ::ndk::ScopedAStatus getMetrics( 52 std::vector<::aidl::android::hardware::drm::DrmMetricGroup>* _aidl_return) override; 53 ::ndk::ScopedAStatus getNumberOfSessions( 54 ::aidl::android::hardware::drm::NumberOfSessions* _aidl_return) override; 55 ::ndk::ScopedAStatus getOfflineLicenseKeySetIds( 56 std::vector<::aidl::android::hardware::drm::KeySetId>* _aidl_return) override; 57 ::ndk::ScopedAStatus getOfflineLicenseState( 58 const ::aidl::android::hardware::drm::KeySetId& in_keySetId, 59 ::aidl::android::hardware::drm::OfflineLicenseState* _aidl_return) override; 60 ::ndk::ScopedAStatus getPropertyByteArray(const std::string& in_propertyName, 61 std::vector<uint8_t>* _aidl_return) override; 62 ::ndk::ScopedAStatus getPropertyString(const std::string& in_propertyName, 63 std::string* _aidl_return) override; 64 ::ndk::ScopedAStatus getProvisionRequest( 65 const std::string& in_certificateType, 66 const std::string& in_certificateAuthority, 67 ::aidl::android::hardware::drm::ProvisionRequest* _aidl_return) override; 68 ::ndk::ScopedAStatus getSecureStop( 69 const ::aidl::android::hardware::drm::SecureStopId& in_secureStopId, 70 ::aidl::android::hardware::drm::SecureStop* _aidl_return) override; 71 ::ndk::ScopedAStatus getSecureStopIds( 72 std::vector<::aidl::android::hardware::drm::SecureStopId>* _aidl_return) override; 73 ::ndk::ScopedAStatus getSecureStops( 74 std::vector<::aidl::android::hardware::drm::SecureStop>* _aidl_return) override; 75 ::ndk::ScopedAStatus getSecurityLevel( 76 const std::vector<uint8_t>& in_sessionId, 77 ::aidl::android::hardware::drm::SecurityLevel* _aidl_return) override; 78 ::ndk::ScopedAStatus openSession(::aidl::android::hardware::drm::SecurityLevel in_securityLevel, 79 std::vector<uint8_t>* _aidl_return) override; 80 ::ndk::ScopedAStatus provideKeyResponse( 81 const std::vector<uint8_t>& in_scope, 82 const std::vector<uint8_t>& in_response, 83 ::aidl::android::hardware::drm::KeySetId* _aidl_return) override; 84 ::ndk::ScopedAStatus provideProvisionResponse( 85 const std::vector<uint8_t>& in_response, 86 ::aidl::android::hardware::drm::ProvideProvisionResponseResult* _aidl_return) override; 87 ::ndk::ScopedAStatus queryKeyStatus( 88 const std::vector<uint8_t>& in_sessionId, 89 std::vector<::aidl::android::hardware::drm::KeyValue>* _aidl_return) override; 90 ::ndk::ScopedAStatus releaseAllSecureStops() override; 91 ::ndk::ScopedAStatus releaseSecureStop( 92 const ::aidl::android::hardware::drm::SecureStopId& in_secureStopId) override; 93 ::ndk::ScopedAStatus releaseSecureStops( 94 const ::aidl::android::hardware::drm::OpaqueData& in_ssRelease) override; 95 ::ndk::ScopedAStatus removeAllSecureStops() override; 96 ::ndk::ScopedAStatus removeKeys(const std::vector<uint8_t>& in_sessionId) override; 97 ::ndk::ScopedAStatus removeOfflineLicense( 98 const ::aidl::android::hardware::drm::KeySetId& in_keySetId) override; 99 ::ndk::ScopedAStatus removeSecureStop( 100 const ::aidl::android::hardware::drm::SecureStopId& in_secureStopId) override; 101 ::ndk::ScopedAStatus requiresSecureDecoder( 102 const std::string& in_mime, 103 ::aidl::android::hardware::drm::SecurityLevel in_level, 104 bool* _aidl_return) override; 105 ::ndk::ScopedAStatus restoreKeys( 106 const std::vector<uint8_t>& in_sessionId, 107 const ::aidl::android::hardware::drm::KeySetId& in_keySetId) override; 108 ::ndk::ScopedAStatus setCipherAlgorithm(const std::vector<uint8_t>& in_sessionId, 109 const std::string& in_algorithm) override; 110 ::ndk::ScopedAStatus setListener( 111 const std::shared_ptr<::aidl::android::hardware::drm::IDrmPluginListener>& 112 in_listener) override; 113 ::ndk::ScopedAStatus setMacAlgorithm(const std::vector<uint8_t>& in_sessionId, 114 const std::string& in_algorithm) override; 115 ::ndk::ScopedAStatus setPlaybackId(const std::vector<uint8_t>& in_sessionId, 116 const std::string& in_playbackId) override; 117 ::ndk::ScopedAStatus setPropertyByteArray(const std::string& in_propertyName, 118 const std::vector<uint8_t>& in_value) override; 119 ::ndk::ScopedAStatus setPropertyString(const std::string& in_propertyName, 120 const std::string& in_value) override; 121 ::ndk::ScopedAStatus sign(const std::vector<uint8_t>& in_sessionId, 122 const std::vector<uint8_t>& in_keyId, 123 const std::vector<uint8_t>& in_message, 124 std::vector<uint8_t>* _aidl_return) override; 125 ::ndk::ScopedAStatus signRSA(const std::vector<uint8_t>& in_sessionId, 126 const std::string& in_algorithm, 127 const std::vector<uint8_t>& in_message, 128 const std::vector<uint8_t>& in_wrappedkey, 129 std::vector<uint8_t>* _aidl_return) override; 130 ::ndk::ScopedAStatus verify(const std::vector<uint8_t>& in_sessionId, 131 const std::vector<uint8_t>& in_keyId, 132 const std::vector<uint8_t>& in_message, 133 const std::vector<uint8_t>& in_signature, 134 bool* _aidl_return) override; 135 }; 136 137 } // namespace castkey 138 } // namespace drm 139 } // namespace hardware 140 } // namespace android 141 } // namespace aidl 142 143 #endif // DRM_PLUGIN_H_