Skip to content

Commit 89f0caf

Browse files
SDK regenerated by CI server [ci skip]
1 parent ddc29f7 commit 89f0caf

File tree

310 files changed

+4998
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

310 files changed

+4998
-0
lines changed

src/main/java/com/aspose/words/cloud/ApiClient.java

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,23 @@
3737
import org.threeten.bp.LocalDate;
3838
import org.threeten.bp.OffsetDateTime;
3939

40+
import javax.crypto.Cipher;
41+
import javax.crypto.NoSuchPaddingException;
4042
import javax.mail.BodyPart;
4143
import javax.mail.MessagingException;
4244
import javax.mail.internet.MimeMultipart;
4345
import javax.mail.util.ByteArrayDataSource;
4446
import java.io.*;
4547
import java.lang.reflect.Type;
48+
import java.math.BigInteger;
4649
import java.net.URLConnection;
4750
import java.net.URLEncoder;
51+
import java.security.InvalidKeyException;
52+
import java.security.KeyFactory;
53+
import java.security.NoSuchAlgorithmException;
54+
import java.security.PublicKey;
55+
import java.security.spec.InvalidKeySpecException;
56+
import java.security.spec.RSAPublicKeySpec;
4857
import java.util.*;
4958
import java.util.Map.Entry;
5059
import java.util.concurrent.TimeUnit;
@@ -72,6 +81,7 @@ public class ApiClient {
7281
private String refreshToken;
7382
private String ClientSecret;
7483
private String clientId;
84+
private Cipher key;
7585

7686
public ApiClient(String clientId, String clientSecret, String baseUrl) {
7787
this();
@@ -99,6 +109,25 @@ public ApiClient() {
99109
setReadTimeout(5 * 60 * 1000);
100110
}
101111

112+
113+
/**
114+
* Gets a public key
115+
* @return public key
116+
*/
117+
public Cipher getKey() {
118+
return key;
119+
}
120+
121+
/**
122+
* Sets a public key
123+
* @param key
124+
* @return api client
125+
*/
126+
public ApiClient setKey(Cipher key) {
127+
this.key = key;
128+
return this;
129+
}
130+
102131
/**
103132
* Get NotAuth http code
104133
*
@@ -1145,6 +1174,18 @@ public void requestToken() throws ApiException {
11451174
}
11461175
}
11471176

1177+
public void setRsaKey(String modulus, String exponent) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException {
1178+
byte[] modulusByte = Base64.getDecoder().decode(modulus);
1179+
BigInteger modulusInt = new BigInteger(1, modulusByte);
1180+
byte[] exponentByte = Base64.getDecoder().decode(exponent);
1181+
BigInteger exponentInt = new BigInteger(1, exponentByte);
1182+
RSAPublicKeySpec spec = new RSAPublicKeySpec(modulusInt, exponentInt);
1183+
KeyFactory factory = KeyFactory.getInstance("RSA");
1184+
PublicKey key = factory.generatePublic(spec);
1185+
this.key = Cipher.getInstance("RSA");
1186+
this.key.init(Cipher.ENCRYPT_MODE, key);
1187+
}
1188+
11481189
/**
11491190
* AddParameterToQuery
11501191
*/

src/main/java/com/aspose/words/cloud/api/WordsApi.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,13 @@
3434
import com.google.gson.reflect.TypeToken;
3535
import com.squareup.okhttp.Response;
3636
import java.io.IOException;
37+
import javax.crypto.NoSuchPaddingException;
3738
import javax.mail.MessagingException;
3839
import java.io.File;
3940
import java.lang.reflect.Type;
41+
import java.security.InvalidKeyException;
42+
import java.security.NoSuchAlgorithmException;
43+
import java.security.spec.InvalidKeySpecException;
4044
import java.util.*;
4145

4246
public class WordsApi {
@@ -52,6 +56,16 @@ public WordsApi() {
5256

5357
public WordsApi(ApiClient apiClient) {
5458
this.apiClient = apiClient;
59+
try {
60+
this.checkRsaKey();
61+
} catch (ApiException e) {
62+
} catch (MessagingException e) {
63+
} catch (IOException e) {
64+
} catch (InvalidKeySpecException e) {
65+
} catch (NoSuchAlgorithmException e) {
66+
} catch (NoSuchPaddingException e) {
67+
} catch (InvalidKeyException e) {
68+
}
5569
}
5670

5771
public ApiClient getApiClient() {
@@ -60,6 +74,16 @@ public ApiClient getApiClient() {
6074

6175
public void setApiClient(ApiClient apiClient) {
6276
this.apiClient = apiClient;
77+
try {
78+
this.checkRsaKey();
79+
} catch (ApiException e) {
80+
} catch (MessagingException e) {
81+
} catch (IOException e) {
82+
} catch (InvalidKeySpecException e) {
83+
} catch (NoSuchAlgorithmException e) {
84+
} catch (NoSuchPaddingException e) {
85+
} catch (InvalidKeyException e) {
86+
}
6387
}
6488

6589
@SuppressWarnings("rawtypes")
@@ -23043,4 +23067,9 @@ public Object[] batch(RequestIfc... requests) throws ApiException, IOException {
2304323067
throw new ApiException(e);
2304423068
}
2304523069
}
23070+
23071+
private void checkRsaKey() throws ApiException, MessagingException, IOException, InvalidKeySpecException, NoSuchAlgorithmException, InvalidKeyException, NoSuchPaddingException {
23072+
PublicKeyResponse pkResponse = this.getPublicKey(new GetPublicKeyRequest());
23073+
this.apiClient.setRsaKey(pkResponse.getModulus(), pkResponse.getExponent());
23074+
}
2304623075
}

src/main/java/com/aspose/words/cloud/model/requests/AcceptAllRevisionsOnlineRequest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@
3131
import com.aspose.words.cloud.model.*;
3232
import com.aspose.words.cloud.model.responses.*;
3333
import com.squareup.okhttp.*;
34+
import javax.crypto.BadPaddingException;
35+
import javax.crypto.IllegalBlockSizeException;
3436
import javax.mail.MessagingException;
3537
import javax.mail.internet.MimeMultipart;
3638
import java.io.*;
3739
import java.lang.reflect.Type;
40+
import java.nio.charset.StandardCharsets;
3841
import java.util.*;
3942

4043
/*
@@ -157,6 +160,19 @@ public Request buildHttpRequest(ApiClient apiClient, final ProgressResponseBody.
157160
apiClient.addParameterToQuery(localVarQueryParams, "loadEncoding", getLoadEncoding());
158161
apiClient.addParameterToQuery(localVarQueryParams, "password", getPassword());
159162
apiClient.addParameterToQuery(localVarQueryParams, "destFileName", getDestFileName());
163+
int index = 0;
164+
for (int i = 0; i < localVarQueryParams.size(); i++) {
165+
if (localVarQueryParams.get(i).getName().equals("password")) {
166+
index = i;
167+
try {
168+
apiClient.addParameterToQuery(localVarQueryParams, "encryptedPassword", Base64.getEncoder().encode(apiClient.getKey().doFinal(this.password.getBytes(StandardCharsets.UTF_8))));
169+
} catch (IllegalBlockSizeException e) {
170+
} catch (BadPaddingException e) {
171+
}
172+
}
173+
}
174+
175+
localVarQueryParams.remove(index);
160176

161177
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
162178

src/main/java/com/aspose/words/cloud/model/requests/AcceptAllRevisionsRequest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@
3131
import com.aspose.words.cloud.model.*;
3232
import com.aspose.words.cloud.model.responses.*;
3333
import com.squareup.okhttp.*;
34+
import javax.crypto.BadPaddingException;
35+
import javax.crypto.IllegalBlockSizeException;
3436
import javax.mail.MessagingException;
3537
import javax.mail.internet.MimeMultipart;
3638
import java.io.*;
3739
import java.lang.reflect.Type;
40+
import java.nio.charset.StandardCharsets;
3841
import java.util.*;
3942

4043
/*
@@ -202,6 +205,19 @@ public Request buildHttpRequest(ApiClient apiClient, final ProgressResponseBody.
202205
apiClient.addParameterToQuery(localVarQueryParams, "loadEncoding", getLoadEncoding());
203206
apiClient.addParameterToQuery(localVarQueryParams, "password", getPassword());
204207
apiClient.addParameterToQuery(localVarQueryParams, "destFileName", getDestFileName());
208+
int index = 0;
209+
for (int i = 0; i < localVarQueryParams.size(); i++) {
210+
if (localVarQueryParams.get(i).getName().equals("password")) {
211+
index = i;
212+
try {
213+
apiClient.addParameterToQuery(localVarQueryParams, "encryptedPassword", Base64.getEncoder().encode(apiClient.getKey().doFinal(this.password.getBytes(StandardCharsets.UTF_8))));
214+
} catch (IllegalBlockSizeException e) {
215+
} catch (BadPaddingException e) {
216+
}
217+
}
218+
}
219+
220+
localVarQueryParams.remove(index);
205221

206222
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
207223

src/main/java/com/aspose/words/cloud/model/requests/AppendDocumentOnlineRequest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@
3131
import com.aspose.words.cloud.model.*;
3232
import com.aspose.words.cloud.model.responses.*;
3333
import com.squareup.okhttp.*;
34+
import javax.crypto.BadPaddingException;
35+
import javax.crypto.IllegalBlockSizeException;
3436
import javax.mail.MessagingException;
3537
import javax.mail.internet.MimeMultipart;
3638
import java.io.*;
3739
import java.lang.reflect.Type;
40+
import java.nio.charset.StandardCharsets;
3841
import java.util.*;
3942

4043
/*
@@ -227,6 +230,19 @@ public Request buildHttpRequest(ApiClient apiClient, final ProgressResponseBody.
227230
apiClient.addParameterToQuery(localVarQueryParams, "destFileName", getDestFileName());
228231
apiClient.addParameterToQuery(localVarQueryParams, "revisionAuthor", getRevisionAuthor());
229232
apiClient.addParameterToQuery(localVarQueryParams, "revisionDateTime", getRevisionDateTime());
233+
int index = 0;
234+
for (int i = 0; i < localVarQueryParams.size(); i++) {
235+
if (localVarQueryParams.get(i).getName().equals("password")) {
236+
index = i;
237+
try {
238+
apiClient.addParameterToQuery(localVarQueryParams, "encryptedPassword", Base64.getEncoder().encode(apiClient.getKey().doFinal(this.password.getBytes(StandardCharsets.UTF_8))));
239+
} catch (IllegalBlockSizeException e) {
240+
} catch (BadPaddingException e) {
241+
}
242+
}
243+
}
244+
245+
localVarQueryParams.remove(index);
230246

231247
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
232248

src/main/java/com/aspose/words/cloud/model/requests/AppendDocumentRequest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@
3131
import com.aspose.words.cloud.model.*;
3232
import com.aspose.words.cloud.model.responses.*;
3333
import com.squareup.okhttp.*;
34+
import javax.crypto.BadPaddingException;
35+
import javax.crypto.IllegalBlockSizeException;
3436
import javax.mail.MessagingException;
3537
import javax.mail.internet.MimeMultipart;
3638
import java.io.*;
3739
import java.lang.reflect.Type;
40+
import java.nio.charset.StandardCharsets;
3841
import java.util.*;
3942

4043
/*
@@ -272,6 +275,19 @@ public Request buildHttpRequest(ApiClient apiClient, final ProgressResponseBody.
272275
apiClient.addParameterToQuery(localVarQueryParams, "destFileName", getDestFileName());
273276
apiClient.addParameterToQuery(localVarQueryParams, "revisionAuthor", getRevisionAuthor());
274277
apiClient.addParameterToQuery(localVarQueryParams, "revisionDateTime", getRevisionDateTime());
278+
int index = 0;
279+
for (int i = 0; i < localVarQueryParams.size(); i++) {
280+
if (localVarQueryParams.get(i).getName().equals("password")) {
281+
index = i;
282+
try {
283+
apiClient.addParameterToQuery(localVarQueryParams, "encryptedPassword", Base64.getEncoder().encode(apiClient.getKey().doFinal(this.password.getBytes(StandardCharsets.UTF_8))));
284+
} catch (IllegalBlockSizeException e) {
285+
} catch (BadPaddingException e) {
286+
}
287+
}
288+
}
289+
290+
localVarQueryParams.remove(index);
275291

276292
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
277293

src/main/java/com/aspose/words/cloud/model/requests/ApplyStyleToDocumentElementOnlineRequest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@
3131
import com.aspose.words.cloud.model.*;
3232
import com.aspose.words.cloud.model.responses.*;
3333
import com.squareup.okhttp.*;
34+
import javax.crypto.BadPaddingException;
35+
import javax.crypto.IllegalBlockSizeException;
3436
import javax.mail.MessagingException;
3537
import javax.mail.internet.MimeMultipart;
3638
import java.io.*;
3739
import java.lang.reflect.Type;
40+
import java.nio.charset.StandardCharsets;
3841
import java.util.*;
3942

4043
/*
@@ -254,6 +257,19 @@ public Request buildHttpRequest(ApiClient apiClient, final ProgressResponseBody.
254257
apiClient.addParameterToQuery(localVarQueryParams, "destFileName", getDestFileName());
255258
apiClient.addParameterToQuery(localVarQueryParams, "revisionAuthor", getRevisionAuthor());
256259
apiClient.addParameterToQuery(localVarQueryParams, "revisionDateTime", getRevisionDateTime());
260+
int index = 0;
261+
for (int i = 0; i < localVarQueryParams.size(); i++) {
262+
if (localVarQueryParams.get(i).getName().equals("password")) {
263+
index = i;
264+
try {
265+
apiClient.addParameterToQuery(localVarQueryParams, "encryptedPassword", Base64.getEncoder().encode(apiClient.getKey().doFinal(this.password.getBytes(StandardCharsets.UTF_8))));
266+
} catch (IllegalBlockSizeException e) {
267+
} catch (BadPaddingException e) {
268+
}
269+
}
270+
}
271+
272+
localVarQueryParams.remove(index);
257273

258274
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
259275

src/main/java/com/aspose/words/cloud/model/requests/ApplyStyleToDocumentElementRequest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@
3131
import com.aspose.words.cloud.model.*;
3232
import com.aspose.words.cloud.model.responses.*;
3333
import com.squareup.okhttp.*;
34+
import javax.crypto.BadPaddingException;
35+
import javax.crypto.IllegalBlockSizeException;
3436
import javax.mail.MessagingException;
3537
import javax.mail.internet.MimeMultipart;
3638
import java.io.*;
3739
import java.lang.reflect.Type;
40+
import java.nio.charset.StandardCharsets;
3841
import java.util.*;
3942

4043
/*
@@ -299,6 +302,19 @@ public Request buildHttpRequest(ApiClient apiClient, final ProgressResponseBody.
299302
apiClient.addParameterToQuery(localVarQueryParams, "destFileName", getDestFileName());
300303
apiClient.addParameterToQuery(localVarQueryParams, "revisionAuthor", getRevisionAuthor());
301304
apiClient.addParameterToQuery(localVarQueryParams, "revisionDateTime", getRevisionDateTime());
305+
int index = 0;
306+
for (int i = 0; i < localVarQueryParams.size(); i++) {
307+
if (localVarQueryParams.get(i).getName().equals("password")) {
308+
index = i;
309+
try {
310+
apiClient.addParameterToQuery(localVarQueryParams, "encryptedPassword", Base64.getEncoder().encode(apiClient.getKey().doFinal(this.password.getBytes(StandardCharsets.UTF_8))));
311+
} catch (IllegalBlockSizeException e) {
312+
} catch (BadPaddingException e) {
313+
}
314+
}
315+
}
316+
317+
localVarQueryParams.remove(index);
302318

303319
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
304320

src/main/java/com/aspose/words/cloud/model/requests/BuildReportOnlineRequest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@
3131
import com.aspose.words.cloud.model.*;
3232
import com.aspose.words.cloud.model.responses.*;
3333
import com.squareup.okhttp.*;
34+
import javax.crypto.BadPaddingException;
35+
import javax.crypto.IllegalBlockSizeException;
3436
import javax.mail.MessagingException;
3537
import javax.mail.internet.MimeMultipart;
3638
import java.io.*;
3739
import java.lang.reflect.Type;
40+
import java.nio.charset.StandardCharsets;
3841
import java.util.*;
3942

4043
/*
@@ -165,6 +168,19 @@ public Request buildHttpRequest(ApiClient apiClient, final ProgressResponseBody.
165168
List<Pair> localVarQueryParams = new ArrayList<Pair>();
166169
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
167170
apiClient.addParameterToQuery(localVarQueryParams, "documentFileName", getDocumentFileName());
171+
int index = 0;
172+
for (int i = 0; i < localVarQueryParams.size(); i++) {
173+
if (localVarQueryParams.get(i).getName().equals("password")) {
174+
index = i;
175+
try {
176+
apiClient.addParameterToQuery(localVarQueryParams, "encryptedPassword", Base64.getEncoder().encode(apiClient.getKey().doFinal(this.password.getBytes(StandardCharsets.UTF_8))));
177+
} catch (IllegalBlockSizeException e) {
178+
} catch (BadPaddingException e) {
179+
}
180+
}
181+
}
182+
183+
localVarQueryParams.remove(index);
168184

169185
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
170186

0 commit comments

Comments
 (0)