// RootCertificate returns the root certificate from the sign response.
RootCertificate returns the root certificate from the sign response.
// RootCertificate returns the root certificate from the sign response .
func RootCertificate(sign *api.SignResponse) (*x509.Certificate, error) {
	if sign == nil || sign.TLS == nil || len(sign.TLS.VerifiedChains) == 0 {
		return nil, errors.New("ca: certificate does not exist")
	}
	lastChain := sign.TLS.VerifiedChains[len(sign.TLS.VerifiedChains)-1]
	if len(lastChain) == 0 {
		return nil, errors.New("ca: certificate does not exist")
	}
	return lastChain[len(lastChain)-1], nil
}
func RootCertificate ( sign * api . SignResponse ) ( * x509 . Certificate , error ) { if sign == nil || sign . TLS == nil || len ( sign . TLS . VerifiedChains ) == 0 { return nil , errors . New ( " " ) } lastChain := sign . TLS . VerifiedChains [ len ( sign . TLS . VerifiedChains ) - 1 ] if len ( lastChain ) == 0 { return nil , errors . New ( " " ) } return lastChain [ len ( lastChain ) - 1 ] , nil }
RootCertificate returns the root certificate from the sign response.
RootCertificate returns the root certificate from the sign response .