Versie 4.14 Crypto/b64_random en hex_random toegevoegd

Wel afhankelijkheid van advapi32.lib voortaan maar daar kan ik mee leven.

svn path=/Slnkdwf/trunk/; revision=30263
This commit is contained in:
Jos Groot Lipman
2016-08-11 14:06:51 +00:00
parent 612839df43
commit 01630fe91a
4 changed files with 187 additions and 1 deletions

View File

@@ -253,3 +253,54 @@ for(int i = 0; i < 20; i++)
return bstrString.CopyTo(pVal);
}
// RtlGenRandom is wel enigszins gedocumenteerd door Microsoft
// Onwaarschijnlijk dat ze die ooit verwijderen
#define RtlGenRandom SystemFunction036
# if defined(__cplusplus)
extern "C"
# endif
BOOLEAN NTAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength);
# pragma comment(lib, "advapi32.lib")
// pLength is het aantal bytes. De resulterende b64 zal langer zijn
STDMETHODIMP CCrypto::b64_random(ULONG pLength, BSTR* pVal)
{
if (pLength > 32)
return E_INVALIDARG;
BYTE bytes[32];
if (!RtlGenRandom(bytes, pLength))
return myAtlReportError(GetObjectCLSID(), "ERROR CCrypto::b64_random: RtlGenRandom failed");
CString res = base64_encode(bytes, pLength, false); // no padding
SecureZeroMemory(bytes, pLength);
CComBSTR bstrString(res);
return bstrString.CopyTo(pVal);
}
// pLength is het aantal bytes. De resulterende hex zal langer zijn
STDMETHODIMP CCrypto::hex_random(ULONG pLength, BSTR* pVal)
{
if (pLength > 32)
return E_INVALIDARG;
BYTE bytes[32];
if (!RtlGenRandom(bytes, pLength))
return myAtlReportError(GetObjectCLSID(), "ERROR CCrypto::hex_random: RtlGenRandom failed");
CString res;
for (unsigned int i = 0; i < pLength; i++)
{
res = res + hex_tab[bytes[i] >> 4];
res = res + hex_tab[bytes[i] & 0xF];
}
SecureZeroMemory(bytes, pLength);
CComBSTR bstrString(res);
return bstrString.CopyTo(pVal);
}
CString res;

View File

@@ -54,6 +54,8 @@ public:
STDMETHOD(hotp)(BSTR hexseed, LONGLONG counter, BYTE digits, BSTR* pVal);
STDMETHOD(hex_pbkdf2)(BSTR pPassword, BSTR pSalt, ULONG pCount, ULONG pLength, BSTR* pVal);
STDMETHOD(b64_random)(ULONG pLength, BSTR* pVal);
STDMETHOD(hex_random)(ULONG pLength, BSTR* pVal);
};
OBJECT_ENTRY_AUTO(__uuidof(Crypto), CCrypto)

View File

@@ -393,6 +393,8 @@ interface ICrypto : IDispatch{
[id(4), helpstring("method hex_sha1_file")] HRESULT hex_sha1_file([in] BSTR fname, [out,retval] BSTR* pVal);
[id(5), helpstring("method hotp")] HRESULT hotp([in] BSTR hexseed, [in] LONGLONG counter, [in, defaultvalue(6)] BYTE digits, [out,retval] BSTR* pVal);
[id(6), helpstring("method hex_pbkdf2")] HRESULT hex_pbkdf2([in] BSTR pPassword, [in] BSTR pSalt, [in] ULONG pCount, [in, defaultvalue(20)] ULONG pLength, [out, retval] BSTR* pVal);
[id(7), helpstring("method b64_random")] HRESULT b64_random([in] ULONG pLength, [out, retval] BSTR* pVal);
[id(8), helpstring("method hex_random")] HRESULT hex_random([in] ULONG pLength, [out, retval] BSTR* pVal);
};
[
object,
@@ -612,7 +614,7 @@ library SLNKDWFLib
[default] interface IFTP;
};
[
uuid(B99C545B-D9F8-4AE7-B044-9CB1B3F7DDC9)
uuid(B99C545B-D9F8-4AE7-B044-9CB1B3F7DDC9)
]
coclass WinSock
{

131
historie.txt Normal file
View File

@@ -0,0 +1,131 @@
V4.14 11-08-2016
- Ook BMP formaat plaatjes ondersteunen
- Crypto/b64_random en hex_random toegevoegd
V4.13 11-08-2016
- Bij Vectorworks dwfs beter oppervlakte uitrekenen
V4.12 07-09-2015
- Font scale beter op 0 resetten na (werkplek) symbolen
V4.11 07-09-2015
- Crypto/hex_pbkdf2 toegevoegd
V4.10 07-09-2015
- WinSock class toegevoegd
V4.02 16-04-2015
- Font rotatie beter op 0 resetten na (werkplek) symbolen
V4.01 3-12-2014
- Geschreven DWF forceren naar v6.00 (i.p.v. 6.01)
V4.00 3-11-2014
- 64 bit, Visual Studio 2013, DWF Toolkit 7.6
V3.14 9-02-2014
- Betere overflow detectie bij symbolen rechts van gebouw geplaatst
- About.Sleep erbij
V3.13 30-01-2014
- FTP ook Putfile ondersteunen
V3.11 04-12-2013
- FTP class toegevoegd
- Zip.FileToHexStream toegevoegd
V3.02 19-11-2013
- Labelrotation op contouren ondersteunen
V3.00 06-08-2013
- Divers deprecated spullen verwijderd
- Labelpositie en fontgrootte per contour kunnen sturen
- Symbool definities ook op basis van W2D file: Whipfle.DefineW2Dsymbol
- Versie 3.00: Whipfile.AddContour erbij om contouren toe te voegen via AddPoint
- Hiermee kun je ook berekende boundingcontour overschrijven
- Contour sluit automatisch laatste lijntje bij wegschrijven
- Altijd SLNKKey in het AREA object
- Inkleuring contouren die 100% transparant is ook nog een <20>hidden<65> er omheen
v2.87 22-11-2012
- Versie 2.87: Crypto.hotp erbij
- SHA1 library bijgewerkt naar versie 2.1
v2.86 21-11-2012
- ImageConvert zal automatisch croppen voor SaveAs als aspectratio veranderd is
v2.85 01-06-2012
- Crypto hex_sha1 en hex_sha1_file erbij
- Font resetten bij symbolen
v2.84 20-03-2012
- Voorkomt crash als eerste en laatste layernum toevallig gelijk
v2.82 20-03-2012
- Crypto b64_hmac_sha1 erbij
v2.82 02-03-2012
- Weer (gehele) bitmap rotatie ondersteunen. Handig bij printen landscape
v2.81 28-02-2012
- QR Code ook kleur kunnen zetten (SG-Blauw bijvoorbeeld)
v2.80 5-01-2012
- Bij scannen voor contouren de afmeting uit de laatste Viewport halen?zo werkt het ook voor paperspace plots.
(Whip2DC deed dat al dus kan het weinig kwaad?)
- minContSize per Whipfile en niet meer globaal
- whip2PNG.Antialias ondersteunen
TODO: Arcering wordt dan ook factor 2 fijner. Dat moet niet. Hoe gaat text geeking nu?
- Contour.Lineweight ondersteunen
- Contour.SetOutlineColor ondersteunen (alpha alleen nog 0 en 255)
- Contour outlines altijd bovenop getekend
- Contour.moveTop ondersteunen voor contour-relatief
- SLNDKWFEvent levert contourKey op in plaats van contourLabel
- Code refactoring: geen m_State meer bij CWhipfile
v2.70 19-09-2011
- QRCodes kunnen maken
v2.60 08-09-2011
- FSN#21220 Effici<63>nter omgaan met enorme aantallen lagen
- Whipfile ContourCount en ContourItem om contouren op te halen
- Wip2PNG LayerCount en LayerItem om lagen op te halen
v2.51 18-05-2011
- HOUT#20645 Extra sluitend contourlijntje beter ondersteunen
- RWSN#19090 Spaties in labels strippen
v2.50 14-04-2011
- FSN#20307 Nieuwe interface: Code39 barcode
v2.41 29-03-2011
- RWSN#20095 Performance verbetering bij extreem veel nodes
- Roteren symbolen met bitmaps erin (alleen orthogonaal)
v2.40 02-12-2010
- Nieuwe interface: ImageConvert (foto resize)
v2.30 12-08-2010
- FSN#18414 symbolen FILL reset
v2.20 02-09-2008
- UWVA#14391 Nieuwe interface: Encrypted/zip
v2.14 29-07-2008
- TUDE#14307 Spikes/ lijndikte symbolen
v2.13 03-07-2008
- TUDE#14307 Printen zwarte vlakken??
v2.12 20-03-2008
- UWVA#13921 Eiland herkenning en functie HighlightUnrecognized
v2.11 12-02-2008
- Beter bestand tegen hoge layernum's
- Achtergrondkleur
v2.10 21-01-2008
- v2.10 Symbool rotatie
v2.00 01-08-2007
- DWF Toolkit 7.02, geen plan/contour merging meer etc.