fix bugs
This commit is contained in:
		@@ -16,7 +16,7 @@ namespace LibTSforge.Crypto
 | 
				
			|||||||
            byte[] aesKeySig = br.ReadBytes(0x80);
 | 
					            byte[] aesKeySig = br.ReadBytes(0x80);
 | 
				
			||||||
            byte[] encAesKey = br.ReadBytes(0x80);
 | 
					            byte[] encAesKey = br.ReadBytes(0x80);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (CryptoUtils.RSAVerifySignature(rsaKey, encAesKey, aesKeySig))
 | 
					            if (!CryptoUtils.RSAVerifySignature(rsaKey, encAesKey, aesKeySig))
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                throw new Exception("Failed to decrypt physical store.");
 | 
					                throw new Exception("Failed to decrypt physical store.");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -141,9 +141,9 @@ namespace LibTSforge.TokenStore
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                        writer.BaseStream.Seek(curBlockOffset, SeekOrigin.Begin);
 | 
					                        writer.BaseStream.Seek(curBlockOffset, SeekOrigin.Begin);
 | 
				
			||||||
                        byte[] blockData = new byte[BLOCK_SIZE - 0x20];
 | 
					                        byte[] blockData = new byte[BLOCK_SIZE - 0x20];
 | 
				
			||||||
                        byte[] blockHash = CryptoUtils.SHA256Hash(blockData);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        tokens.Read(blockData, 0, BLOCK_SIZE - 0x20);
 | 
					                        tokens.Read(blockData, 0, BLOCK_SIZE - 0x20);
 | 
				
			||||||
 | 
					                        byte[] blockHash = CryptoUtils.SHA256Hash(blockData);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        writer.BaseStream.Seek(curBlockOffset + BLOCK_SIZE - 0x20, SeekOrigin.Begin);
 | 
					                        writer.BaseStream.Seek(curBlockOffset + BLOCK_SIZE - 0x20, SeekOrigin.Begin);
 | 
				
			||||||
                        writer.Write(blockHash);
 | 
					                        writer.Write(blockHash);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user