AndroidApplication Package File(APKIs an application installation file format on the Android operating system."Application package file".
If you know how to use the decompilation tool, you can download the apk parsing tool to obtain the decompilation code.
Download: SharpZipLib.zip http://www.icsharpcode.net/opensource/sharpziplib/download.aspx
The main method is as follows:
Using ICSharpCode. SharpZipLib. Zip;
Public static Dictionary <object, object> getPackageInfo (string path ){
Dictionary <object, object> returnMap = new Dictionary <object, object> ();
ReturnMap. Add ("VersionCode )","");
ReturnMap. Add ("version name (VersionName )","");
ReturnMap. Add ("Package name )","");
ReturnMap. Add ("signature (Sig )","");
ReturnMap. Add ("START activity ","");
ReturnMap ["certificate validity period"] = "";
ReturnMap ["Certificate expiration time"] = "";
ReturnMap ["Certificate Hash"] = "";
ReturnMap ["Certificate MD5"] = "";
ReturnMap ["PublicKey"] = "";
List <string> list = new List <string> {". DSA", ". RSA "};
If (string. IsNullOrWhiteSpace (path ))
{
Throw new Exception ("incorrect file path:" + path );
}
String str = "";
If (path. LastIndexOf (".")> = 0)
{
Str = path. Substring (path. LastIndexOf ("."));
}
If (". apk". Equals (str, StringComparison. OrdinalIgnoreCase ))
{
Try
{
ZipInputStream zip = new ZipInputStream (File. OpenRead (path ));
ZipEntry zipEntry = null;
While (zipEntry = zip. GetNextEntry ())! = Null)
{
String fileName = Path. GetFileName (zipEntry. Name );
If (fileName! = Null) & (fileName. LastIndexOf (".")> = 0 ))
{
String item = fileName. Substring (fileName. LastIndexOf ("."));
If ("AndroidManifest. xml". Equals (fileName, StringComparison. OrdinalIgnoreCase ))
{
GetPackageDetails (zip, zipEntry, returnMap );
}
Else if (list. Contains (item ))
{
GetSig (zip, zipEntry, returnMap );
}
}
}
Zip. Close ();
}
Catch (Exception exception)
{
Throw new Exception ("parsing apk package error:" + exception. Message );
}
}
Return returnMap;
}
Private static void getSig (ZipInputStream zip, ZipEntry zipEntry, Dictionary <object, object> returnMap)
{
MemoryStream stream = new MemoryStream ();
Byte [] rawCertData = new byte [0x400];
Int count = 0;
While (count = zip. Read (rawCertData, 0, 0x400)> 0)
{
Stream. Write (rawCertData, 0, count );
}
Stream. Seek (0L, SeekOrigin. Begin );
String str = "";
X509Certificate certificate = new X509Certificate (stream. GetBuffer ());
ReturnMap ["certificate validity period"] = certificate. GetEffectiveDateString ();
ReturnMap ["certificate expiration time"] = certificate. GetExpirationDateString ();
ReturnMap ["certificate Hash"] = certificate. GetCertHashString ();
ReturnMap ["certificate MD5"] = BitConverter. ToString (MD5.Create (). ComputeHash (certificate. GetRawCertData (). Replace ('-',':');
ReturnMap ["PublicKey"] = certificate. GetPublicKeyString ();
RawCertData = certificate. GetRawCertData ();
Byte [] buffer2 = SHA1.Create (). ComputeHash (certificate. GetRawCertData ());
For (int I = 0; I <buffer2.Length; I ++)
{
Str = str + (sbyte) buffer2 [I]);
}
Stream. Close ();
ReturnMap ["signature (Sig)"] = str;
}
The size of the apk file to be uploaded is limited. The web. config file is added as follows:
<System. web>
<HttpRuntime maxRequestLength = "" executionTimeout = "3600"/>
</System. web>
<System. webServer>
<Security>
<RequestFiltering>
<RequestLimits maxAllowedContentLength = "">
</RequestLimits>
</RequestFiltering>
</Security>
</System. webServer>