1*e1997b9aSAndroid Build Coastguard Worker /* 2*e1997b9aSAndroid Build Coastguard Worker * Copyright (c) 2021, The Android Open Source Project 3*e1997b9aSAndroid Build Coastguard Worker * 4*e1997b9aSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 5*e1997b9aSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 6*e1997b9aSAndroid Build Coastguard Worker * You may obtain a copy of the License at 7*e1997b9aSAndroid Build Coastguard Worker * 8*e1997b9aSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 9*e1997b9aSAndroid Build Coastguard Worker * 10*e1997b9aSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 11*e1997b9aSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 12*e1997b9aSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*e1997b9aSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 14*e1997b9aSAndroid Build Coastguard Worker * limitations under the License. 15*e1997b9aSAndroid Build Coastguard Worker */ 16*e1997b9aSAndroid Build Coastguard Worker 17*e1997b9aSAndroid Build Coastguard Worker #ifndef SYSTEM_SECURITY_PRESENTATION_H_ 18*e1997b9aSAndroid Build Coastguard Worker #define SYSTEM_SECURITY_PRESENTATION_H_ 19*e1997b9aSAndroid Build Coastguard Worker 20*e1997b9aSAndroid Build Coastguard Worker #include <string> 21*e1997b9aSAndroid Build Coastguard Worker #include <vector> 22*e1997b9aSAndroid Build Coastguard Worker 23*e1997b9aSAndroid Build Coastguard Worker #include <android/security/identity/BnSession.h> 24*e1997b9aSAndroid Build Coastguard Worker 25*e1997b9aSAndroid Build Coastguard Worker #include <android/hardware/identity/IPresentationSession.h> 26*e1997b9aSAndroid Build Coastguard Worker 27*e1997b9aSAndroid Build Coastguard Worker #include <android/hardware/identity/IIdentityCredentialStore.h> 28*e1997b9aSAndroid Build Coastguard Worker 29*e1997b9aSAndroid Build Coastguard Worker #include "CredentialStore.h" 30*e1997b9aSAndroid Build Coastguard Worker 31*e1997b9aSAndroid Build Coastguard Worker namespace android { 32*e1997b9aSAndroid Build Coastguard Worker namespace security { 33*e1997b9aSAndroid Build Coastguard Worker namespace identity { 34*e1997b9aSAndroid Build Coastguard Worker 35*e1997b9aSAndroid Build Coastguard Worker using ::android::sp; 36*e1997b9aSAndroid Build Coastguard Worker using ::android::binder::Status; 37*e1997b9aSAndroid Build Coastguard Worker using ::std::string; 38*e1997b9aSAndroid Build Coastguard Worker using ::std::vector; 39*e1997b9aSAndroid Build Coastguard Worker 40*e1997b9aSAndroid Build Coastguard Worker using ::android::hardware::identity::CipherSuite; 41*e1997b9aSAndroid Build Coastguard Worker using ::android::hardware::identity::HardwareInformation; 42*e1997b9aSAndroid Build Coastguard Worker using ::android::hardware::identity::IIdentityCredential; 43*e1997b9aSAndroid Build Coastguard Worker using ::android::hardware::identity::IIdentityCredentialStore; 44*e1997b9aSAndroid Build Coastguard Worker using ::android::hardware::identity::IPresentationSession; 45*e1997b9aSAndroid Build Coastguard Worker using ::android::hardware::identity::RequestDataItem; 46*e1997b9aSAndroid Build Coastguard Worker using ::android::hardware::identity::RequestNamespace; 47*e1997b9aSAndroid Build Coastguard Worker 48*e1997b9aSAndroid Build Coastguard Worker class Session : public BnSession { 49*e1997b9aSAndroid Build Coastguard Worker public: Session(int32_t cipherSuite,sp<IPresentationSession> halBinder,sp<CredentialStore> store)50*e1997b9aSAndroid Build Coastguard Worker Session(int32_t cipherSuite, sp<IPresentationSession> halBinder, sp<CredentialStore> store) 51*e1997b9aSAndroid Build Coastguard Worker : cipherSuite_(cipherSuite), halBinder_(halBinder), store_(store) {} 52*e1997b9aSAndroid Build Coastguard Worker 53*e1997b9aSAndroid Build Coastguard Worker bool initialize(); 54*e1997b9aSAndroid Build Coastguard Worker 55*e1997b9aSAndroid Build Coastguard Worker // ISession overrides 56*e1997b9aSAndroid Build Coastguard Worker Status getEphemeralKeyPair(vector<uint8_t>* _aidl_return) override; 57*e1997b9aSAndroid Build Coastguard Worker 58*e1997b9aSAndroid Build Coastguard Worker Status setReaderEphemeralPublicKey(const vector<uint8_t>& publicKey) override; 59*e1997b9aSAndroid Build Coastguard Worker 60*e1997b9aSAndroid Build Coastguard Worker Status setSessionTranscript(const vector<uint8_t>& sessionTranscript) override; 61*e1997b9aSAndroid Build Coastguard Worker 62*e1997b9aSAndroid Build Coastguard Worker Status getAuthChallenge(int64_t* _aidl_return) override; 63*e1997b9aSAndroid Build Coastguard Worker 64*e1997b9aSAndroid Build Coastguard Worker Status getCredentialForPresentation(const string& credentialName, 65*e1997b9aSAndroid Build Coastguard Worker sp<ICredential>* _aidl_return) override; 66*e1997b9aSAndroid Build Coastguard Worker 67*e1997b9aSAndroid Build Coastguard Worker private: 68*e1997b9aSAndroid Build Coastguard Worker int32_t cipherSuite_; 69*e1997b9aSAndroid Build Coastguard Worker sp<IPresentationSession> halBinder_; 70*e1997b9aSAndroid Build Coastguard Worker sp<CredentialStore> store_; 71*e1997b9aSAndroid Build Coastguard Worker }; 72*e1997b9aSAndroid Build Coastguard Worker 73*e1997b9aSAndroid Build Coastguard Worker } // namespace identity 74*e1997b9aSAndroid Build Coastguard Worker } // namespace security 75*e1997b9aSAndroid Build Coastguard Worker } // namespace android 76*e1997b9aSAndroid Build Coastguard Worker 77*e1997b9aSAndroid Build Coastguard Worker #endif // SYSTEM_SECURITY_SESSION_H_ 78