pike.git/lib/modules/SSL.pmod/https.pike:75:
sslfile->set_nonblocking(read_callback, 0, 0);
}
}
class no_random {
object arcfour = Crypto.Arcfour();
protected void create(string|void secret)
{
if (!secret)
- secret = sprintf("Foo!%4c", time());
- arcfour->set_encrypt_key(Crypto.SHA1->hash(secret));
+ secret = sprintf("%s%4c", random_string(32), time());
+ arcfour->set_encrypt_key(Crypto.SHA256.hash(secret));
+ read(1000);
}
string read(int size)
{
- return arcfour->crypt(replace(allocate(size), 0, "\021") * "");
+ return arcfour->crypt( "\021"*size );
}
}
/* PKCS#1 Private key structure:
RSAPrivateKey ::= SEQUENCE {
version Version,
modulus INTEGER, -- n
publicExponent INTEGER, -- e
privateExponent INTEGER, -- d
pike.git/lib/modules/SSL.pmod/https.pike:160: Inside #if defined(HTTPS_CLIENT)
if (!con->connect("127.0.0.1", PORT)) {
werror("Failed to connect to server: %s\n", strerror(con->errno()));
return 17;
}
client(con);
return -17;
#else
Crypto.Sign key;
string certificate;
- key = Crypto.RSA()->
- set_random(Crypto.Random.random_string)->generate_key(1024);
+ key = Crypto.RSA()->generate_key(1024);
certificate =
Standards.X509.make_selfsigned_certificate(key, 3600*4, ([
"organizationName" : "Test",
"commonName" : "*",
]));
add_cert(key, ({ certificate }), ({ "*" }));
- key = Crypto.DSA()->
- set_random(Crypto.Random.random_string)->generate_key(1024, 160);
+ key = Crypto.DSA()->generate_key(1024, 160);
certificate =
Standards.X509.make_selfsigned_certificate(key, 3600*4, ([
"organizationName" : "Test",
"commonName" : "*",
]));
add_cert(key, ({ certificate }));
#if constant(Crypto.ECC.Curve)
key = Crypto.ECC.SECP_521R1.ECDSA()->
set_random(Crypto.Random.random_string)->generate_key();