[1399] | 1 | package org.expeditee.encryption.io;
|
---|
[1200] | 2 |
|
---|
| 3 | import java.io.BufferedReader;
|
---|
| 4 | import java.io.FileInputStream;
|
---|
[1202] | 5 | import java.io.FileReader;
|
---|
[1200] | 6 | import java.io.IOException;
|
---|
| 7 | import java.io.InputStreamReader;
|
---|
| 8 | import java.io.Reader;
|
---|
[1408] | 9 | import java.lang.reflect.Method;
|
---|
[1200] | 10 | import java.security.InvalidKeyException;
|
---|
| 11 | import java.security.NoSuchAlgorithmException;
|
---|
[1408] | 12 | import java.util.ArrayList;
|
---|
[1200] | 13 | import java.util.Arrays;
|
---|
| 14 | import java.util.Base64;
|
---|
[1408] | 15 | import java.util.List;
|
---|
[1414] | 16 | import java.util.function.BiConsumer;
|
---|
[1408] | 17 | import java.util.function.Predicate;
|
---|
[1200] | 18 |
|
---|
| 19 | import javax.crypto.BadPaddingException;
|
---|
| 20 | import javax.crypto.Cipher;
|
---|
| 21 | import javax.crypto.IllegalBlockSizeException;
|
---|
| 22 | import javax.crypto.NoSuchPaddingException;
|
---|
| 23 | import javax.crypto.SecretKey;
|
---|
[1202] | 24 | import javax.crypto.spec.SecretKeySpec;
|
---|
[1200] | 25 |
|
---|
[1415] | 26 | import org.expeditee.core.Point;
|
---|
[1389] | 27 | import org.expeditee.encryption.CryptographyConstants;
|
---|
[1408] | 28 | import org.expeditee.encryption.items.surrogates.EncryptionDetail;
|
---|
[1409] | 29 | import org.expeditee.encryption.items.surrogates.Label;
|
---|
[1501] | 30 | import org.expeditee.encryption.items.surrogates.Label.LabelInfo;
|
---|
[1431] | 31 | //import org.expeditee.encryption.items.surrogates.Label;
|
---|
[1409] | 32 | import org.expeditee.encryption.items.surrogates.Label.LabelResult;
|
---|
[1200] | 33 | import org.expeditee.gui.Frame;
|
---|
[1408] | 34 | import org.expeditee.gui.FrameIO;
|
---|
| 35 | import org.expeditee.io.Conversion;
|
---|
[1414] | 36 | import org.expeditee.io.DefaultFrameWriter;
|
---|
[1200] | 37 | import org.expeditee.io.ExpReader;
|
---|
[1415] | 38 | import org.expeditee.items.Constraint;
|
---|
[1400] | 39 | import org.expeditee.items.Item;
|
---|
[1202] | 40 | import org.expeditee.items.Text;
|
---|
[1243] | 41 | import org.expeditee.settings.identity.secrets.KeyList;
|
---|
[1200] | 42 |
|
---|
| 43 | public class EncryptedExpReader extends ExpReader implements CryptographyConstants {
|
---|
[1413] | 44 |
|
---|
[1408] | 45 | private static final String ENCRYPTED_EXP_FLAG = "EncryptedExp";
|
---|
| 46 | private static final String labelProfile = "Profile";
|
---|
| 47 | private static final String labelNone = "None";
|
---|
[1461] | 48 | private SecretKey key;
|
---|
[1202] | 49 | private boolean accessDenied = false;
|
---|
[1415] | 50 | private boolean _readingSurrogates;
|
---|
| 51 | private static final Predicate<String> endOfSection = s -> s.equals(EncryptedExpWriter.TERMINATOR + "") || s.equals(EncryptedExpWriter.TERMINATOR_WITH_CONTINUATION);
|
---|
[1227] | 52 |
|
---|
[1200] | 53 | public static boolean isEncryptedExpediteeFile(final String path) throws IOException {
|
---|
[1415] | 54 | BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(path), "UTF-8"));
|
---|
| 55 | String firstLine = in.readLine();
|
---|
[1200] | 56 | in.close();
|
---|
[1415] | 57 | if (firstLine == null) return false;
|
---|
[1200] | 58 | return firstLine.startsWith(ENCRYPTED_EXP_FLAG);
|
---|
| 59 | }
|
---|
| 60 |
|
---|
[1461] | 61 | public static boolean isAccessibleExpediteeFile(final String path) throws IOException {
|
---|
| 62 | BufferedReader in = new BufferedReader(new FileReader(path));
|
---|
| 63 | String firstLine = in.readLine();
|
---|
| 64 | in.close();
|
---|
| 65 | if (firstLine == null) return false;
|
---|
| 66 |
|
---|
| 67 | if (firstLine.startsWith(ENCRYPTED_EXP_FLAG)) {
|
---|
| 68 | String labelName = firstLine.replace(ENCRYPTED_EXP_FLAG, "");
|
---|
| 69 | LabelInfo label = Label.getLabel(labelName);
|
---|
| 70 | if (labelName.equals(labelProfile) || labelName.equals(labelNone) || label.type == Label.LabelResult.SuccessResolveLabelToKey) {
|
---|
| 71 | return true;
|
---|
| 72 | } else {
|
---|
| 73 | return false;
|
---|
| 74 | }
|
---|
| 75 | } else {
|
---|
| 76 | // Not encrypted.
|
---|
| 77 | return true;
|
---|
| 78 | }
|
---|
[1500] | 79 | }
|
---|
| 80 |
|
---|
| 81 | public static boolean isAccessibleExpediteeFile(String path, SecretKey key) throws IOException {
|
---|
| 82 | try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(path), "UTF-8"))) {
|
---|
| 83 | String firstLine = in.readLine();
|
---|
| 84 | if (firstLine == null) return false;
|
---|
| 85 |
|
---|
| 86 | if (firstLine.startsWith(ENCRYPTED_EXP_FLAG)) {
|
---|
| 87 | String secondLine = in.readLine();
|
---|
| 88 | byte[] toDecrypt = Base64.getDecoder().decode(secondLine);
|
---|
| 89 | byte[] decrypted = DecryptSymmetric(toDecrypt, key);
|
---|
| 90 | return decrypted != null;
|
---|
| 91 | } else {
|
---|
| 92 | // Not encrypted. Returns false because the caller of this
|
---|
| 93 | // function is asking if this key is used to decrypt this file.
|
---|
| 94 | return false;
|
---|
| 95 | }
|
---|
| 96 | }
|
---|
[1461] | 97 | }
|
---|
| 98 |
|
---|
[1413] | 99 | public EncryptedExpReader(String frameName) {
|
---|
| 100 | super(frameName);
|
---|
| 101 | }
|
---|
| 102 |
|
---|
[1202] | 103 | public int getVersionEnc(String fullpath) {
|
---|
| 104 | try {
|
---|
[1227] | 105 | BufferedReader reader = new EncryptedLineReader(new BufferedReader(new FileReader(fullpath)));
|
---|
[1202] | 106 | String next = "";
|
---|
| 107 | // First read the header lines until we get the version number
|
---|
| 108 | while (reader.ready() && !(next = reader.readLine()).equals("Z")) {
|
---|
| 109 | if (isValidLine(next)) {
|
---|
| 110 | Character tag = getTag(next);
|
---|
| 111 | String value = getValue(next);
|
---|
| 112 | if (tag.equals('V')) {
|
---|
| 113 | reader.close();
|
---|
| 114 | return Integer.parseInt(value);
|
---|
| 115 | }
|
---|
| 116 | }
|
---|
| 117 | }
|
---|
| 118 | reader.close();
|
---|
| 119 | } catch (Exception e) {
|
---|
| 120 | }
|
---|
| 121 | return -1;
|
---|
| 122 | }
|
---|
| 123 |
|
---|
[1200] | 124 | @Override
|
---|
| 125 | public Frame readFrame(final String fullPath) throws IOException {
|
---|
[1227] | 126 | Reader in = new InputStreamReader(new FileInputStream(fullPath), "UTF-8");
|
---|
| 127 | return readFrame(new EncryptedLineReader(in));
|
---|
[1200] | 128 | }
|
---|
| 129 |
|
---|
[1202] | 130 | @Override
|
---|
[1408] | 131 | public Frame readFrame(BufferedReader reader) throws IOException {
|
---|
[1202] | 132 | if (accessDenied) { return null; }
|
---|
[1408] | 133 |
|
---|
[1415] | 134 | _readingSurrogates = false;
|
---|
[1408] | 135 | _reader = reader;
|
---|
| 136 | String next = "";
|
---|
| 137 | Frame newFrame = new Frame();
|
---|
| 138 | List<DelayedAction> delayedActions = new ArrayList<DelayedAction>();
|
---|
| 139 | newFrame.setName(_frameName);
|
---|
| 140 |
|
---|
| 141 | try {
|
---|
| 142 | // First read all the header lines
|
---|
| 143 | next = readTheHeader(newFrame);
|
---|
| 144 |
|
---|
| 145 | // Now read all the items
|
---|
| 146 | next = readTheItems(newFrame, delayedActions);
|
---|
| 147 |
|
---|
| 148 | // Read the lines
|
---|
| 149 | next = readTheLines(newFrame);
|
---|
| 150 |
|
---|
| 151 | // Read the constraints
|
---|
| 152 | next = readTheConstraints();
|
---|
| 153 |
|
---|
[1415] | 154 | if (next.equals(EncryptedExpWriter.TERMINATOR_WITH_CONTINUATION)) {
|
---|
| 155 | // Read the surrogates
|
---|
| 156 | _readingSurrogates = true;
|
---|
| 157 | next = readTheItems(newFrame, delayedActions);
|
---|
| 158 | _readingSurrogates = false;
|
---|
| 159 | }
|
---|
| 160 |
|
---|
[1408] | 161 | for(DelayedAction action: delayedActions) {
|
---|
| 162 | action.exec();
|
---|
| 163 | }
|
---|
| 164 |
|
---|
| 165 | // Read the stats
|
---|
| 166 | next = readTheStats(newFrame);
|
---|
| 167 | } catch (Exception e) {
|
---|
| 168 | e.printStackTrace();
|
---|
| 169 | System.out.println("Error reading frame file line: " + next + " " + e.getMessage());
|
---|
[1400] | 170 | }
|
---|
[1408] | 171 |
|
---|
| 172 | _reader.close();
|
---|
| 173 | FrameIO.setSavedProperties(newFrame);
|
---|
| 174 | newFrame.setChanged(false);
|
---|
| 175 |
|
---|
| 176 | return newFrame;
|
---|
[1200] | 177 | }
|
---|
| 178 |
|
---|
[1408] | 179 | protected String readTheItems(Frame newFrame, List<DelayedAction> delayedActions) throws IOException {
|
---|
[1415] | 180 | BiConsumer<Item, String> primaryAdd = (item, line) -> newFrame.addItem(item);
|
---|
| 181 | BiConsumer<Item, String> surrogateAdd = (item, line) -> {
|
---|
| 182 | int parentID = Integer.parseInt(line.split(" ")[1]);
|
---|
| 183 | Item parent = newFrame.getItemWithID(parentID);
|
---|
| 184 | newFrame.addToSurrogatesOnLoad(item, parent);
|
---|
| 185 | };
|
---|
[1414] | 186 |
|
---|
[1415] | 187 | if (_readingSurrogates) {
|
---|
| 188 | return readLineAfterLine(true, surrogateAdd, delayedActions);
|
---|
| 189 | } else {
|
---|
| 190 | return readLineAfterLine(false, primaryAdd, delayedActions);
|
---|
[1414] | 191 | }
|
---|
[1415] | 192 | }
|
---|
| 193 |
|
---|
| 194 | @Override
|
---|
| 195 | protected String readTheConstraints() throws IOException, Exception {
|
---|
| 196 | String next = null;
|
---|
| 197 | while (_reader.ready() && !endOfSection.test(next = _reader.readLine())) {
|
---|
| 198 | if (isValidLine(next)) {
|
---|
| 199 | Point idtype = separateValues(next.substring(2));
|
---|
| 200 | // The next line must be the endpoints
|
---|
| 201 | if (!_reader.ready()) {
|
---|
| 202 | throw new Exception("Unexpected end of file");
|
---|
| 203 | }
|
---|
| 204 | next = _reader.readLine();
|
---|
| 205 | Point startend = separateValues(next.substring(2));
|
---|
| 206 |
|
---|
| 207 | Item a = _linePoints.get(startend.getX());
|
---|
| 208 | Item b = _linePoints.get(startend.getY());
|
---|
| 209 |
|
---|
| 210 | new Constraint(a, b, idtype.getX(), idtype.getY());
|
---|
| 211 | }
|
---|
| 212 | }
|
---|
[1414] | 213 | return next;
|
---|
| 214 | }
|
---|
| 215 |
|
---|
| 216 | private String readLineAfterLine(boolean isSurrogate, BiConsumer<Item, String> storeResult, List<DelayedAction> delayedActions) throws IOException {
|
---|
[1408] | 217 | String next = null;
|
---|
| 218 | Item currentItem = null;
|
---|
[1400] | 219 |
|
---|
[1408] | 220 | while (_reader.ready() && !endOfSection.test(next = _reader.readLine())) {
|
---|
| 221 | if (!isValidLine(next)) {
|
---|
| 222 | continue;
|
---|
| 223 | }
|
---|
[1413] | 224 |
|
---|
[1408] | 225 | String tag = getTagEnc(next);
|
---|
[1414] | 226 | if (next.startsWith(DefaultFrameWriter.TYPE_AND_ID_STR + " ")) {
|
---|
[1408] | 227 | currentItem = newItem(next);
|
---|
| 228 | _linePoints.put(currentItem.getID(), currentItem);
|
---|
[1414] | 229 | if (!isSurrogate) {
|
---|
| 230 | storeResult.accept(currentItem, next);
|
---|
| 231 | }
|
---|
[1415] | 232 | EncryptionDetail unencryptedOnSave = new EncryptionDetail(EncryptionDetail.Type.UnencryptedOnSave);
|
---|
| 233 | currentItem.setEncryptionDetailForTag(tag + "", unencryptedOnSave);
|
---|
[1413] | 234 | } else if (next.startsWith("SurrogateFor")) {
|
---|
[1414] | 235 | if (isSurrogate) {
|
---|
| 236 | storeResult.accept(currentItem, next);
|
---|
| 237 | }
|
---|
[1408] | 238 | } else if (currentItem != null && actionShouldBeDelayed(tag.charAt(0))) {
|
---|
| 239 | delayedActions.add(new DelayedAction(currentItem, next));
|
---|
| 240 | } else if (currentItem != null) {
|
---|
| 241 | processBodyLine(currentItem, next);
|
---|
| 242 | } else {
|
---|
| 243 | System.err.println("Error while reading in frame (ExpReader): Found body line but no current item to apply it to.");
|
---|
| 244 | }
|
---|
| 245 | }
|
---|
| 246 |
|
---|
| 247 | return next;
|
---|
| 248 | }
|
---|
[1414] | 249 |
|
---|
[1408] | 250 | @Override
|
---|
| 251 | protected void processBodyLine(Item item, String line) {
|
---|
| 252 | // separate the tag from the value
|
---|
| 253 | String tag = getTagEnc(line);
|
---|
| 254 | String value = getValue(line);
|
---|
[1415] | 255 | boolean isEncryptedLine = isEncryptedLine(line);
|
---|
[1408] | 256 |
|
---|
[1415] | 257 | if (item.isSurrogate() && isEncryptedLine) {
|
---|
| 258 | // Surrogates should never have encrypted body lines.
|
---|
[1413] | 259 | return;
|
---|
| 260 | }
|
---|
| 261 |
|
---|
[1408] | 262 | // Attempt to decrypt the line if necessary.
|
---|
[1415] | 263 | if (isEncryptedLine) {
|
---|
[1431] | 264 | LabelInfo res = Label.getLabel(item.getEncryptionLabel());
|
---|
| 265 | if (res.is(LabelResult.SuccessResolveLabelToKey)) {
|
---|
[1415] | 266 | EncryptionDetail reencryptOnSave = new EncryptionDetail(EncryptionDetail.Type.ReencryptOnSave);
|
---|
| 267 | item.setEncryptionDetailForTag(tag, reencryptOnSave);
|
---|
[1408] | 268 | SecretKey key = new SecretKeySpec(res.key, SymmetricAlgorithm);
|
---|
| 269 | byte[] decryptedBytes = DecryptSymmetric(Base64.getDecoder().decode(value), key);
|
---|
| 270 | value = new String(decryptedBytes);
|
---|
| 271 | } else {
|
---|
[1415] | 272 | EncryptionDetail undecipheredValueOnSave = new EncryptionDetail(EncryptionDetail.Type.UseUndecipheredValueOnSave);
|
---|
| 273 | undecipheredValueOnSave.setUndecipheredValue(getValue(line));
|
---|
| 274 | item.setEncryptionDetailForTag(tag, undecipheredValueOnSave);
|
---|
[1408] | 275 | return;
|
---|
| 276 | }
|
---|
| 277 | } else {
|
---|
[1415] | 278 | EncryptionDetail unencryptedOnSave = new EncryptionDetail(EncryptionDetail.Type.UnencryptedOnSave);
|
---|
| 279 | item.setEncryptionDetailForTag(tag, unencryptedOnSave);
|
---|
| 280 | if (item.isSurrogate()) {
|
---|
| 281 | item.setTagNotInherited(tag);
|
---|
| 282 | }
|
---|
[1408] | 283 | }
|
---|
| 284 |
|
---|
| 285 | // Process the line
|
---|
| 286 | Method toRun = tag.startsWith("_") ? _ItemTagsExt.get(tag) : _ItemTags.get(tag.charAt(0));
|
---|
| 287 | if (toRun == null) {
|
---|
| 288 | System.out.println("Error accessing tag method: " + tag);
|
---|
| 289 | }
|
---|
| 290 | Object[] vals = Conversion.Convert(toRun, value);
|
---|
| 291 | try {
|
---|
| 292 | if (vals != null) {
|
---|
| 293 | toRun.invoke(item, vals);
|
---|
| 294 | }
|
---|
| 295 | } catch (Exception e) {
|
---|
| 296 | System.out.println("Error running tag method: " + tag);
|
---|
| 297 | e.printStackTrace();
|
---|
| 298 | }
|
---|
| 299 | }
|
---|
[1413] | 300 |
|
---|
| 301 | protected static String getValue(String line) {
|
---|
| 302 | String[] split = line.split(" ");
|
---|
| 303 | if (split.length >= 2) {
|
---|
| 304 | return line.substring(split[0].length()).trim();
|
---|
| 305 | } else {
|
---|
| 306 | return null;
|
---|
[1400] | 307 | }
|
---|
| 308 | }
|
---|
| 309 |
|
---|
[1413] | 310 | private static String getTagEnc(String line) {
|
---|
[1408] | 311 | char charAtZero = line.charAt(0);
|
---|
| 312 | if (charAtZero == '_') {
|
---|
| 313 | return line.split(" ")[0];
|
---|
| 314 | } else {
|
---|
| 315 | return charAtZero + "";
|
---|
| 316 | }
|
---|
| 317 | }
|
---|
[1413] | 318 |
|
---|
| 319 | private static boolean isEncryptedLine(String line) {
|
---|
[1408] | 320 | if (line.startsWith("S") || line.startsWith("_el")) {
|
---|
| 321 | return false;
|
---|
| 322 | }
|
---|
| 323 | if (line.length() > 2) {
|
---|
| 324 | return line.charAt(1) == 'E';
|
---|
| 325 | } else {
|
---|
| 326 | return false;
|
---|
| 327 | }
|
---|
| 328 | }
|
---|
| 329 |
|
---|
[1200] | 330 | private static byte[] DecryptSymmetric(final byte[] toDecrypt, final SecretKey key) {
|
---|
| 331 | try {
|
---|
| 332 | final Cipher cipher = Cipher.getInstance(SymmetricAlgorithm + SymmetricAlgorithmParameters);
|
---|
| 333 | cipher.init(Cipher.DECRYPT_MODE, key);
|
---|
| 334 | final byte[] decryptedBytes = cipher.doFinal(toDecrypt);
|
---|
| 335 | int indexOfZero = decryptedBytes.length - 1;
|
---|
| 336 | for (int i = decryptedBytes.length - 1; i >= 0; i--) {
|
---|
| 337 | if (decryptedBytes[i] != (byte) 0) {
|
---|
| 338 | indexOfZero = i + 1;
|
---|
| 339 | break;
|
---|
| 340 | }
|
---|
| 341 | }
|
---|
| 342 | if (indexOfZero < 0) { return decryptedBytes; }
|
---|
| 343 | else { return Arrays.copyOf(decryptedBytes, indexOfZero); }
|
---|
| 344 | } catch (final NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException
|
---|
| 345 | | IllegalBlockSizeException | BadPaddingException e) {
|
---|
[1500] | 346 | //e.printStackTrace();
|
---|
| 347 | System.err.println("Failed to decrypt '" + new String(toDecrypt) + "' with key " + new String(key.getEncoded()));
|
---|
[1200] | 348 | return null;
|
---|
| 349 | }
|
---|
| 350 | }
|
---|
[1413] | 351 |
|
---|
[1227] | 352 | private class EncryptedLineReader extends BufferedReader {
|
---|
[1408] | 353 | private boolean noneMode = false;
|
---|
| 354 |
|
---|
[1227] | 355 | public EncryptedLineReader(Reader in) {
|
---|
[1202] | 356 | super(in);
|
---|
| 357 | }
|
---|
[1500] | 358 |
|
---|
[1202] | 359 | @Override
|
---|
| 360 | /**
|
---|
[1227] | 361 | * Reads a line from an encrypted exp file that uses an encryption specified by the first line of the file.
|
---|
| 362 | * Returns that line to process, null if the currently logged in users doesn't own the appropriate key (access denied).
|
---|
[1202] | 363 | */
|
---|
| 364 | public String readLine() throws IOException {
|
---|
[1227] | 365 | String line = super.readLine();
|
---|
[1202] | 366 |
|
---|
[1227] | 367 | if (line.isEmpty()) {
|
---|
| 368 | return "";
|
---|
| 369 | }
|
---|
[1408] | 370 |
|
---|
| 371 | if (noneMode) {
|
---|
| 372 | return line;
|
---|
| 373 | }
|
---|
| 374 |
|
---|
[1202] | 375 | if (line.startsWith(ENCRYPTED_EXP_FLAG)) {
|
---|
[1227] | 376 | String label = line.replace(ENCRYPTED_EXP_FLAG, "");
|
---|
| 377 | // if using Profile label, use personal key
|
---|
[1408] | 378 | if (label.equals(labelProfile)) {
|
---|
[1227] | 379 | Text text = KeyList.PersonalKey.get();
|
---|
| 380 | byte[] keyBytes = Base64.getDecoder().decode(text.getData().get(0));
|
---|
[1461] | 381 | key = new SecretKeySpec(keyBytes, SymmetricAlgorithm);
|
---|
[1227] | 382 | return readLine();
|
---|
[1408] | 383 | } else if (label.equals(labelNone)) {
|
---|
| 384 | noneMode = true;
|
---|
| 385 | return readLine();
|
---|
[1227] | 386 | } else {
|
---|
[1461] | 387 | key = resolveLabel(label);
|
---|
| 388 | if (key == null) {
|
---|
[1323] | 389 | return null;
|
---|
| 390 | } else {
|
---|
| 391 | return readLine();
|
---|
| 392 | }
|
---|
[1227] | 393 | }
|
---|
[1202] | 394 | }
|
---|
| 395 |
|
---|
| 396 | // decrypt line and return result
|
---|
[1227] | 397 | byte[] toDecrypt = Base64.getDecoder().decode(line);
|
---|
[1461] | 398 | byte[] decrypted = DecryptSymmetric(toDecrypt, key);
|
---|
[1202] | 399 | if (decrypted == null) {
|
---|
| 400 | accessDenied = true;
|
---|
| 401 | return null; // access denied
|
---|
| 402 | } else {
|
---|
[1227] | 403 | String decryptedLine = new String(decrypted);
|
---|
| 404 | if (decryptedLine.startsWith("Z")) {
|
---|
| 405 | return decryptedLine.trim();
|
---|
| 406 | } else {
|
---|
| 407 | return decryptedLine;
|
---|
| 408 | }
|
---|
[1202] | 409 | }
|
---|
| 410 | }
|
---|
| 411 |
|
---|
[1227] | 412 | private SecretKeySpec resolveLabel(String label) {
|
---|
[1431] | 413 | LabelInfo res = Label.getLabel(label);
|
---|
| 414 | if (res.is(LabelResult.SuccessResolveLabelToKey)) {
|
---|
[1401] | 415 | byte[] keyBytes = res.key;
|
---|
| 416 | return new SecretKeySpec(keyBytes, SymmetricAlgorithm);
|
---|
| 417 | }
|
---|
| 418 | return null;
|
---|
[1202] | 419 | }
|
---|
| 420 | }
|
---|
[1200] | 421 | }
|
---|