aio_adb_shell.auth.sign_pythonrsa module¶
ADB authentication using the rsa
package.
Contents
-
class
aio_adb_shell.auth.sign_pythonrsa.
PythonRSASigner
(pub=None, priv=None)[source]¶ Bases:
object
Implements
adb_protocol.AuthSigner
using http://stuvel.eu/rsa.- Parameters
pub (str, None) – The contents of the public key file
priv (str, None) – The path to the private key
-
priv_key
¶ The loaded private key
- Type
rsa.key.PrivateKey
-
pub_key
¶ The contents of the public key file
- Type
str, None
-
classmethod
FromRSAKeyPath
(rsa_key_path)[source]¶ Create a
PythonRSASigner
instance using the provided private key.- Parameters
rsa_key_path (str) – The path to the private key; the public key must be
rsa_key_path + '.pub'
.- Returns
A
PythonRSASigner
with private keyrsa_key_path
and public keyrsa_key_path + '.pub'
- Return type
-
class
aio_adb_shell.auth.sign_pythonrsa.
_Accum
[source]¶ Bases:
object
A fake hashing algorithm.
The Python
rsa
lib hashes all messages it signs. ADB does it already, we just need to slap a signature on top of already hashed message. Introduce a “fake” hashing algo for this.-
_buf
¶ A buffer for storing data before it is signed
- Type
bytes
-
-
aio_adb_shell.auth.sign_pythonrsa.
_load_rsa_private_key
(pem)[source]¶ PEM encoded PKCS#8 private key ->
rsa.PrivateKey
.ADB uses private RSA keys in pkcs#8 format. The
rsa
library doesn’t support them natively. Do some ASN unwrapping to extract naked RSA key (in der-encoded form).See:
- Parameters
pem (str) – The private key to be loaded
- Returns
The loaded private key
- Return type
rsa.key.PrivateKey