/developtools/hapsigner/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/codesigning/fsverity/ |
H A D | FsVerityDescriptorWithSign.java | 24 * fsverity descriptor and signature 28 * 4) u8[] signature: signature after signing the data in byte array representation 39 private byte[] signature = new byte[0]; field in FsVerityDescriptorWithSign 45 * @param signature signature 47 public FsVerityDescriptorWithSign(FsVerityDescriptor fsVerityDescriptor, byte[] signature) { in FsVerityDescriptorWithSign() argument 49 if (signature != null) { in FsVerityDescriptorWithSign() 50 this.signature = signature; in FsVerityDescriptorWithSign() 63 FsVerityDescriptorWithSign(int type, int length, FsVerityDescriptor fsVerityDescriptor, byte[] signature) FsVerityDescriptorWithSign() argument [all...] |
/developtools/hapsigner/hapsigntool_cpp/codesigning/fsverity/src/ |
H A D | fs_verity_descriptor_with_sign.cpp | 26 const std::vector<int8_t> &signature) in FsVerityDescriptorWithSign() 29 if (!signature.empty()) { in FsVerityDescriptorWithSign() 30 this->signature = signature; in FsVerityDescriptorWithSign() 32 length = FsVerityDescriptor::DESCRIPTOR_SIZE + this->signature.size(); in FsVerityDescriptorWithSign() 36 FsVerityDescriptor fsVerityDescriptor, const std::vector<int8_t> &signature) in FsVerityDescriptorWithSign() 41 this->signature = signature; in FsVerityDescriptorWithSign() 47 return INTEGER_BYTES * tmpVariable + FsVerityDescriptor::DESCRIPTOR_SIZE + signature.size(); in Size() 58 buffer->PutData(signature in ToByteArray() 25 FsVerityDescriptorWithSign(FsVerityDescriptor fsVerityDescriptor, const std::vector<int8_t> &signature) FsVerityDescriptorWithSign() argument 35 FsVerityDescriptorWithSign(int32_t type, int32_t length, FsVerityDescriptor fsVerityDescriptor, const std::vector<int8_t> &signature) FsVerityDescriptorWithSign() argument [all...] |
/developtools/hapsigner/hapsigntool_cpp_test/unittest/codeSigning/utils/ |
H A D | cms_utils_test.cpp | 60 const std::string signature; in HWTEST_F() local 63 bool flag = CmsUtils::CheckOwnerID(signature, profileOwnerID, profileType); in HWTEST_F() 79 std::string signature; in HWTEST_F() local 80 FileUtils::ReadFile("./codeSigning/signed-profile.p7b", signature); in HWTEST_F() 84 bool flag = CmsUtils::CheckOwnerID(signature, profileOwnerID, profileType); in HWTEST_F() 100 std::string signature; in HWTEST_F() local 101 FileUtils::ReadFile("./codeSigning/signed-profile.p7b", signature); in HWTEST_F() 105 bool flag = CmsUtils::CheckOwnerID(signature, profileOwnerID, profileType); in HWTEST_F() 121 std::string signature; in HWTEST_F() local 122 FileUtils::ReadFile("./codeSigning/signed-profile.p7b", signature); in HWTEST_F() [all...] |
/developtools/hapsigner/hapsigntool_cpp_test/unittest/codeSigning/fsverity/ |
H A D | fs_verity_descriptor_with_sign_test.cpp | 60 std::vector<int8_t> signature = { 1, 1, 1, 1 }; in HWTEST_F() local 61 FsVerityDescriptorWithSign descriptor(fsVerityDescriptor, signature); in HWTEST_F() 78 std::vector<int8_t> signature; in HWTEST_F() local 79 FsVerityDescriptorWithSign descriptor(fsVerityDescriptor, signature); in HWTEST_F() 96 std::vector<int8_t> signature = { 1, 1, 1, 1 }; in HWTEST_F() local 99 FsVerityDescriptorWithSign descriptor(type, length, fsVerityDescriptor, signature); in HWTEST_F() 118 std::vector<int8_t> signature = { 1, 1, 1, 1 }; in HWTEST_F() local 121 FsVerityDescriptorWithSign descriptor(type, length, fsVerityDescriptor, signature); in HWTEST_F() 139 std::vector<int8_t> signature = { 1, 1, 1, 1 }; in HWTEST_F() local 142 FsVerityDescriptorWithSign descriptor(type, length, fsVerityDescriptor, signature); in HWTEST_F() [all...] |
/developtools/hapsigner/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/codesigning/datastructure/ |
H A D | PageInfoExtension.java | 40 * 6) u32 signSize: signature size 42 * 7) u8[] signature: signature of the data 76 private byte[] signature = new byte[0]; field in PageInfoExtension 93 public void setSignature(byte[] signature) { in setSignature() argument 94 if (signature != null) { in setSignature() 95 this.signSize = signature.length; in setSignature() 96 this.signature = signature; in setSignature() 139 bf.put(this.signature); in toByteArray() [all...] |
H A D | SignInfo.java | 31 * Sign info represents information after signing a file, including signature, merkle tree. 36 * 2) u32 sigSize: byte size of signature 48 * 8) u8[] signature: signature of the data 69 * sign info structure without signature in bytes, refer to toByteArray() method 91 private byte[] signature; field in SignInfo 105 * @param sig signature after signing the data in byte array representation 116 this.signature = sig; in SignInfo() 118 // align for extension after signature in SignInfo() 136 this.signature in SignInfo() 342 private byte[] signature; global() field in SignInfo.SignInfoBuilder 432 setSignature(byte[] signature) setSignature() argument [all...] |
/developtools/hapsigner/hapsigntool_cpp/codesigning/datastructure/src/ |
H A D | sign_info.cpp | 29 signature = std::vector<int8_t>(); in SignInfo() 47 signature = sig; in SignInfo() 49 // align for extension after signature in SignInfo() 64 const std::vector<int8_t>& signature, in SignInfo() 75 this->signature = signature; in SignInfo() 89 this->signature = other.signature; in SignInfo() 109 this->signature = other.signature; in operator =() 57 SignInfo(int32_t saltSize, int32_t sigSize, int32_t flags, int64_t dataSize, const std::vector<int8_t>& salt, int32_t extensionNum, int32_t extensionOffset, const std::vector<int8_t>& signature, const std::vector<int8_t>& zeroPadding, const std::vector<MerkleTreeExtension*>& extensionList) SignInfo() argument [all...] |
/developtools/hapsigner/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/signer/ |
H A D | LocalSigner.java | 79 Signature signature = Signature.getInstance(signAlg); in getSignature() 80 signature.initSign(privateKey); in getSignature() 82 signature.setParameter(parameterSpec); in getSignature() 84 signature.update(data); in getSignature() 85 signData = signature.sign(); in getSignature()
|
/developtools/hapsigner/hapsigntool_cpp/codesigning/fsverity/include/ |
H A D | fs_verity_descriptor_with_sign.h | 31 FsVerityDescriptorWithSign(FsVerityDescriptor fsVerityDescriptor, const std::vector<int8_t> &signature); 33 const std::vector<int8_t> &signature); 43 std::vector<int8_t> signature; member in OHOS::SignatureTools::FsVerityDescriptorWithSign
|
/developtools/hapsigner/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/codesigning/sign/ |
H A D | VerifyCodeSignature.java | 62 * Verify code signature given a file with code sign block 69 private static void checkOwnerID(byte[] signature, String profileOwnerID, String profileType) in checkOwnerID() argument 72 // if profileType is debug, check the app-id in signature, should be null or DEBUG_LIB_ID in checkOwnerID() 76 checkSignatureOwnerID(ownerID, signature, profileType); in checkOwnerID() 79 private static void checkHnpOwnerID(byte[] signature, String profileOwnerID, String profileType, String hnpType) in checkHnpOwnerID() argument 82 // if profileType is debug, check the app-id in signature, should be null or DEBUG_LIB_ID in checkHnpOwnerID() 90 checkSignatureOwnerID(ownerID, signature, profileType); in checkHnpOwnerID() 93 private static void checkSignatureOwnerID(String ownerID, byte[] signature, String profileType) in checkSignatureOwnerID() argument 95 CMSSignedData cmsSignedData = new CMSSignedData(signature); in checkSignatureOwnerID() 108 throw new VerifyCodeSignException("app-identifier is not in the signature"); in checkSignatureOwnerID() 385 verifySingleFile(InputStream input, long length, byte[] signature, long merkleTreeOffset, byte[] inMerkleTreeBytes) verifySingleFile() argument [all...] |
H A D | BcSignedDataGenerator.java | 125 throw new CodeSignException("get signature failed"); in createSignInfo() 203 Signature signature = Signature.getInstance(signPair.getFirst()); in verifySignFromServer() 204 signature.initVerify(publicKey); in verifySignFromServer() 206 signature.setParameter(signPair.getSecond()); in verifySignFromServer() 208 signature.update(authed); in verifySignFromServer() 209 if (!signature.verify(signBytes)) { in verifySignFromServer() 214 LOGGER.error("The generated signature could not be verified " + " using the public key in the certificate", in verifySignFromServer() 217 LOGGER.error("The generated signature " + signPair.getFirst() in verifySignFromServer() 220 LOGGER.error("The generated signature " + signPair.getSecond() in verifySignFromServer()
|
H A D | CodeSigning.java | 101 * Sign the given elf file, and pack all signature into output file 130 byte[] signature = generateSignature(fsVerityDigest, ownerID); in getElfCodeSignBlock() 136 .setSignSize(signature.length) in getElfCodeSignBlock() 144 signature); in getElfCodeSignBlock() 153 * Sign the given hap file, and pack all signature into output file 401 * @param ownerID app-id in signature to identify 435 * @param ownerID app-id in signature to identify 436 * @return pair of signature and tree 446 byte[] signature = generateSignature(fsVerityDigest, ownerID); in signFile() 452 signature); in signFile() [all...] |
/developtools/hapsigner/hapsigntool_cpp/codesigning/sign/src/ |
H A D | verify_code_signature.cpp | 90 std::vector<int8_t>& signature = elfSignBlock.GetSignature(); in VerifyElf() local 91 std::string signatureStr(signature.begin(), signature.end()); in VerifyElf() 124 std::vector<int8_t> signature = csb.GetHapInfoSegment().GetSignInfo().GetSignature(); in VerifyCodeSign() local 139 bool verifyFlag = VerifySingleFile(hap, dataSize, signature, mte->GetMerkleTreeOffset(), in VerifyCodeSign() 145 std::string signature_(signature.begin(), signature.end()); in VerifyCodeSign() 165 std::vector<int8_t> signature, in VerifySingleFile() 178 return CmsUtils::VerifySignDataWithUnsignedDataDigest(pairResult.first, signature); in VerifySingleFile() 164 VerifySingleFile(std::istream& input, int64_t length, std::vector<int8_t> signature, int64_t merkleTreeOffset, std::vector<int8_t> inMerkleTreeBytes) VerifySingleFile() argument
|
H A D | code_signing.cpp | 146 std::vector<int8_t> signature; in SignFile() local 147 bool generateSignatureFlag = GenerateSignature(fsVerityDigest, ownerID, signature); in SignFile() 158 SignInfo signInfo(saltSize, flags, fileSize, salt, signature); in SignFile() 194 std::vector<int8_t> signature; in GetElfCodeSignBlock() local 195 bool generateSignatureFlag = GenerateSignature(fsVerityDigest, ownerID, signature); in GetElfCodeSignBlock() 197 SIGNATURE_TOOLS_LOGE("[SignElf] generate elf signature failed"); in GetElfCodeSignBlock() 206 .SetSignSize(signature.size()) in GetElfCodeSignBlock() 215 FsVerityDescriptorWithSign(FsVerityDescriptor(fsdbuilder), signature); in GetElfCodeSignBlock() 531 SIGNATURE_TOOLS_LOGW("generate signature get owner id not null."); in GenerateSignature()
|
/developtools/hapsigner/hapsigntool_cpp/codesigning/utils/src/ |
H A D | cms_utils.cpp | 42 bool CmsUtils::CheckOwnerID(const std::string& signature, const std::string& profileOwnerID, in CheckOwnerID() argument 48 const unsigned char* data = reinterpret_cast<const unsigned char*>(signature.c_str()); in CheckOwnerID() 49 PKCS7* p7 = d2i_PKCS7(NULL, &data, static_cast<long>(signature.size())); in CheckOwnerID() 69 PrintErrorNumberMsg("VERIFY_ERROR", VERIFY_ERROR, "app-identifier is not in the signature"); in CheckOwnerID() 75 PrintErrorNumberMsg("VERIFY_ERROR", VERIFY_ERROR, "app-identifier in profile is null,in signature exist"); in CheckOwnerID() 85 PrintErrorNumberMsg("VERIFY_ERROR", VERIFY_ERROR, "app-identifier in signature is invalid"); in CheckOwnerID()
|
/developtools/hapsigner/hapsigntool_cpp/codesigning/datastructure/include/ |
H A D | sign_info.h | 47 const std::vector<int8_t>& signature, 71 std::vector<int8_t> signature; member in OHOS::SignatureTools::SignInfo
|
/developtools/hapsigner/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/profile/ |
H A D | VerifyHelper.java | 87 Signature signature = Signature.getInstance(algorithm); in verifySignature() 88 signature.initVerify(cert); in verifySignature() 89 signature.update(unsignedData); in verifySignature() 90 ValidateUtils.throwIfNotMatches(signature.verify(signedData), ERROR.SIGN_ERROR, "Signature not matched!"); in verifySignature() 93 CustomException.throwException(ERROR.SIGN_ERROR, "Failed to verify signature: " + exception.getMessage()); in verifySignature()
|
H A D | ProfileSignTool.java | 119 byte[] signature = signer.getSignature(signedAttr.getEncoded("DER"), sigAlg, null); in signProfile() 121 VerifyHelper.verifySignature(signer.getCertificates().get(0), signature, in signProfile() 125 new DEROctetString(signature), null); in signProfile()
|
/developtools/hapsigner/hapsigntool_cpp/codesigning/utils/include/ |
H A D | cms_utils.h | 31 static bool CheckOwnerID(const std::string& signature, const std::string& profileOwnerID,
|
/developtools/hapsigner/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/hap/sign/ |
H A D | BcPkcs7Generator.java | 158 throw new SignatureException("Generate signature bytes error"); in getSignerInfo() 243 Signature signature = Signature.getInstance(signAlgPair.getFirst()); in verifySignatureFromServer() 244 signature.initVerify(publicKey); in verifySignatureFromServer() 246 signature.setParameter(signAlgPair.getSecond()); in verifySignatureFromServer() 248 signature.update(authed.getEncoded()); in verifySignatureFromServer() 253 if (!signature.verify(signatureBytes)) { in verifySignatureFromServer() 258 LOGGER.error("Failed to verify generated signature using public key from certificate", e); in verifySignatureFromServer() 261 + " signature using public key from certificate", e); in verifySignatureFromServer() 264 + " signature using public key from certificate", e); in verifySignatureFromServer()
|
/developtools/hapsigner/hapsigntool_cpp_test/unittest/zip/ |
H A D | zip_signer_test.cpp | 483 int signature = eocd->GetSIGNATURE(); in HWTEST_F() local 486 EXPECT_EQ(initRes && eocd && eocdBytes.size() > 0 && signature != -1 && comment.size() == 0 && diskNum != -1, in HWTEST_F() 603 int signature = zipEntryData->GetZipEntryHeader()->GetSIGNATURE(); in HWTEST_F() local 604 ASSERT_NE(signature, -1); in HWTEST_F() 650 int signature = dataDescriptor->GetSIGNATURE(); in HWTEST_F() local 653 unCompressedSize != -1 && crc32 != -1 && signature != -1 && desLength != -1, true); in HWTEST_F() 694 int signature = cd->GetSIGNATURE(); in HWTEST_F() local 706 EXPECT_EQ(cd != nullptr && cdLength != -1 && signature != -1 && flag != -1 && lastTime != -1 && lastDate != -1 && in HWTEST_F()
|
/developtools/hapsigner/hapsigntool_cpp/profile/src/ |
H A D | pkcs7_data.cpp | 87 /* signature information */ in VerifySignature() 89 /* signature count */ in VerifySignature() 91 /* verify signature value */ in VerifySignature() 98 PrintErrorNumberMsg("VERIFY_ERROR", VERIFY_ERROR, "signature value verify failed"); in VerifySignature() 164 PrintErrorNumberMsg("VERIFY_ERROR", VERIFY_ERROR, "signature verify failed"); in Verify() 404 "new mem buf error!,pkcs7 verify signature failed"); in VerifySign() 409 PrintErrorNumberMsg("VERIFY_ERROR", VERIFY_ERROR, "pkcs7 verify signature failed"); in VerifySign() 475 /* Trace back through the subject information and validate the signature value of each certificate */ in VerifySignerInfoCertchain() 480 /* verify entity certificate signature value */ in VerifySignerInfoCertchain() 482 SIGNATURE_TOOLS_LOGE("entity cert signature verif in VerifySignerInfoCertchain() 520 std::string signature; Pkcs7SignAttr() local [all...] |
/developtools/hapsigner/hapsigntool_cpp/codesigning/sign/include/ |
H A D | verify_code_signature.h | 44 static bool VerifySingleFile(std::istream& input, int64_t length, std::vector<int8_t> signature,
|
/developtools/hapsigner/hapsigntool_cpp_test/unittest/codeSigning/sign/ |
H A D | verify_code_signature_test.cpp | 294 std::vector<int8_t> signature; in HWTEST_F() local 297 bool flag = VerifyCodeSignature::VerifySingleFile(input, length, signature, merkleTreeOffset, inMerkleTreeBytes); in HWTEST_F()
|
/developtools/hdc/hdc_rust/src/daemon_lib/ |
H A D | auth.rs | 549 crate::error!("validate signature failed: {}", &errlog); 551 Err(Error::new(ErrorKind::Other, "validate signature failed")) 624 "wrong command, need signature now", 648 async fn validate_signature(plain: String, pubkey: String, signature: String) -> io::Result<()> { 649 let signature_bytes = if let Ok(bytes) = base64::decode_block(&signature) { 652 return Err(Error::new(ErrorKind::Other, "signature decode failed")); 669 Err(Error::new(ErrorKind::Other, "signature not match"))
|