You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: homeworks/02-spacescanner/README.md
+14-2Lines changed: 14 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -149,7 +149,12 @@ public interface SpaceScannerAPI {
149
149
/**
150
150
* Saves the name of the most reliable rocket in a given time period in an encrypted format.
151
151
*
152
-
* @param outputStream the output stream where the encrypted result is written into
152
+
* <p><b>Important:</b> The implementation is expected to wrap {@code outputStream} in a
153
+
* {@link javax.crypto.CipherOutputStream}. Since block ciphers (e.g. AES) write the final block
154
+
* only on {@code close()}, this method <b>must close</b> the stream after writing.
155
+
*
156
+
* @param outputStream the output stream where the encrypted result is written into;
157
+
* it will be closed by this method
153
158
* @param from the inclusive beginning of the time frame
154
159
* @param to the inclusive end of the time frame
155
160
* @throws IllegalArgumentException if outputStream, from or to is null
@@ -250,7 +255,14 @@ Reliability-то на дадена ракета ще пресмятаме по
250
255
> Пример: Ракета с 3 успешни мисии и 1 неуспешна:
251
256
> Reliability = (2*3 + 1) / (2*4) = 7/8 = 0.875
252
257
253
-
Алгоритъмът за криптиране (**AES**) има имплементация в JDK-то (в `javax.crypto` пакета) и за него сме ви дали [code snippet](https://github.com/fmi/java-course/blob/master/07-io-streams-and-files/snippets/src/bg/sofia/uni/fmi/mjt/io/CipherExample.java). Създайте клас **Rijndael**, който има следния конструктор:
258
+
Алгоритъмът за криптиране (**AES**) има имплементация в JDK-то (в `javax.crypto` пакета) и за него сме ви дали [code snippet](https://github.com/fmi/java-course/blob/master/07-io-streams-and-files/snippets/src/bg/sofia/uni/fmi/mjt/io/CipherExample.java).
259
+
260
+
:warning: Забележка:
261
+
В метода `saveMostReliableRocket(...)` се очаква използване на `CipherOutputStream`. Поради това
262
+
имплементацията трябва да затвори подадения `OutputStream`, тъй като при AES последният блок
263
+
се записва едва при `close()`.
264
+
265
+
Създайте клас **Rijndael**, който има следния конструктор:
0 commit comments