Project

General

Profile

« Previous | Next » 

Revision add3c6c5

Added by Stilez y about 9 years ago

Get modulus keysize

Useful utility function when it's necessary to verify that existing keys meets current practices

View differences:

src/etc/inc/certs.inc
582 582
	}
583 583
	return $modulus;
584 584
}
585

  
586
/* Same but returns modulus keysize not modulus itself */
587
function cert_get_modulus_keysize($str_crt, $decode = true, $type = "crt") {
588
	// modulus usually returned as "modulus=.....". Remove anything before an "=" and return 4 x (hex string length)
589
	$raw_modulus = explode('=', cert_get_modulus($str_crt, $decode, $type));
590
	return strlen(array_pop($raw_modulus))*4;
591
}
592

  
585 593
function csr_get_modulus($str_crt, $decode = true) {
586 594
	return cert_get_modulus($str_crt, $decode, "csr");
587 595
}

Also available in: Unified diff