Re: [cryptopp-users] HMACs of files

2023-11-04 Thread Arik Agazarian
We Need wallet address of 7 months for clean transactions, traceable on
Blockchain,
Ratio 45%/45%/10%
Sender/Reciever/Mandate
Telegram sender: @Arik_loader


On Thu, Nov 2, 2023, 7:26 PM Catherine Issabel 
wrote:

>
> $500 million dollars available only for good and trusted receiver or
> mandate
> Kindly contact the sender for more information:+1 (336) 345-9681
>
> --
> You received this message because you are subscribed to the Google Groups
> "Crypto++ Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cryptopp-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/cryptopp-users/c99f97ac-2ba7-4d86-9f1e-513d736bc078n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/CAOLESwk0jbz1zwLorb9h7neBB3imtBMX3xt7iu1QMXUaVzYJmA%40mail.gmail.com.


Re: [cryptopp-users] HMACs of files

2023-11-02 Thread Catherine Issabel

$500 million dollars available only for good and trusted receiver or 
mandate 
Kindly contact the sender for more information:+1 (336) 345-9681

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/c99f97ac-2ba7-4d86-9f1e-513d736bc078n%40googlegroups.com.


Re: [cryptopp-users] HMACs of files

2023-05-21 Thread Tom
It can work with: 
https://gist.github.com/thomasb9511/f570ecad82055b34a27ec9e706f596c9

But it sidesteps the pipeline for verification.

On Sunday, May 21, 2023 at 7:28:44 AM UTC-4 Tom wrote:

> When dealing with the `SignatureVerificationFilter`, similar issues arise 
> due to the requirement of having the "tag" at either the beginning or end 
> of the initial part of the pipeline. Adding the "tag" to the filename 
> within a pipeline that starts with `FileSource` does not resolve this 
> problem. Consequently, `FileSource` may attempt to load an incorrect file 
> or, when using an `ifstream`, cause a compile-time type mismatch.
>
> While attaching the "tag" to a file that already has it may seem logically 
> sound, this approach can disrupt the functionality of certain files. For 
> example, executable files cannot have the "tag" prepended, and appending 
> the "tag" can lead to extraction tools generating errors about extra data, 
> especially in the case of archives. Furthermore, this method renders simple 
> hash checks invalid, especially if the hash was generated before the "tag" 
> was added, as the file's content has been altered.
> On Sunday, May 21, 2023 at 12:56:43 AM UTC-4 Tom wrote:
>
>> Okay. 
>>
>> However, when I looked at the information provided in this link: 
>> https://www.cryptopp.com/wiki/HashVerificationFilter#String_and_File_Sources,
>>  
>> it appears that the method suggested to avoid memory usage doesn't actually 
>> achieve that goal, as the line FileSource fs("zero.dat", true); in the 
>> verification step is performing as intended.
>>
>> Unfortunately, I am unable to use FileSource fs("zero.dat", false, new 
>> HashVerificationFilter(sha256, new StringSink(digest))); or FileSource 
>> fs("zero.dat", true... either, because it's unclear how to associate the 
>> digest with the input file.
>> On Saturday, May 20, 2023 at 6:48:40 PM UTC-4 Jeffrey Walton wrote:
>>
>>> On Sat, May 20, 2023 at 4:45 PM Jeffrey Walton  
>>> wrote: 
>>> > 
>>> > On Sat, May 20, 2023 at 3:00 PM Tom  wrote: 
>>> > > 
>>> > > calling `FileSource fs("zero.dat", true);` seems to allocate the 
>>> memory. 
>>> > 
>>> > Try the overload which takes a std::istream reference: 
>>> > https://www.cryptopp.com/wiki/FileSource 
>>>
>>> I took another look... The issue is you passed 'true' for 'pumpAll'. 
>>> That reads the entire file, and puts it in an output buffer for the 
>>> next filter. 
>>>
>>> Use 'false' instead, and then call 'PumpAll()' manually. Something 
>>> like the example. Something like this should suffice: 
>>>
>>> FileSource fs("zero.dat", false, new Filter(..., new Sink(...))); 
>>> fs.PumpAll(); 
>>>
>>> It should pump in 4k blocks. 
>>>
>>> Jeff 
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/16098bdd-0361-4b54-9860-c39b8c6147d4n%40googlegroups.com.


Re: [cryptopp-users] HMACs of files

2023-05-21 Thread Tom


When dealing with the `SignatureVerificationFilter`, similar issues arise 
due to the requirement of having the "tag" at either the beginning or end 
of the initial part of the pipeline. Adding the "tag" to the filename 
within a pipeline that starts with `FileSource` does not resolve this 
problem. Consequently, `FileSource` may attempt to load an incorrect file 
or, when using an `ifstream`, cause a compile-time type mismatch.

While attaching the "tag" to a file that already has it may seem logically 
sound, this approach can disrupt the functionality of certain files. For 
example, executable files cannot have the "tag" prepended, and appending 
the "tag" can lead to extraction tools generating errors about extra data, 
especially in the case of archives. Furthermore, this method renders simple 
hash checks invalid, especially if the hash was generated before the "tag" 
was added, as the file's content has been altered.
On Sunday, May 21, 2023 at 12:56:43 AM UTC-4 Tom wrote:

> Okay. 
>
> However, when I looked at the information provided in this link: 
> https://www.cryptopp.com/wiki/HashVerificationFilter#String_and_File_Sources, 
> it appears that the method suggested to avoid memory usage doesn't actually 
> achieve that goal, as the line FileSource fs("zero.dat", true); in the 
> verification step is performing as intended.
>
> Unfortunately, I am unable to use FileSource fs("zero.dat", false, new 
> HashVerificationFilter(sha256, new StringSink(digest))); or FileSource 
> fs("zero.dat", true... either, because it's unclear how to associate the 
> digest with the input file.
> On Saturday, May 20, 2023 at 6:48:40 PM UTC-4 Jeffrey Walton wrote:
>
>> On Sat, May 20, 2023 at 4:45 PM Jeffrey Walton  
>> wrote: 
>> > 
>> > On Sat, May 20, 2023 at 3:00 PM Tom  wrote: 
>> > > 
>> > > calling `FileSource fs("zero.dat", true);` seems to allocate the 
>> memory. 
>> > 
>> > Try the overload which takes a std::istream reference: 
>> > https://www.cryptopp.com/wiki/FileSource 
>>
>> I took another look... The issue is you passed 'true' for 'pumpAll'. 
>> That reads the entire file, and puts it in an output buffer for the 
>> next filter. 
>>
>> Use 'false' instead, and then call 'PumpAll()' manually. Something 
>> like the example. Something like this should suffice: 
>>
>> FileSource fs("zero.dat", false, new Filter(..., new Sink(...))); 
>> fs.PumpAll(); 
>>
>> It should pump in 4k blocks. 
>>
>> Jeff 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/e13f1557-9234-4669-b0f9-aed8a6a6377cn%40googlegroups.com.


Re: [cryptopp-users] HMACs of files

2023-05-20 Thread Tom
Okay. 

However, when I looked at the information provided in this link: 
https://www.cryptopp.com/wiki/HashVerificationFilter#String_and_File_Sources, 
it appears that the method suggested to avoid memory usage doesn't actually 
achieve that goal, as the line FileSource fs("zero.dat", true); in the 
verification step is performing as intended.

Unfortunately, I am unable to use FileSource fs("zero.dat", false, new 
HashVerificationFilter(sha256, new StringSink(digest))); or FileSource 
fs("zero.dat", true... either, because it's unclear how to associate the 
digest with the input file.
On Saturday, May 20, 2023 at 6:48:40 PM UTC-4 Jeffrey Walton wrote:

> On Sat, May 20, 2023 at 4:45 PM Jeffrey Walton  wrote:
> >
> > On Sat, May 20, 2023 at 3:00 PM Tom  wrote:
> > >
> > > calling `FileSource fs("zero.dat", true);` seems to allocate the 
> memory.
> >
> > Try the overload which takes a std::istream reference:
> > https://www.cryptopp.com/wiki/FileSource
>
> I took another look... The issue is you passed 'true' for 'pumpAll'.
> That reads the entire file, and puts it in an output buffer for the
> next filter.
>
> Use 'false' instead, and then call 'PumpAll()' manually. Something
> like the example. Something like this should suffice:
>
> FileSource fs("zero.dat", false, new Filter(..., new Sink(...)));
> fs.PumpAll();
>
> It should pump in 4k blocks.
>
> Jeff
>

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/7af8a6f5-5cc2-47d2-b35b-21c131bbf774n%40googlegroups.com.


Re: [cryptopp-users] HMACs of files

2023-05-20 Thread Jeffrey Walton
On Sat, May 20, 2023 at 4:45 PM Jeffrey Walton  wrote:
>
> On Sat, May 20, 2023 at 3:00 PM Tom  wrote:
> >
> > calling `FileSource fs("zero.dat", true);` seems to allocate the memory.
>
> Try the overload which takes a std::istream reference:
> https://www.cryptopp.com/wiki/FileSource

I took another look... The issue is you passed 'true' for 'pumpAll'.
That reads the entire file, and puts it in an output buffer for the
next filter.

Use 'false' instead, and then call 'PumpAll()' manually. Something
like the example. Something like this should suffice:

FileSource fs("zero.dat", false, new Filter(..., new Sink(...)));
fs.PumpAll();

It should pump in 4k blocks.

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/CAH8yC8k7u3f7PdhAHhACPEHVoYhEOfBM3WGP25ADZTd26PocZg%40mail.gmail.com.


Re: [cryptopp-users] HMACs of files

2023-05-20 Thread Jeffrey Walton
On Sat, May 20, 2023 at 3:00 PM Tom  wrote:
>
> calling `FileSource fs("zero.dat", true);` seems to allocate the memory.

Try the overload which takes a std::istream reference:
https://www.cryptopp.com/wiki/FileSource

Jeff

> On Wednesday, September 8, 2021 at 7:24:28 PM UTC-4 Jeffrey Walton wrote:
>>
>> On Wed, Sep 8, 2021 at 6:46 AM Jeffrey Walton  wrote:
>> >
>> > On Tue, Sep 7, 2021 at 7:45 AM Tom  wrote:
>> > >
>> > > I can create HMACs of files using pipelines via filesources but... I 
>> > > can't seem to figure out to verify the HMAC without throwing the file 
>> > > into a string in memory.
>> > >
>> > > like this:
>> > >
>> > > StringSource(plain + mac, true, new HashVerificationFilter(hmac, NULL, 
>> > > flags) ); // StringSource
>> > >
>> > > Is there a way to use a FileSource without loading the file fully into 
>> > > memory?
>> > >
>> > > I think its possible but do I append the hmac if I use a file?
>> >
>> > Yeah, that's a problem. We should have some documentation covering it.
>>
>> Here is the documentation:
>> https://www.cryptopp.com/wiki/HashVerificationFilter#String_and_File_Sources
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/CAH8yC8kjCAayyejfQtnMLVcZ9NGSheCYPb%2BHTQQCn5%3DxMbLruw%40mail.gmail.com.


Re: [cryptopp-users] HMACs of files

2023-05-20 Thread Tom
calling `FileSource fs("zero.dat", true);` seems to allocate the memory.

On Wednesday, September 8, 2021 at 7:24:28 PM UTC-4 Jeffrey Walton wrote:

> On Wed, Sep 8, 2021 at 6:46 AM Jeffrey Walton  wrote:
> >
> > On Tue, Sep 7, 2021 at 7:45 AM Tom  wrote:
> > >
> > > I can create HMACs of files using pipelines via filesources but... I 
> can't seem to figure out to verify the HMAC without throwing the file into 
> a string in memory.
> > >
> > > like this:
> > >
> > > StringSource(plain + mac, true, new HashVerificationFilter(hmac, NULL, 
> flags) ); // StringSource
> > >
> > > Is there a way to use a FileSource without loading the file fully into 
> memory?
> > >
> > > I think its possible but do I append the hmac if I use a file?
> >
> > Yeah, that's a problem. We should have some documentation covering it.
>
> Here is the documentation:
>
> https://www.cryptopp.com/wiki/HashVerificationFilter#String_and_File_Sources
>
> Jeff
>

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/4d2be937-ba8a-4125-99bb-b6abba00b9bcn%40googlegroups.com.


Re: [cryptopp-users] HMACs of files

2021-09-08 Thread Jeffrey Walton
On Wed, Sep 8, 2021 at 6:46 AM Jeffrey Walton  wrote:
>
> On Tue, Sep 7, 2021 at 7:45 AM Tom  wrote:
> >
> > I can create HMACs of files using pipelines via filesources but... I can't 
> > seem to figure out to verify the HMAC without throwing the file into a 
> > string in memory.
> >
> > like this:
> >
> > StringSource(plain + mac, true, new HashVerificationFilter(hmac, NULL, 
> > flags) ); // StringSource
> >
> > Is there a way to use a FileSource without loading the file fully into 
> > memory?
> >
> > I think its possible but do I append the hmac if I use a file?
>
> Yeah, that's a problem. We should have some documentation covering it.

Here is the documentation:
https://www.cryptopp.com/wiki/HashVerificationFilter#String_and_File_Sources

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/CAH8yC8mgQkpX-emDh9mnvXALTbKpDCFcTbuGGjRF2EEh%2BPK0CA%40mail.gmail.com.


Re: [cryptopp-users] HMACs of files

2021-09-08 Thread Jeffrey Walton


On Wednesday, September 8, 2021 at 6:47:45 AM UTC-4 Jeffrey Walton wrote:

> On Tue, Sep 7, 2021 at 7:45 AM Tom  wrote: 
> > 
> > I can create HMACs of files using pipelines via filesources but... I 
> can't seem to figure out to verify the HMAC without throwing the file into 
> a string in memory. 
> > 
> > like this: 
> > 
> > StringSource(plain + mac, true, new HashVerificationFilter(hmac, NULL, 
> flags) ); // StringSource 
> > 
> > Is there a way to use a FileSource without loading the file fully into 
> memory? 
> > 
> > I think its possible but do I append the hmac if I use a file? 
>
> Yeah, that's a problem. We should have some documentation covering it. 
>
> I think you need a custom source that takes two sources - the existing 
> HMAC wrapped in a StringSource and the FileSource. The custom source 
> then pumps the data to the attached filter. 
>
> Another option is a HashVerificationFilter that takes two sources. It 
> could be tricky since the source is expected to pump its data. I did 
> not test this option. 
>
> Attached is an example. It uses a hash rather than HMAC to simplify the 
> code. 
>
> The example has a bug, though. HashVerificationFilter is failing...
>

Attached is a corrected example that works as expected. Unfortunately, I 
was not able to get the CombinedSource class to work as expected. Instead, 
I had to manually fiddle with both Sources. It is not as elegant, but it 
should get you through your task.

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/a36821f1-3d7a-46ec-9b6f-1618ab1ded53n%40googlegroups.com.
#include 
#include 

#include "cryptlib.h"
#include "filters.h"
#include "files.h"
#include "sha.h"
#include "hex.h"

int main(int argc, char* argv[])
{
using namespace CryptoPP;

// Create a file of all 0's with:
// dd if=/dev/zero of=./zero.dat bs=4096 count=1

std::string digest;
SHA256 sha256;

// Create the digest on the file
FileSource("zero.dat", true, new HashFilter(sha256, new 
StringSink(digest)));

// Print the digest
std::cout << "Digest: ";
StringSource(digest, true, new HexEncoder(new FileSink(std::cout)));
std::cout << std::endl;

// Create a verifier
byte result = 0;
HashVerificationFilter verifier(sha256, new ArraySink(, 
sizeof(result)));

// Wrap the data in sources
StringSource ss(digest, true);
FileSource fs("zero.dat", true);

// Add the data to the filter
ss.TransferTo(verifier);
fs.TransferTo(verifier);

// Signal end of data. The verifier will finish calculating
// the digest, and compare the expected and calculated digests.
verifier.MessageEnd();

if (result)
std::cout << "Verified hash on file" << std::endl;
else
std::cout << "Failed to verify hash on file" << std::endl;

return 0;
}


Re: [cryptopp-users] HMACs of files

2021-09-08 Thread Jeffrey Walton
On Tue, Sep 7, 2021 at 7:45 AM Tom  wrote:
>
> I can create HMACs of files using pipelines via filesources but... I can't 
> seem to figure out to verify the HMAC without throwing the file into a string 
> in memory.
>
> like this:
>
> StringSource(plain + mac, true, new HashVerificationFilter(hmac, NULL, flags) 
> ); // StringSource
>
> Is there a way to use a FileSource without loading the file fully into memory?
>
> I think its possible but do I append the hmac if I use a file?

Yeah, that's a problem. We should have some documentation covering it.

I think you need a custom source that takes two sources - the existing
HMAC wrapped in a StringSource and the FileSource. The custom source
then pumps the data to the attached filter.

Another option is a HashVerificationFilter that takes two sources. It
could be tricky since the source is expected to pump its data. I did
not test this option.

Attached is an example. It uses a hash rather than HMAC to simplify the code.

The example has a bug, though. HashVerificationFilter is failing.
Instead of PUT_RESULT (or THROW), I used PUT_HASH to see the hash that
was calculated during verification. When using PUT_HASH, the
calculated digest has 32 0's appending to it. So the calculated digest
in the example program is
AD7FACB2586FC6E966C004D7D1D16B024F5805FF7CB47C7A85DABD8B48892CA7
.

I'll add the example to the wiki once I get the problem sorted out.

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/CAH8yC8nio-zV0CTMp7ttUPCxL%2B%2BfvbGOcJpZevHn_v7nq9G4mQ%40mail.gmail.com.
#include 
#include 

#include "cryptlib.h"
#include "filters.h"
#include "files.h"
#include "sha.h"
#include "hex.h"

using namespace CryptoPP;

class CombinedSource : public Source
{
public:
// Pumps s1 first, and then s2
CombinedSource(Source& s1, Source& s2, bool pumpAll,
BufferedTransformation* attachment)
: Source(attachment), m_s1(s1), m_s2(s2) {
if (pumpAll)
PumpAll();
}

virtual size_t Pump2(lword , bool blocking=true)
{
std::cout << "Pump2: " << byteCount << std::endl;

if (byteCount)
m_s1.TransferTo2(*AttachedTransformation(), byteCount, 
DEFAULT_CHANNEL, blocking);

if (byteCount)
m_s2.TransferTo2(*AttachedTransformation(), byteCount, 
DEFAULT_CHANNEL, blocking);

return static_cast(byteCount);
}

virtual size_t PumpMessages2(unsigned int , bool blocking=true)
{
std::cout << "PumpMessages2: " << messageCount << std::endl;

if (messageCount)
m_s1.TransferMessagesTo2(*AttachedTransformation(), messageCount, 
DEFAULT_CHANNEL, blocking);

if (messageCount)
m_s2.TransferMessagesTo2(*AttachedTransformation(), messageCount, 
DEFAULT_CHANNEL, blocking);

return messageCount;
}

virtual bool SourceExhausted() const {
return m_s1.SourceExhausted() && m_s2.SourceExhausted();
}

private:
Source _s1, _s2;
};

int main(int argc, char* argv[])
{
// Create a file of all 0's with:
// dd if=/dev/zero of=./zero.dat bs=4096 count=1

std::string digest;
SHA256 sha256;

// Create the hash on the file
FileSource("zero.dat", true, new HashFilter(sha256, new 
StringSink(digest)));

std::cout << "Digest: ";
StringSource(digest, true, new HexEncoder(new FileSink(std::cout)));
std::cout << std::endl;

StringSource ss(digest, true);
FileSource fs("zero.dat", true);

byte result = 0;
std::string digest2;
CombinedSource cs(ss, fs, true,
new HashVerificationFilter(sha256,
// new ArraySink(, sizeof(result;
new StringSink(digest2), 4));

std::cout << "Digest: ";
StringSource(digest2, true, new HexEncoder(new FileSink(std::cout)));
std::cout << std::endl;

if (result)
std::cout << "Verified hash on file" << std::endl;
else
std::cout << "Failed to verify hash on file" << std::endl;

return 0;
}


[cryptopp-users] HMACs of files

2021-09-07 Thread Tom
I can create HMACs of files using pipelines via filesources but... I can't 
seem to figure out to verify the HMAC without throwing the file into a 
string in memory.

like this:

StringSource(plain + mac, true, new HashVerificationFilter(hmac, NULL, 
flags) ); // StringSource 

Is there a way to use a FileSource without loading the file fully into 
memory?

I think its possible but do I append the hmac if I use a file?

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/ba96d8c3-b229-4a20-a132-4b81c5020759n%40googlegroups.com.