Browse Source

Fixed pastes erroring out if there is no IV/Key

master
Teknikode 10 months ago
parent
commit
73e5e084a5
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      Teknik/Areas/Paste/Controllers/PasteController.cs

+ 2
- 2
Teknik/Areas/Paste/Controllers/PasteController.cs View File

@@ -76,8 +76,8 @@ namespace Teknik.Areas.Paste.Controllers
}
}

byte[] ivBytes = Encoding.Unicode.GetBytes(paste.IV);
byte[] keyBytes = AesCounterManaged.CreateKey(paste.Key, ivBytes, paste.KeySize);
byte[] ivBytes = (string.IsNullOrEmpty(paste.IV)) ? new byte[paste.BlockSize] : Encoding.Unicode.GetBytes(paste.IV);
byte[] keyBytes = (string.IsNullOrEmpty(paste.Key)) ? new byte[paste.KeySize] : AesCounterManaged.CreateKey(paste.Key, ivBytes, paste.KeySize);

// The paste has a password set
if (!string.IsNullOrEmpty(paste.HashedPassword))

Loading…
Cancel
Save