2 * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #include "SessionHelper.h"
22 #include "ReaderHelper.h"
25 #define EXTERN_API __attribute__((visibility("default")))
28 namespace smartcard_service_api
30 GPACE::GPACE() : AccessControlList(), acl(NULL)
41 int GPACE::loadACL(Channel *channel)
43 int result = SCARD_ERROR_OK;
49 return SCARD_ERROR_ILLEGAL_PARAM;
53 /* first, check ara-m */
54 GPARAACL *araACL = new GPARAACL;
56 result = araACL->loadACL(channel);
57 if (result < SCARD_ERROR_OK) {
58 _ERR("ARA not found");
63 _INFO("try to use ARF");
64 /* second, check arf when channel is for SIM */
65 GPARFACL *arfACL = new GPARFACL;
67 result = arfACL->loadACL(channel);
68 if (result >= SCARD_ERROR_OK) {
78 result = acl->loadACL(channel);
86 bool GPACE::isAuthorizedAccess(const ByteArray &aid,
87 const ByteArray &certHash) const
89 return (acl != NULL) ? acl->isAuthorizedAccess(aid, certHash) : false;
92 bool GPACE::isAuthorizedAccess(const unsigned char *aidBuffer,
93 unsigned int aidLength, const unsigned char *certHashBuffer,
94 unsigned int certHashLength) const
96 return (acl != NULL) ? acl->isAuthorizedAccess(aidBuffer, aidLength, certHashBuffer, certHashLength) : false;
99 bool GPACE::isAuthorizedAccess(const ByteArray &aid,
100 const vector<ByteArray> &certHashes) const
102 return (acl != NULL) ? acl->isAuthorizedAccess(aid, certHashes) : false;
105 bool GPACE::isAuthorizedAccess(const ByteArray &aid,
106 const vector<ByteArray> &certHashes,
107 const ByteArray &command) const
109 return (acl != NULL) ? acl->isAuthorizedAccess(aid, certHashes, command) : false;
112 bool GPACE::isAuthorizedNFCAccess(const ByteArray &aid,
113 const vector<ByteArray> &certHashes) const
115 return (acl != NULL) ? acl->isAuthorizedNFCAccess(aid, certHashes) : false;
118 } /* namespace smartcard_service_api */