· 7 years ago · Mar 05, 2018, 08:18 PM
1 Decompilers online
2 File Name: FHAgentCustomAzureSASToken.jar, Done.
3
4 Java decompilers
5 APK decompiler
6 ApkTool online
7 Download Jad
8
9
10 Decompilation Results
11 Decompilation Results
12File Name: FHAgentCustomAzureSASToken.jar
13Decompiler: JDCore
14Job status: Done.
15
16
17
18 Twitter Facebook Google+ Stumbleupon LinkedIn
19
20
21
22 FHAgentCustomAzureSASToken.jar net fiscalhub TokenSASAzure.java
23 package net.fiscalhub;
24
25import java.io.UnsupportedEncodingException;
26import java.net.URLEncoder;
27import java.security.InvalidKeyException;
28import java.security.NoSuchAlgorithmException;
29import java.util.Base64.Encoder;
30import javax.crypto.Mac;
31
32public class TokenSASAzure
33{
34 public TokenSASAzure() {}
35
36 public static String GetSASToken(String resourceUri, String keyName, String key)
37 {
38 long epoch = System.currentTimeMillis() / 1000L;
39 int week = 604800;
40 String expiry = Long.toString(epoch + week);
41
42 String sasToken = null;
43 try
44 {
45 String stringToSign = URLEncoder.encode(resourceUri, "UTF-8") + "\n" + expiry;
46 String signature = getHMAC256(key, stringToSign);
47 sasToken = "SharedAccessSignature sr=" + URLEncoder.encode(resourceUri, "UTF-8") + "&sig=" +
48 URLEncoder.encode(signature, "UTF-8") + "&se=" + expiry + "&skn=" + keyName;
49 }
50 catch (UnsupportedEncodingException e)
51 {
52 e.printStackTrace();
53 }
54 return sasToken;
55 }
56
57 private static String getHMAC256(String key, String input)
58 {
59 Mac sha256_HMAC = null;
60 String hash = null;
61 try
62 {
63 sha256_HMAC = Mac.getInstance("HmacSHA256");
64 javax.crypto.spec.SecretKeySpec secret_key = new javax.crypto.spec.SecretKeySpec(key.getBytes(), "HmacSHA256");
65 sha256_HMAC.init(secret_key);
66 Base64.Encoder encoder = java.util.Base64.getEncoder();
67
68 hash = new String(encoder.encode(sha256_HMAC.doFinal(input.getBytes("UTF-8"))));
69 }
70 catch (InvalidKeyException e)
71 {
72 e.printStackTrace();
73 }
74 catch (NoSuchAlgorithmException e)
75 {
76 e.printStackTrace();
77 }
78 catch (IllegalStateException e)
79 {
80 e.printStackTrace();
81 }
82 catch (UnsupportedEncodingException e)
83 {
84 e.printStackTrace();
85 }
86 return hash;
87 }
88}
89
90
91
92
93 Twitter Facebook Google+ Stumbleupon LinkedIn
94Select a decompiler
95 JDCore (very fast)
96 CFR (very good and well-supported decompiler for Java 8)
97 Jadx, fast and with Android support
98 Procyon
99 Fernflower
100 JAD (very fast, but outdated)
101Privacy Policy