Re: Announcing TitaniumD - A D Binding for the Botan Cryptography Library

2014-05-01 Thread Andrei Alexandrescu via Digitalmars-d-announce

On 4/30/14, 6:28 PM, Adam Wilson wrote:
[snip]

http://www.reddit.com/r/programming/comments/24gpb9/titaniumd_a_d_binding_for_the_botan_cryptography/

https://www.facebook.com/dlang.org/posts/839257452754604?stream_ref=10

https://hn.algolia.com/#!/story/forever/0/titaniumd

https://twitter.com/D_Programming/status/461897947270369281


Andrei



Re: Announcing TitaniumD - A D Binding for the Botan Cryptography Library

2014-05-01 Thread brad clawsie via Digitalmars-d-announce

Adam, this is very cool!

do you have any examples showing its use? In particular, examples 
highlighting D code using AES and SHA libs


thanks!
brad


Re: Announcing TitaniumD - A D Binding for the Botan Cryptography Library

2014-05-01 Thread Adam Wilson via Digitalmars-d-announce

On Thu, 01 May 2014 14:55:05 -0700, brad clawsie b...@b7j0c.org wrote:


Adam, this is very cool!

do you have any examples showing its use? In particular, examples  
highlighting D code using AES and SHA libs


thanks!
brad


You're welcome. There are no example yet. And the build script only  
supports Windows. Pull requests using *make tools most welcome.


A little walkthrough:

Build TitaniumCore, TitaniumD and TDI as static libraries. TitaniumCore  
and TitaniumD can be compiled with any C++ compiler and the availability  
of Boost Filesystem and ASIO. Although you'll have to specify the paths to  
Boost.


Once those libraries are built you'll need to pass all three of them to  
DMD along with your project.


Then the following code should work:

module test;
import std.stdio;
import Titanium.TDI; //Make sure to specify the correct search path with  
-I on the DMD commandline.


void main(string[] args)
{
auto t = new TitaniumLibrary();
//Hash Test Vectors
string vec1 = The quick brown fox jumps over the lazy dog;
string vec2 = The quick brown fox jumps over the lazy dog.;
//Hash Testing
writeln(HashSHA2(HashSize.Size256, vec1));
SHA2 h = new SHA2(HashSize.Size256);
writeln(h.Process(vec2));
AES c = new AES(CipherKeySize.Key128, CipherMode.GCM, 16);
ubyte[] enc1 = c.Encrypt(cast(ubyte[])vec1.dup);
string dec1 = cast(string)c.Decrypt(enc1);
ubyte[] enc2 = c.Encrypt(cast(ubyte[])vec2.dup);
string dec2 = cast(string)c.Decrypt(enc2);
writeln(enc1);
writeln(dec1);
writeln(enc2);
writeln(dec2);
}

The above sample shows SHA2 and AES-128/GCM.

Please submit bug reports and pull requests on GitHub if you run into any  
problems!


--
Adam Wilson
IRC: LightBender
Project Coordinator
The Aurora Project


Announcing TitaniumD - A D Binding for the Botan Cryptography Library

2014-04-30 Thread Adam Wilson via Digitalmars-d-announce

Hello Fellow D'ers,

I'd like to announce TitaniumD, a binding for D to the Botan Cryptography  
Library. Botan is an open-source cryptography library written in C++11 and  
makes extensive use of the C++ Standard Library in it's API. Titanium is a  
PIMPL around the Botan API designed to make interfacing Botan with other  
languages easier by translating the STL API into something more friendly.  
TitaniumD is the D specific binding for Botan.


Botan is distributed as source only and utilizes a script to configure  
individual modules into a single header and source file called an  
amalgamation build. Because of this Botan and Titanium are not a typical  
library distributions, such as OpenSSL, and therefore I am unsure how this  
might fit into Deimos.


A TitaniumD consists of three components:
- TitaniumCore, contains the Botan amalgamation build and the PIMPL  
wrapper.
- TitaniumD, the C++ half of the D binding that maps the PIMPL wrapper to  
a D compatible ABI.

- TDI, the D half of the binding.

Each of these components is built as a static library.

Currently Titanium supports the following algorithms:
AES - Sizes: 128/192/256- Modes: CBC, CTS, CFB, OFB, CTR, EAX, 
GCM, SIV
Camellia- Sizes: 128/192/256 	- Modes: CBC, CTS, CFB, OFB, CTR, EAX,  
GCM, SIV

Serpent - Sizes: 128- Modes: CBC, CTS, CFB, OFB, 
CTR, EAX, GCM, SIV
Threefish   - Sizes: 512 - Modes: CBC, CTS, CFB, OFB, CTR, 
EAX, SIV
Twofish - Sizes: 128- Modes: CBC, CTS, CFB, OFB, 
CTR, EAX, GCM, SIV
SHA-2   - Sizes: 224/256/384/512
SHA-3   - Sizes: 224/256/384/512
Skein   - Sizes: 512
Whirlpool   - Sizes: 512
RSA
Elliptic Curve Diffie-Hellman
HMAC RNG
ANSI X.923 RNG

SSL/TLS support is coming soon. Botan has supported SSL/TLS for a long  
time, however, there were a few bugs in code that prevented Visual C++  
from compiling the TLS modules. These are in the process of being fixed  
and I'll be building a wrapper for TLS in Titanium shortly.


Botan currently supports x86, x64, and ARM, on Linux, OSX, Windows, iOS,  
and Android. The only dependency that Botan has is on Boost, and any  
recent version will do, I've tested it 1.54 and 1.55.


At this point in time, I only have the time and energy to maintain the  
Windows portion of the code. Currently you can build it on Windows by  
entering the directory and running Build.sh in the Git Console. However, I  
could really use help in porting the build processes to other platforms.  
Beyond Botan the code itself is pretty vanilla C++, so any recent compiler  
should be able to compile the interface libraries without much fuss.


So if anybody has any interest in a Crypto library for D that is easy to  
use and isn't OpenSSL, I could really use some help getting this library  
ported to more platforms. Pull requests will be accepted!


Repositories:
Botan:  https://github.com/randombit/botan/tree/net.randombit.botan
Titanium: https://github.com/ellipticbit/titanium

--
Adam Wilson
GitHub/IRC: LightBender
Aurora Project Coordinator