function __construct($content) { parent::__construct($content); $this->encoding = $this->getEncoding($content); switch ($this->encoding) { case parent::$KEY_ENCODING_PEM: $this->crl_pem = $this->content; break; case parent::$KEY_ENCODING_DER: $this->crl_pem = $this->der2pem($this->content); $this->crl_der = $this->content; break; default: throw new CryptoElementException("Internal problem, encoding set to non-recognizable format."); } }
/** * __construct * * Initialize the Certificate object, store the certificate in PEM * format (convert if necessary), read and parse the certificate. * * @param String $content the supplied certificate in either PEM * or DER format * @return void * @throws CryptoElementException if the encoding is neither PEM * nor DER * @access public */ function __construct($content) { parent::__construct($content); $this->encoding = $this->getEncoding($content); switch ($this->encoding) { case parent::$KEY_ENCODING_PEM: openssl_x509_export($this->content, $this->x509_pem, true); break; case parent::$KEY_ENCODING_DER: $this->x509_der = trim((string) $this->content); $this->x509_pem = trim($this->der2pem($this->x509_der)); break; default: throw new CryptoElementException("Internal problem, encoding set to non-recognizable format."); } $this->x509 = openssl_x509_read($this->x509_pem); $this->x509_parsed = openssl_x509_parse($this->x509_pem, false); }