eGospodarka.pl
eGospodarka.pl poleca

eGospodarka.plGrupypl.comp.programmingZaszyfrowane CAPICOMem, jak odszyfrować CryptoAPI?Re: Zaszyfrowane CAPICOMem, jak odszyfrować CryptoAPI?
  • Data: 2009-09-10 20:13:35
    Temat: Re: Zaszyfrowane CAPICOMem, jak odszyfrować CryptoAPI?
    Od: Real Hacker <r...@m...com> szukaj wiadomości tego autora
    [ pokaż wszystkie nagłówki ]

    gosmo pisze:
    > Witam, mam zaszyfrowane dane poniższym kodem:
    > EncryptedData := CreateOleObject('CAPICOM.EncryptedData');
    > try
    > EncryptedData.Algorithm.KeyLength :=
    > CAPICOM_ENCRYPTION_KEY_LENGTH_40_BITS;
    > EncryptedData.Algorithm.Name := CAPICOM_ENCRYPTION_ALGORITHM_3DES;
    > EncryptedData.Content := AString;
    > EncryptedData.SetSecret(ASecret);
    > Result := EncryptedData.Encrypt;
    > finally
    > EncryptedData := Null;
    > end;
    >
    > Aby odszyfrować to za pomocą CryptoAPI wykombinowałem takiego potworka:
    >
    > function DecodeWC(AString: WideString; ASecret: WideString = ''):
    > WideString;
    > var
    > hProv : Cardinal;
    > hHash : Cardinal;
    > hKey : Cardinal;
    > dwBlobLen : Cardinal;
    > pBuffer : PByte;
    > begin
    > if (not CryptAcquireContext(hProv, Nil, NIL, PROV_RSA_FULL,
    > CRYPT_VERIFYCONTEXT)) and (not CryptAcquireContext(hProv, Nil, Nil,
    > PROV_RSA_FULL, CRYPT_VERIFYCONTEXT OR CRYPT_NEWKEYSET)) then
    > RaiseLastOSError
    > else
    > try
    > if not CryptCreateHash(hProv, CALG_MD5, 0, 0, hHash) then
    > RaiseLastOSError
    > else
    > try
    > if not CryptHashData(hHash, PByte(@ASecret[1]), Length(ASecret) * 2,
    > 0) then RaiseLastOSError;
    > if not CryptDeriveKey(hProv, CALG_3DES, hHash, 0, hKey) then
    > RaiseLastOSError
    > else
    > try
    >
    > dwBlobLen := Length(AString) * 2;
    > pBuffer := PByte(@AString[1]);
    > if not CryptDecrypt(hKey, 0, True, 0, pBuffer, dwBlobLen) then
    > RaiseLastOSError;
    > finally
    > CryptDestroyKey(hKey);
    > end;
    > finally
    > CryptDestroyHash(hHash);
    > end;
    > finally
    > CryptReleaseContext(hProv, 0);
    > end;
    > end;
    >
    > Ale mimo, że używałem chyba wszystkich możliwych algorytmów hashujących to
    > nadal dostaję komunikat złych danych przy CryptDecrypt.
    > Jak odszyftować te dane za pomocą CryptoAPI?
    >
    >
    >
    >
    >
    > ---
    > avast! antywirus: Przychodzace wiadomosc czysta.
    > Baza sygnatur wirusow (VPS): 090910-0, 2009-09-10
    > Przetestowano na: 2009-09-10 22:13:16
    > avast! - copyright (c) 1988-2009 ALWIL Software.
    > http://www.avast.com
    >
    >
    >
    Zaszyfruj sobie mózg, AES-em 256.


    ---
    avast! antywirus: Wychodzace wiadomosc czysta.
    Baza sygnatur wirusow (VPS): 090910-0, 2009-09-10
    Przetestowano na: 2009-09-10 22:13:36
    avast! - copyright (c) 1988-2009 ALWIL Software.
    http://www.avast.com



Podziel się

Poleć ten post znajomemu poleć

Wydrukuj ten post drukuj

Najnowsze wątki z tej grupy


Najnowsze wątki

Szukaj w grupach

Eksperci egospodarka.pl

1 1 1

Wpisz nazwę miasta, dla którego chcesz znaleźć jednostkę ZUS.

Wzory dokumentów

Bezpłatne wzory dokumentów i formularzy.
Wyszukaj i pobierz za darmo: