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 #ifndef ISO7816BERTLV_H_
18 #define ISO7816BERTLV_H_
20 #include "ByteArray.h"
21 #include "TLVHelper.h"
23 namespace smartcard_service_api
25 class ISO7816BERTLV : public TLVHelper
28 unsigned char firstByte;
29 unsigned int tagClass;
30 unsigned int encoding;
32 ISO7816BERTLV(TLVHelper *parent);
33 ISO7816BERTLV(const ByteArray &array, TLVHelper *parent);
35 int decodeTag(const unsigned char *buffer);
36 int decodeLength(const unsigned char *buffer);
37 int decodeValue(const unsigned char *buffer);
39 TLVHelper *getChildTLV(const ByteArray &data);
43 ISO7816BERTLV(const ByteArray &array);
46 unsigned int getClass() const;
47 unsigned int getEncoding() const;
49 static const ByteArray encode(unsigned int tagClass, unsigned int encoding, unsigned int tag, const ByteArray &buffer);
50 static const ByteArray encode(unsigned int tagClass, unsigned int encoding, unsigned int tag, unsigned char *buffer, unsigned int length);
53 } /* namespace smartcard_service_api */
54 #endif /* ISO7816BERTLV_H_ */