Fórum Criptografia em .NET #66544
06/05/2008
0
Gandalf.nho
Curtir tópico
+ 0Posts
08/05/2008
Gandalf.nho
O componente é esse aqui: http://www.devpower.com/encrypt.net/home.aspx
Gostei + 0
08/05/2008
Massuda
:arrow: [url=http://msdn.microsoft.com/en-us/library/system.security.cryptography.aspx]system.security.cryptography[/url]
Um exemplo de uso em C#...
:arrow: [url=http://www.codeproject.com/KB/security/encryption_decryption.aspx]Encryption/Decryption with .NET[/url]
Gostei + 0
08/05/2008
Gandalf.nho
Gostei + 0
09/05/2008
Gandalf.nho
Trecho original em C
private byte[] GetLegalKey(string Key)
{
string sTemp;
if (mobjCryptoService.LegalKeySizes.Length > 0)
{
int lessSize = 0, moreSize = mobjCryptoService.LegalKeySizes[0].MinSize;
// key sizes are in bits
while (Key.Length * 8 > moreSize)
{
lessSize = moreSize;
moreSize += mobjCryptoService.LegalKeySizes[0].SkipSize;
}
sTemp = Key.PadRight(moreSize / 8, ´ ´);
}
else
sTemp = Key;
// convert the secret key to byte array
return ASCIIEncoding.ASCII.GetBytes(sTemp);
}Convertido pela ferramenta:
function SymmCrypto.GetLegalKey(Key: string): TArrayOfByte; var moreSize: Integer; lessSize: Integer; sTemp: string; begin if (Self.mobjCryptoService.LegalKeySizes.Length > 0) then begin lessSize := 0; moreSize := Self.mobjCryptoService.LegalKeySizes[0].MinSize; while (Key.Length * (8 > moreSize)) do begin Self.lessSize := moreSize; end; sTemp := Key.PadRight((moreSize / 8), ´ ´); end else sTemp := Key; Result := ASCIIEncoding.ASCII.GetBytes(sTemp); end;
Estão aparecendo 2 erros na hora de compilar. Nessa linha:
if (Self.mobjCryptoService.LegalKeySizes.Length > 0) then
acusa ´Record ou classe type required´
e nessa aqui:
while (Key.Length * (8 > moreSize)) do
acusa ´Operator not applicable to this operand type´
Eu preciso resolver esse problema da criptografia. Será que ninguém aqui já trabalhou com isso em Delphi .NET?
Gostei + 0
09/05/2008
Massuda
if (Self.mobjCryptoService.LegalKeySizes.Length > 0) then
Talvez isso funcione...
if (Length(Self.mobjCryptoService.LegalKeySizes) > 0) then
while (Key.Length * (8 > moreSize)) do
Acho que o correto seria...
while (Key.Length * 8 > moreSize) do
Gostei + 0
10/05/2008
Gandalf.nho
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)