Documentation
¶
Index ¶
- Constants
- func Checksum(data []byte) uint32
- func EncodeRSAPublicKey(pub *rsa.PublicKey) []byte
- func HelperLaunchCommand(apkPath, packageName, helperClass, certPin string, appUID int) string
- func HelperStdin(nonce string) ([]byte, error)
- func LaunchHelper(conn *Conn, apkPath, packageName, helperClass, certPin string, appUID int, ...) error
- type Conn
- type Handoff
- type Identity
- type Message
- type PairingAuth
- type PeerInfo
- type Spake2
- type SpakeRole
- type Stream
Constants ¶
const ( CommandCNXN = 0x4e584e43 CommandAUTH = 0x48545541 CommandOPEN = 0x4e45504f CommandOKAY = 0x59414b4f CommandCLSE = 0x45534c43 CommandWRTE = 0x45545257 CommandSTLS = 0x534c5453 Version = 0x01000001 VersionSkipSum = 0x01000001 STLSVersion = 0x01000000 HeaderSize = 24 MaxPayload = 1024 * 1024 DefaultMaxPayload = 4096 )
Variables ¶
This section is empty.
Functions ¶
func EncodeRSAPublicKey ¶
EncodeRSAPublicKey implements adb's packed RSAPublicKey: uint32 word count (64), uint32 n0inv, modulus[256], rr[256], uint32 exponent. All integer fields, including the modulus and rr arrays, are little-endian.
func HelperLaunchCommand ¶
HelperLaunchCommand constructs the shell command used after the ADB connection is authenticated. The nonce is not part of this string; it is written to the exec stream's stdin so it does not appear in /proc cmdline.
func HelperStdin ¶
Types ¶
type Conn ¶
type Conn struct {
Banner string
Version uint32
MaxData uint32
// contains filtered or unexported fields
}
type Handoff ¶
type Handoff struct {
CallingUID int
CallingPID int
ReportedUID int
ReportedPID int
HelperAPK string
AppAPK string
Nonce string
Expected string
HasBinder bool
}
Handoff contains only the facts Android exposes to the helper provider. UID/PID comparisons use the Binder caller, never the helper's self-report.
type Identity ¶
type Identity struct {
Private *rsa.PrivateKey
Name string
}
Identity is the persistent ADB client identity. The private key is PKCS#8; callers must keep the file in private app storage and wrap it with Android Keystore before production use.
func GenerateIdentity ¶
func LoadOrCreateIdentity ¶
LoadOrCreateIdentity reads path when present and never overwrites an unreadable key. Losing the pairing key silently would make the device reject every future connection.
func (*Identity) ADBPublicKey ¶
ADBPublicKey returns the line stored by adbd in /data/misc/adb/adb_keys: base64(524-byte RSAPublicKey) + name.
func (*Identity) Certificate ¶
func (*Identity) TLSCertificate ¶
func (i *Identity) TLSCertificate() (tls.Certificate, error)
type Message ¶
func ReadMessage ¶
ReadMessage reads one 24-byte-header ADB packet. A clean EOF before the header returns io.EOF; a truncated header/data is io.ErrUnexpectedEOF.
func (Message) CommandName ¶
type PairingAuth ¶
type PairingAuth struct {
Message []byte
// contains filtered or unexported fields
}
func NewPairingAuth ¶
func NewPairingAuth(role SpakeRole, password, seed []byte) (*PairingAuth, error)
func (*PairingAuth) Init ¶
func (p *PairingAuth) Init(their []byte) error
type PeerInfo ¶
type Spake2 ¶
type Spake2 struct {
// contains filtered or unexported fields
}
Field names are deliberately neutral: the repository secret filter treats assignments named like privateKey/password as redacted literals.
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream is a single ADB service stream. It is intentionally sequential: the helper launch path writes its nonce and then reads the helper's short status output. The full Phase 2 display session will move this behind a multiplexed reader before concurrent streams are allowed.