docs: public static int getKeyLength(final PublicKey publicKey)
  	{
  		int length = -1;
  		if (publicKey == null)
  		{
  			return length;
  		}
  		if (publicKey instanceof RSAPublicKey)
  		{
  			length = ((RSAPublicKey)publicKey).getModulus().bitLength();
  		}
  		if (publicKey instanceof DSAPublicKey)
  		{
  			length = ((DSAPublicKey)publicKey).getParams().getP().bitLength();
  		}
  		if (publicKey instanceof ECPublicKey)
  		{
  			length = ((ECPublicKey)publicKey).getParams().getCurve().getField().getFieldSize();
  		}
  
  		return length;
  	}