/developtools/hapsigner/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/zip/ |
H A D | CentralDirectory.java | 168 * @param bf ByteBuffer 172 public static CentralDirectory getCentralDirectory(ByteBuffer bf) throws ZipException { in getCentralDirectory() argument 174 if (bf.getInt() != SIGNATURE) { in getCentralDirectory() 178 cd.setVersion(bf.getShort()); in getCentralDirectory() 179 cd.setVersionExtra(bf.getShort()); in getCentralDirectory() 180 cd.setFlag(bf.getShort()); in getCentralDirectory() 181 cd.setMethod(bf.getShort()); in getCentralDirectory() 182 cd.setLastTime(bf.getShort()); in getCentralDirectory() 183 cd.setLastDate(bf.getShort()); in getCentralDirectory() 184 cd.setCrc32(bf in getCentralDirectory() [all...] |
H A D | ZipEntryHeader.java | 132 ByteBuffer bf = ByteBuffer.wrap(bytes); in getZipEntryHeader() 133 bf.order(ByteOrder.LITTLE_ENDIAN); in getZipEntryHeader() 134 if (bf.getInt() != ZipEntryHeader.SIGNATURE) { in getZipEntryHeader() 137 entryHeader.setVersion(bf.getShort()); in getZipEntryHeader() 138 entryHeader.setFlag(bf.getShort()); in getZipEntryHeader() 139 entryHeader.setMethod(bf.getShort()); in getZipEntryHeader() 140 entryHeader.setLastTime(bf.getShort()); in getZipEntryHeader() 141 entryHeader.setLastDate(bf.getShort()); in getZipEntryHeader() 142 entryHeader.setCrc32(bf.getInt()); in getZipEntryHeader() 143 entryHeader.setCompressedSize(UnsignedDecimalUtil.getUnsignedInt(bf)); in getZipEntryHeader() [all...] |
H A D | EndOfCentralDirectory.java | 118 ByteBuffer bf = ByteBuffer.wrap(bytes, offset, remainingDataLen); in getEOCDByBytes() 119 bf.order(ByteOrder.LITTLE_ENDIAN); in getEOCDByBytes() 120 if (bf.getInt() != SIGNATURE) { in getEOCDByBytes() 123 eocd.setDiskNum(UnsignedDecimalUtil.getUnsignedShort(bf)); in getEOCDByBytes() 124 eocd.setcDStartDiskNum(UnsignedDecimalUtil.getUnsignedShort(bf)); in getEOCDByBytes() 125 eocd.setThisDiskCDNum(UnsignedDecimalUtil.getUnsignedShort(bf)); in getEOCDByBytes() 126 eocd.setCDTotal(UnsignedDecimalUtil.getUnsignedShort(bf)); in getEOCDByBytes() 127 eocd.setCDSize(UnsignedDecimalUtil.getUnsignedInt(bf)); in getEOCDByBytes() 128 eocd.setOffset(UnsignedDecimalUtil.getUnsignedInt(bf)); in getEOCDByBytes() 129 eocd.setCommentLength(UnsignedDecimalUtil.getUnsignedShort(bf)); in getEOCDByBytes() [all...] |
H A D | DataDescriptor.java | 69 ByteBuffer bf = ByteBuffer.wrap(bytes); in getDataDescriptor() 70 bf.order(ByteOrder.LITTLE_ENDIAN); in getDataDescriptor() 72 if (bf.getInt() != SIGNATURE) { in getDataDescriptor() 75 data.setCrc32(bf.getInt()); in getDataDescriptor() 76 data.setCompressedSize(UnsignedDecimalUtil.getUnsignedInt(bf)); in getDataDescriptor() 77 data.setUnCompressedSize(UnsignedDecimalUtil.getUnsignedInt(bf)); in getDataDescriptor() 87 ByteBuffer bf = ByteBuffer.allocate(DES_LENGTH).order(ByteOrder.LITTLE_ENDIAN); in toBytes() 88 bf.putInt(SIGNATURE); in toBytes() 89 bf.putInt(crc32); in toBytes() 90 UnsignedDecimalUtil.setUnsignedInt(bf, compressedSiz in toBytes() [all...] |
H A D | UnsignedDecimalUtil.java | 45 * @param bf byteBuffer 48 public static long getUnsignedInt(ByteBuffer bf) { in getUnsignedInt() argument 49 return bf.getInt() & MAX_UNSIGNED_INT_VALUE; in getUnsignedInt() 55 * @param bf byteBuffer 58 public static int getUnsignedShort(ByteBuffer bf) { in getUnsignedShort() argument 59 return bf.getShort() & MAX_UNSIGNED_SHORT_VALUE; in getUnsignedShort() 65 * @param bf byteBuffer 68 public static void setUnsignedInt(ByteBuffer bf, long value) { in setUnsignedInt() argument 75 bf.put(bytes); in setUnsignedInt() 81 * @param bf byteBuffe 84 setUnsignedShort(ByteBuffer bf, int value) setUnsignedShort() argument [all...] |
/developtools/hapsigner/hapsigntool_cpp/zip/src/ |
H A D | zip_entry_header.cpp | 24 ByteBuffer bf(bytes.c_str(), bytes.size()); in GetZipEntryHeader() 27 bf.GetInt32(entryHeaderInt32Value); in GetZipEntryHeader() 35 bf.GetInt16(entryHeaderInt16Value); in GetZipEntryHeader() 38 bf.GetInt16(entryHeaderInt16Value); in GetZipEntryHeader() 41 bf.GetInt16(entryHeaderInt16Value); in GetZipEntryHeader() 44 bf.GetInt16(entryHeaderInt16Value); in GetZipEntryHeader() 47 bf.GetInt16(entryHeaderInt16Value); in GetZipEntryHeader() 50 bf.GetInt32(entryHeaderInt32Value); in GetZipEntryHeader() 54 bf.GetUInt32(entryHeaderUInt32Value); in GetZipEntryHeader() 57 bf in GetZipEntryHeader() [all...] |
H A D | central_directory.cpp | 21 bool CentralDirectory::GetCentralDirectory(ByteBuffer& bf, CentralDirectory* cd) in GetCentralDirectory() argument 24 bf.GetInt32(signatureValue); in GetCentralDirectory() 30 SetCentralDirectoryValues(bf, cd); in GetCentralDirectory() 35 bf.GetData(&readFileName[0], fileNameLength); in GetCentralDirectory() 41 bf.GetData(&extra[0], extraLength); in GetCentralDirectory() 47 bf.GetData(&readComment[0], commentLength); in GetCentralDirectory() 55 void CentralDirectory::SetCentralDirectoryValues(ByteBuffer& bf, CentralDirectory* cd) in SetCentralDirectoryValues() argument 58 bf.GetInt16(centralDirectoryInt16Value); in SetCentralDirectoryValues() 61 bf.GetInt16(centralDirectoryInt16Value); in SetCentralDirectoryValues() 64 bf in SetCentralDirectoryValues() [all...] |
H A D | endof_central_directory.cpp | 39 ByteBuffer bf(bytes.c_str(), bytes.size()); in GetEOCDByBytes() 42 bf.GetInt32(signValue); in GetEOCDByBytes() 48 SetEndOfCentralDirectoryValues(bf, eocd); in GetEOCDByBytes() 51 if (bf.Remaining() != commentLength) { in GetEOCDByBytes() 53 SIGNATURE_TOOLS_LOGE("bf.Remaining() is not equal to commentLength, bf.Remaining(): %d, " in GetEOCDByBytes() 54 "commentLength: %" PRIu16, bf.Remaining(), commentLength); in GetEOCDByBytes() 59 bf.GetData(&readComment[0], commentLength); in GetEOCDByBytes() 63 if (bf.Remaining() != 0) { in GetEOCDByBytes() 65 SIGNATURE_TOOLS_LOGE("bf in GetEOCDByBytes() 71 SetEndOfCentralDirectoryValues(ByteBuffer& bf, EndOfCentralDirectory* eocd) SetEndOfCentralDirectoryValues() argument [all...] |
H A D | data_descriptor.cpp | 28 ByteBuffer bf(bytes.c_str(), bytes.size()); in GetDataDescriptor() 32 bf.GetInt32(signValue); in GetDataDescriptor() 39 bf.GetInt32(crc2Value); in GetDataDescriptor() 43 bf.GetUInt32(dataDescUInt32Value); in GetDataDescriptor() 46 bf.GetUInt32(dataDescUInt32Value); in GetDataDescriptor() 54 ByteBuffer bf(DES_LENGTH); in ToBytes() 55 bf.PutInt32(SIGNATURE); in ToBytes() 56 bf.PutInt32(m_crc32); in ToBytes() 57 bf.PutUInt32(m_compressedSize); in ToBytes() 58 bf in ToBytes() [all...] |
/developtools/hapsigner/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/codesigning/datastructure/ |
H A D | PageInfoExtension.java | 132 ByteBuffer bf = ByteBuffer.allocate(size()).order(ByteOrder.LITTLE_ENDIAN); in toByteArray() 133 bf.put(super.toByteArray()); in toByteArray() 134 bf.putLong(this.mapOffset); in toByteArray() 135 bf.putLong(this.mapSize); in toByteArray() 136 bf.put(this.unitSize); in toByteArray() 137 bf.put(this.reserved); in toByteArray() 138 bf.putInt(this.signSize); in toByteArray() 139 bf.put(this.signature); in toByteArray() 140 bf.put(this.zeroPadding); in toByteArray() 141 return bf in toByteArray() [all...] |
H A D | CodeSignBlockHeader.java | 117 ByteBuffer bf = ByteBuffer.allocate(size()).order(ByteOrder.LITTLE_ENDIAN); in toByteArray() 118 bf.putLong(magic); in toByteArray() 119 bf.putInt(version); in toByteArray() 120 bf.putInt(blockSize); in toByteArray() 121 bf.putInt(segmentNum); in toByteArray() 122 bf.putInt(flags); in toByteArray() 123 bf.put(reserved); in toByteArray() 124 return bf.array(); in toByteArray() 138 ByteBuffer bf = ByteBuffer.allocate(bytes.length).order(ByteOrder.LITTLE_ENDIAN); in fromByteArray() 139 bf in fromByteArray() [all...] |
H A D | ElfSignBlock.java | 152 ByteBuffer bf = ByteBuffer.allocate(size()).order(ByteOrder.LITTLE_ENDIAN); in toByteArray() 153 bf.putInt(type); in toByteArray() 154 bf.putInt(merkleTreeWithPadding.length); in toByteArray() 155 bf.put(merkleTreeWithPadding); in toByteArray() 156 bf.put(descriptorWithSign.toByteArray()); in toByteArray() 157 return bf.array(); in toByteArray() 168 ByteBuffer bf = ByteBuffer.allocate(bytes.length).order(ByteOrder.LITTLE_ENDIAN); in fromByteArray() 169 bf.put(bytes); in fromByteArray() 171 bf.rewind(); in fromByteArray() 172 int inTreeType = bf in fromByteArray() [all...] |
H A D | SignInfo.java | 202 ByteBuffer bf = ByteBuffer.allocate(this.size()).order(ByteOrder.LITTLE_ENDIAN); in toByteArray() 203 bf.putInt(this.saltSize); in toByteArray() 204 bf.putInt(this.sigSize); in toByteArray() 205 bf.putInt(this.flags); in toByteArray() 206 bf.putLong(this.dataSize); in toByteArray() 207 bf.put(this.salt); in toByteArray() 208 bf.putInt(this.extensionNum); in toByteArray() 209 bf.putInt(this.extensionOffset); in toByteArray() 210 bf.put(this.signature); in toByteArray() 211 bf in toByteArray() 277 parseExtensionList(ByteBuffer bf, int inExtensionNum) parseExtensionList() argument [all...] |
H A D | MerkleTreeExtension.java | 102 ByteBuffer bf = ByteBuffer.allocate(size()).order(ByteOrder.LITTLE_ENDIAN); in toByteArray() 103 bf.put(super.toByteArray()); in toByteArray() 104 bf.putLong(this.merkleTreeSize); in toByteArray() 105 bf.putLong(this.merkleTreeOffset); in toByteArray() 106 bf.put(this.rootHash); in toByteArray() 107 return bf.array(); in toByteArray() 118 ByteBuffer bf = ByteBuffer.allocate(bytes.length).order(ByteOrder.LITTLE_ENDIAN); in fromByteArray() 119 bf.put(bytes); in fromByteArray() 120 bf.rewind(); in fromByteArray() 121 long inMerkleTreeSize = bf in fromByteArray() [all...] |
H A D | FsVerityInfoSegment.java | 102 ByteBuffer bf = ByteBuffer.allocate(FS_VERITY_INFO_SEGMENT_SIZE).order(ByteOrder.LITTLE_ENDIAN); in toByteArray() 103 bf.putInt(this.magic); in toByteArray() 104 bf.put(version); in toByteArray() 105 bf.put(hashAlgorithm); in toByteArray() 106 bf.put(log2BlockSize); in toByteArray() 107 bf.put(reserved); in toByteArray() 108 return bf.array(); in toByteArray() 122 ByteBuffer bf = ByteBuffer.allocate(bytes.length).order(ByteOrder.LITTLE_ENDIAN); in fromByteArray() 123 bf.put(bytes); in fromByteArray() 124 bf in fromByteArray() [all...] |
H A D | SegmentHeader.java | 107 ByteBuffer bf = ByteBuffer.allocate(SEGMENT_HEADER_LENGTH).order(ByteOrder.LITTLE_ENDIAN); in toByteArray() 108 bf.putInt(type); in toByteArray() 109 bf.putInt(segmentOffset); in toByteArray() 110 bf.putInt(segmentSize); in toByteArray() 111 return bf.array(); in toByteArray() 125 ByteBuffer bf = ByteBuffer.allocate(SEGMENT_HEADER_LENGTH).order(ByteOrder.LITTLE_ENDIAN); in fromByteArray() 126 bf.put(bytes); in fromByteArray() 127 bf.rewind(); in fromByteArray() 128 int inType = bf.getInt(); in fromByteArray() 132 int inSegmentOffset = bf in fromByteArray() [all...] |
H A D | NativeLibInfoSegment.java | 182 ByteBuffer bf = ByteBuffer.allocate(this.size()).order(ByteOrder.LITTLE_ENDIAN); in toByteArray() 183 bf.putInt(magic); in toByteArray() 184 bf.putInt(segmentSize); in toByteArray() 185 bf.putInt(sectionNum); in toByteArray() 187 bf.putInt(offsetAndSize.getFileNameOffset()); in toByteArray() 188 bf.putInt(offsetAndSize.getFileNameSize()); in toByteArray() 189 bf.putInt(offsetAndSize.getSignInfoOffset()); in toByteArray() 190 bf.putInt(offsetAndSize.getSignInfoSize()); in toByteArray() 193 bf.put(fileName.getBytes(StandardCharsets.UTF_8)); in toByteArray() 195 bf in toByteArray() [all...] |
/developtools/hapsigner/hapsigntool_cpp/codesigning/datastructure/src/ |
H A D | segment_header.cpp | 59 std::unique_ptr<ByteBuffer> bf = std::make_unique<ByteBuffer>(ByteBuffer(SEGMENT_HEADER_LENGTH)); in ToByteArray() local 60 bf->PutInt32(type); in ToByteArray() 61 bf->PutInt32(segmentOffset); in ToByteArray() 62 bf->PutInt32(segmentSize); in ToByteArray() 63 bf->Flip(); in ToByteArray() 64 ret = std::vector<int8_t>(bf->GetBufferPtr(), bf->GetBufferPtr() + bf.get()->GetLimit()); in ToByteArray() 74 std::unique_ptr<ByteBuffer> bf = std::make_unique<ByteBuffer>(ByteBuffer(SEGMENT_HEADER_LENGTH)); in FromByteArray() local 75 bf in FromByteArray() [all...] |
H A D | sign_info.cpp | 171 std::unique_ptr<ByteBuffer> bf = std::make_unique<ByteBuffer>(ByteBuffer(GetSize())); in ToByteArray() local 173 bf->PutData(empt.data(), empt.size()); in ToByteArray() 174 bf->Clear(); in ToByteArray() 175 bf->PutInt32(saltSize); in ToByteArray() 176 bf->PutInt32(sigSize); in ToByteArray() 177 bf->PutInt32(flags); in ToByteArray() 178 bf->PutInt64(dataSize); in ToByteArray() 179 bf->PutData(salt.data(), salt.size()); in ToByteArray() 180 bf->PutInt32(extensionNum); in ToByteArray() 181 bf in ToByteArray() 195 ParseMerkleTreeExtension(ByteBuffer* bf, int32_t inExtensionNum) ParseMerkleTreeExtension() argument 226 std::unique_ptr<ByteBuffer> bf = std::make_unique<ByteBuffer>(ByteBuffer(bytes.size())); FromByteArray() local [all...] |
H A D | fs_verity_info_segment.cpp | 56 std::unique_ptr<ByteBuffer> bf = std::make_unique<ByteBuffer>(FS_VERITY_INFO_SEGMENT_SIZE); in ToByteArray() local 57 bf->PutInt32(magic); in ToByteArray() 58 bf->PutByte(version); in ToByteArray() 59 bf->PutByte(hashAlgorithm); in ToByteArray() 60 bf->PutByte(log2BlockSize); in ToByteArray() 61 bf->PutData(reserved.data(), reserved.size()); in ToByteArray() 62 ret = std::vector<int8_t>(bf->GetBufferPtr(), bf->GetBufferPtr() + bf->GetPosition()); in ToByteArray() 73 ByteBuffer bf(byte in FromByteArray() [all...] |
H A D | code_sign_block_header.cpp | 68 ByteBuffer bf(Size()); in ToByteArray() 69 bf.PutInt64(magic); in ToByteArray() 70 bf.PutInt32(version); in ToByteArray() 71 bf.PutInt32(blockSize); in ToByteArray() 72 bf.PutInt32(segmentNum); in ToByteArray() 73 bf.PutInt32(flags); in ToByteArray() 74 bf.PutData((const char*)reserved.data(), reserved.size()); in ToByteArray() 75 ret = std::vector<int8_t>(bf.GetBufferPtr(), bf.GetBufferPtr() + bf in ToByteArray() [all...] |
H A D | native_lib_info_segment.cpp | 83 std::unique_ptr<ByteBuffer> bf = std::make_unique<ByteBuffer>(ByteBuffer(Size())); in ToByteArray() local 85 bf->PutData(empt.data(), empt.size()); in ToByteArray() 86 bf->Clear(); in ToByteArray() 87 bf->PutInt32(magic); in ToByteArray() 88 bf->PutInt32(segmentSize); in ToByteArray() 89 bf->PutInt32(sectionNum); in ToByteArray() 91 bf->PutInt32(offsetAndSize.GetFileNameOffset()); in ToByteArray() 92 bf->PutInt32(offsetAndSize.GetFileNameSize()); in ToByteArray() 93 bf->PutInt32(offsetAndSize.GetSignInfoOffset()); in ToByteArray() 94 bf in ToByteArray() 111 std::unique_ptr<ByteBuffer> bf = std::make_unique<ByteBuffer>(ByteBuffer(bytes.size())); FromByteArray() local 158 CheckBuffer(ByteBuffer* bf, int32_t& inMagic, int32_t& inSegmentSize, int32_t& inSectionNum) CheckBuffer() argument [all...] |
H A D | elf_sign_block.cpp | 68 std::unique_ptr<ByteBuffer> bf = std::make_unique<ByteBuffer>(Size()); in ToByteArray() local 69 bf->PutInt32(type); in ToByteArray() 70 bf->PutInt32(merkleTreeWithPadding.size()); in ToByteArray() 71 bf->PutData(merkleTreeWithPadding.data(), merkleTreeWithPadding.size()); in ToByteArray() 74 bf->PutData(descriptorWithSignArr.data(), descriptorWithSignArr.size()); in ToByteArray() 75 ret = std::vector<int8_t>(bf->GetBufferPtr(), bf->GetBufferPtr() + bf->GetLimit()); in ToByteArray() 80 std::unique_ptr<ByteBuffer> bf = std::make_unique<ByteBuffer>(bytes.size()); in FromByteArray() local 81 bf in FromByteArray() [all...] |
H A D | merkle_tree_extension.cpp | 61 std::unique_ptr<ByteBuffer> bf = std::make_unique<ByteBuffer>(ByteBuffer( in ToByteArray() local 65 bf->PutData(extByteArr.data(), extByteArr.size()); in ToByteArray() 66 bf->PutInt64(merkleTreeSize); in ToByteArray() 67 bf->PutInt64(merkleTreeOffset); in ToByteArray() 68 bf->PutData(rootHash.data(), rootHash.size()); in ToByteArray() 69 ret = std::vector<int8_t>(bf->GetBufferPtr(), bf->GetBufferPtr() + bf->GetCapacity()); in ToByteArray() 74 std::unique_ptr<ByteBuffer> bf = std::make_unique<ByteBuffer>(ByteBuffer(bytes.size())); in FromByteArray() local 75 bf in FromByteArray() [all...] |
/developtools/hapsigner/hapsigntool_cpp/hap/entity/src/ |
H A D | block_head.cpp | 51 ByteBuffer bf = ByteBuffer(BlockHead::ELF_BLOCK_LEN); in GetBlockHeadLittleEndian() local 52 bf.PutByte(type); in GetBlockHeadLittleEndian() 53 bf.PutByte(tag); in GetBlockHeadLittleEndian() 54 bf.PutByte(0); in GetBlockHeadLittleEndian() 55 bf.PutByte(0); in GetBlockHeadLittleEndian() 56 bf.PutInt32(length); in GetBlockHeadLittleEndian() 57 bf.PutInt32(offset); in GetBlockHeadLittleEndian() 59 bf.GetData(0, ret, BlockHead::ELF_BLOCK_LEN); in GetBlockHeadLittleEndian()
|