- or download this
#!/usr/bin/perl
...
# so we both know the secret without transmitting it!
# magic!
print "These better be equal:\n\t$Kab\n\t$Kba\n\n";
- or download this
use Crypt::PBC;
...
my $P = $pairing->init_G2->random; # generator in G2
my $s = $pairing->init_Zr->random; # master secret
my $P_pub = $pairing->init_G2->pow_zn($P, $s); # master public key
- or download this
use Digest::SHA1 qw(sha1);
...
my $Q_i = $pairing->init_G1->set_to_hash( sha1($ID_i) );
print "ID_i=$ID_i\nQ_i=", $Q_i->as_hex, "\n";
- or download this
my $d_i = $pairing->init_G1->pow_zn( $Q_i, $s ); # the private key cor
+responding to $Q_i
- or download this
use Crypt::CBC;
use Crypt::Blowfish;
...
print "W1 =? W2\nW1=", substr($W1->as_base64, 0, 80), "\nW2=", substr(
+$W2->as_base64, 0, 80), "\n";
print "And here's the original message: $txt\n\n";
- or download this
$pairing = new Crypt::PBC("params_a.txt");
$P = $pairing->init_G2->random; # generator in G2
...
print "K_10 (these also better be the same):\n\t", substr($K_10_a->as_
+base64, 0, 80),
"\n\t", substr($K_10_b->as_base64, 0, 80), "\n\n";
- or download this
# We can construct authenticated ciphers:
my $authcipha = new Crypt::CBC({header=>"randomiv", key=>$K_01_a->as
+_bytes, cipher=>"Blowfish"});
...
print "Verified message from ID_0: $verifiable_message[0]\n\n"
if $MAC eq $verifiable_message[1];
}
- or download this
my $ID_c = 'node_id=1382'; # chromatic is looking to join our IBE
my $Q_c = $pairing->init_G1->set_to_hash( sha1($ID_c) );
...
substr($d_c->as_base64, 0, 80), "\n\n";
- or download this
# $P is chosen the same way as the examples above, so we'll just use t
+hat.
...
print "[Y] un-authenticated secret is the same:\n\t", substr($W1->as_b
+ase64, 0, 80),
"\n\t", substr($W2->as_base64, 0, 80), "\n\n";