eGospodarka.pl
eGospodarka.pl poleca

eGospodarka.plGrupypl.comp.programmingZaszyfrowane CAPICOMem, jak odszyfrować CryptoAPI? › Re: Zaszyfrowane CAPICOMem, jak odszyfrować CryptoAPI?
  • Path: news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!new
    sfeed.neostrada.pl!atlantis.news.neostrada.pl!news.neostrada.pl!not-for-mail
    From: Real Hacker <r...@m...com>
    Newsgroups: pl.comp.programming
    Subject: Re: Zaszyfrowane CAPICOMem, jak odszyfrować CryptoAPI?
    Date: Thu, 10 Sep 2009 22:13:35 +0200
    Organization: TP - http://www.tp.pl/
    Lines: 86
    Message-ID: <h8bmpq$fu4$3@atlantis.news.neostrada.pl>
    References: <h85ihs$1tj4$1@news2.ipartners.pl>
    NNTP-Posting-Host: 80.50.128.222
    Mime-Version: 1.0
    Content-Type: text/plain; charset=ISO-8859-2; format=flowed
    Content-Transfer-Encoding: 8bit
    X-Trace: atlantis.news.neostrada.pl 1252613754 16324 80.50.128.222 (10 Sep 2009
    20:15:54 GMT)
    X-Complaints-To: u...@n...neostrada.pl
    NNTP-Posting-Date: Thu, 10 Sep 2009 20:15:54 +0000 (UTC)
    User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
    In-Reply-To: <h85ihs$1tj4$1@news2.ipartners.pl>
    X-Antivirus: avast! (VPS 090910-0, 2009-09-10), Outbound message
    X-Antivirus-Status: Clean
    Xref: news-archive.icm.edu.pl pl.comp.programming:183473
    [ ukryj 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: