@@ -25,8 +25,6 @@ class CryptoSession {
2525 private OutputStream realOS ;
2626 private ByteArrayOutputStream asapMessageOS ;
2727 private byte [] asapMessageAsBytes ;
28- private ByteArrayOutputStream senderSiteTest ;
29- private byte [] byte2Send ;
3028
3129 CryptoSession (ASAPReadonlyKeyStorage keyStorage ) {
3230 this .keyStorage = keyStorage ;
@@ -48,8 +46,7 @@ private InputStream decrypt(InputStream is, PrivateKey privateKey) throws ASAPSe
4846 // read encrypted bytes from stream
4947 is .read (messageBytes );
5048
51- Utils .compareArrays (messageBytes , this .byte2Send );
52-
49+ // debugging
5350 // decrypt
5451 byte [] decryptedBytes = this .cipher .doFinal (messageBytes );
5552 return new ByteArrayInputStream (decryptedBytes );
@@ -159,28 +156,32 @@ OutputStream getOutputStream() {
159156
160157 public void finish () throws ASAPSecurityException {
161158 if (cipher != null ) {
162- // we are to encrypt
159+ // that is our asap message in clear text
163160 this .asapMessageAsBytes = this .asapMessageOS .toByteArray ();
164161 try {
162+ // encrypted asap message
165163 byte [] encryptedBytes = this .cipher .doFinal (this .asapMessageAsBytes );
166- // write data len
164+ //this.debuggingRememberEncryptedASAPMessage = encryptedBytes;
167165
168166 // write len
169167 PDU_Impl .sendNonNegativeIntegerParameter (encryptedBytes .length , this .realOS );
170168 // write data
171169 this .realOS .write (encryptedBytes );
172170
173- // debug - decrypt
171+ /*
172+ // debugging - decrypt
174173
175174 // make a test
176- this . senderSiteTest = new ByteArrayOutputStream ();
175+ ByteArrayOutputStream senderSiteTest = new ByteArrayOutputStream();
177176 PDU_Impl.sendNonNegativeIntegerParameter(encryptedBytes.length, senderSiteTest);
178177 senderSiteTest.write(encryptedBytes);
178+
179+ this.debuggingEncryptedASAPMessageWithLen = senderSiteTest.toByteArray();
180+
179181 PrivateKey privateKey = this.keyStorage.getPrivateKey(this.recipient);
180- this .byte2Send = encryptedBytes ;
181- ByteArrayInputStream decrypt = (ByteArrayInputStream ) this .decrypt (new ByteArrayInputStream (senderSiteTest . toByteArray () ), privateKey );
182+ // ByteArrayInputStream decrypt = (ByteArrayInputStream) this.decrypt(new ByteArrayInputStream(senderSiteTest.toByteArray()), privateKey) ;
183+ ByteArrayInputStream decrypt = (ByteArrayInputStream) this.decrypt(new ByteArrayInputStream(this.debuggingEncryptedASAPMessageWithLen ), privateKey);
182184 int i = 42;
183- /*
184185 */
185186 } catch (IllegalBlockSizeException | BadPaddingException | IOException e ) {
186187 throw new ASAPSecurityException (this .getLogStart (), e );
0 commit comments