With openssl keys the amount of data you can encode at a time is

key bits / 8 - 11

So it's fine for small bits of data, but you can't do massive chunks in it. But knowing it always produces a data chunk of the keysize/8 you could just encode/decode in bits if you know the size of the key.

Anybody know a way of working it out from the keys, or whether there's something in the openssl functions that tells you it. I've been looking at the manual but might be code-blind.

cheers,
D.

    Ok this works - but it's not exactly elegant, still would like to know if it's built in if anybody knows. Don't worry, I'll be onto mycrpt next week - I'm working may way through, like

    function encrypt_strength($key)
    {
    	$testdata="frog fire";
    	$keyRes=openssl_pkey_get_private($key);
    
    if( !$keyRes )
    {
    	$keyRes=openssl_pkey_get_public($key);
    	if( !$keyRes )
    	{
    		return 0;
    	}
    }
    
    openssl_public_encrypt($testdata, $encrypted, $keyRes) OR die("DEATH: enc_strength - NO PUBLIC ENCRYPTION");
    openssl_free_key($keyRes);
    
    return strlen($encrypted)*8;
    }
    
      Write a Reply...