github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/src/tpm2/conversions.h (about) 1 // 2 // Copyright 2014 John Manferdelli, All Rights Reserved. 3 // 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 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // or in the the file LICENSE-2.0.txt in the top level sourcedirectory 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License 14 // Project: New Cloudproxy Crypto 15 // file: conversions.h 16 17 #ifndef _CRYPTO_CONVERSIONS_H__ 18 #define _CRYPTO_CONVERSIONS_H__ 19 20 #include <stdio.h> 21 #include <stdlib.h> 22 #include <string.h> 23 #include <sys/types.h> 24 #include <sys/stat.h> 25 #include <tpm2_types.h> 26 27 #include <string> 28 #include <memory> 29 30 using std::string; 31 32 char ValueToHex(byte x); 33 byte HexToValue(char x); 34 35 string* ByteToBase64LeftToRight(int size, byte* in); 36 string* ByteToBase64RightToLeft(int size, byte* in); 37 int Base64ToByteLeftToRight(char* in, int size, byte* out); 38 int Base64ToByteRightToLeft(char* in, int size, byte* out); 39 40 string* ByteToHexLeftToRight(int, byte*); 41 string* ByteToHexRightToLeft(int, byte*); 42 int HexToByteLeftToRight(char*, int, byte*); 43 int HexToByteRightToLeft(char*, int, byte*); 44 #endif