1 Star 0 Fork 0

奈蜇579/apkverifier

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
verificationresult.go 1.67 KB
一键复制 编辑 原始数据 按行查看 历史
Vojtěch Boček 提交于 2023-10-31 19:33 +08:00 . feat: update to Android 14
package signingblock
import (
"crypto/x509"
"fmt"
)
type VerificationResult struct {
Certs [][]*x509.Certificate
SchemeId int
SigningLineage *V3SigningLineage
// When APK is signed with v3.1, the v3 result is stored here. Any v3 errors are lifted to the main Warnings/errors though
ExtraResults map[int]*VerificationResult
Frosting *FrostingResult
SourceStamp *SourceStampResult
// Extra blocks found in the signing block that are not used by apkverifier,
// either completely unknown, or those found in BlockId constants.
// Parsed block types (schemeV2, V3, play frosting..) will NOT be in this map.
// May be nil.
ExtraBlocks map[BlockId][]byte
Warnings []string
Errors []error
}
type FrostingResult struct {
Error error
KeySha256 string
ProtobufInfo []byte
}
type certAdder struct {
Certs []*x509.Certificate
res *VerificationResult
}
func (r *VerificationResult) addWarning(format string, args ...interface{}) {
r.Warnings = append(r.Warnings, fmt.Sprintf(format, args...))
}
func (r *VerificationResult) addError(format string, args ...interface{}) {
r.Errors = append(r.Errors, fmt.Errorf(format, args...))
}
func (r *VerificationResult) ContainsErrors() bool {
return len(r.Errors) != 0
}
func (r *VerificationResult) GetLastError() error {
if l := len(r.Errors); l != 0 {
return r.Errors[l-1]
}
return nil
}
func (r *VerificationResult) getCertAdder() certAdder {
return certAdder{
res: r,
}
}
func (a *certAdder) append(cert *x509.Certificate) {
a.Certs = append(a.Certs, cert)
if len(a.Certs) == 1 {
a.res.Certs = append(a.res.Certs, a.Certs)
} else {
idx := len(a.res.Certs) - 1
a.res.Certs[idx] = a.Certs
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/naizhe579/apkverifier.git
git@gitee.com:naizhe579/apkverifier.git
naizhe579
apkverifier
apkverifier
v1.0.1

搜索帮助