Copying RSAKey


RSAKey class does not have operator= implemented nor the copy constructor. BlowFish, on the other hand, has… Is there a reson for this, or simply they are not there because no-one ever needed them?


I’d expect the compiler to generate its copy constructor and operator= method… Isn’t that working?


Haven’t tried honestly ^_^… I will soon


I get no compilation errors so it seems that the compiler provides them correctly.
However, I noticed that RSAKey uses BigInteger to store the two parts, which in turn uses HeapBlock to store its internal data… is it safe to let the compiler make a shallow copy of all of this structure, rather than explicitly making a deep copy of that?


BigInteger has a full set of copy and assignment operators, the compiler won’t do a shallow copy!


Ah I had to re-read some books because on the internet I could not find any clear information regarding how the default copy constructor and operator= operate on non primitive members… now all is clear, you are right, there is no need for them in RSAKey


what about an operator== and operator!= for comparisons, though?


Good suggestion, I’ll add those!