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.
17 /* standard library header */
19 /* SLP library header */
26 #include "SessionHelper.h"
27 #include "ReaderHelper.h"
30 #define EXTERN_API __attribute__((visibility("default")))
33 namespace smartcard_service_api
35 GPACE::GPACE() : AccessControlList(), acl(NULL)
46 int GPACE::loadACL(Channel *channel)
48 int result = SCARD_ERROR_OK;
54 return SCARD_ERROR_ILLEGAL_PARAM;
58 /* first, check ara-m */
59 GPARAACL *araACL = new GPARAACL;
61 result = araACL->loadACL(channel);
62 if (result < SCARD_ERROR_OK) {
63 _ERR("ARA not found");
68 _INFO("try to use ARF");
69 /* second, check arf when channel is for SIM */
70 GPARFACL *arfACL = new GPARFACL;
72 result = arfACL->loadACL(channel);
73 if (result >= SCARD_ERROR_OK) {
83 result = acl->loadACL(channel);
91 bool GPACE::isAuthorizedAccess(ByteArray &aid,
94 return (acl != NULL) ? acl->isAuthorizedAccess(aid, certHash) : false;
97 bool GPACE::isAuthorizedAccess(unsigned char *aidBuffer,
98 unsigned int aidLength, unsigned char *certHashBuffer,
99 unsigned int certHashLength)
101 return (acl != NULL) ? acl->isAuthorizedAccess(aidBuffer, aidLength, certHashBuffer, certHashLength) : false;
104 bool GPACE::isAuthorizedAccess(ByteArray &aid,
105 vector<ByteArray> &certHashes)
107 return (acl != NULL) ? acl->isAuthorizedAccess(aid, certHashes) : false;
110 bool GPACE::isAuthorizedAccess(ByteArray &aid,
111 vector<ByteArray> &certHashes, ByteArray &command)
113 return (acl != NULL) ? acl->isAuthorizedAccess(aid, certHashes, command) : false;
116 bool GPACE::isAuthorizedNFCAccess(ByteArray &aid,
117 vector<ByteArray> &certHashes)
119 return (acl != NULL) ? acl->isAuthorizedNFCAccess(aid, certHashes) : false;
122 } /* namespace smartcard_service_api */