S
Scooter
I have been tasked with writing a small java class that will decrypt a
string that was encrypted with a C# app. I have the source for the C#
decryption, its nothing special. I just dont know what the
counterparts are in java.
Heres the C# code. "m_objDecrypt" is a "ICryptoTransform"
protected internal string DecryptValue(string EncryptedValue)
{
byte[] buffer;
if (EncryptedValue.Length >= 0x800)
{
throw new ValueException();
}
try
{
byte[] inputBuffer = Convert.FromBase64String(EncryptedValue);
buffer = this.m_objDecrypt.TransformFinalBlock(inputBuffer, 0,
inputBuffer.Length);
}
catch (FormatException)
{
throw new ValueException();
}
catch (CryptographicException)
{
throw new ValueException();
}
return new ASCIIEncoding().GetString(buffer);
}
--------------------------
in my java class so far I have:
byte[] buffer;
if (EncryptedValue.length() >= 0x800) {
}
try
{
byte[]inputBuffer=new sun.misc.BASE64Decoder().decodeBuffer
(EncryptedValue);
//buffer=
}
catch (Exception e)
{
}
I just have no idea about converting that whole "TransformFinalBlock"
method.
Any suggestions are appreciated.
string that was encrypted with a C# app. I have the source for the C#
decryption, its nothing special. I just dont know what the
counterparts are in java.
Heres the C# code. "m_objDecrypt" is a "ICryptoTransform"
protected internal string DecryptValue(string EncryptedValue)
{
byte[] buffer;
if (EncryptedValue.Length >= 0x800)
{
throw new ValueException();
}
try
{
byte[] inputBuffer = Convert.FromBase64String(EncryptedValue);
buffer = this.m_objDecrypt.TransformFinalBlock(inputBuffer, 0,
inputBuffer.Length);
}
catch (FormatException)
{
throw new ValueException();
}
catch (CryptographicException)
{
throw new ValueException();
}
return new ASCIIEncoding().GetString(buffer);
}
--------------------------
in my java class so far I have:
byte[] buffer;
if (EncryptedValue.length() >= 0x800) {
}
try
{
byte[]inputBuffer=new sun.misc.BASE64Decoder().decodeBuffer
(EncryptedValue);
//buffer=
}
catch (Exception e)
{
}
I just have no idea about converting that whole "TransformFinalBlock"
method.
Any suggestions are appreciated.