// GetPublicKeyByKeyID returns the associated public key to given kid
GetPublicKeyByKeyID returns the associated public key to given kid
// GetPublicKeyByKeyID returns the associated public key to given kid
func (cM *CertificateManager) GetPublicKeyByKeyID(kid string) (*rsa.PublicKey, error) {
	for i := 0; i < 10; i++ {
		cM.certificatesMutex.Lock()
		if len(cM.Certificates) > 0 {
			defer cM.certificatesMutex.Unlock()
			if cert, ok := cM.Certificates[kid]; ok {
				return cert, nil
			}
			return nil, fmt.Errorf("could not find certificate for kid: %s", kid)
		}
		cM.certificatesMutex.Unlock()
		time.Sleep(500 * time.Millisecond) 
	}
	return nil, fmt.Errorf("timed out waiting for certificates to load")
}
func ( cM * CertificateManager ) GetPublicKeyByKeyID ( kid string ) ( * rsa . PublicKey , error ) { for i := 0 ; i < 10 ; i ++ { cM . certificatesMutex . Lock ( ) if len ( cM . Certificates ) > 0 { defer cM . certificatesMutex . Unlock ( ) if cert , ok := cM . Certificates [ kid ] ; ok { return cert , nil } return nil , fmt . Errorf ( " " , kid ) } cM . certificatesMutex . Unlock ( ) time . Sleep ( 500 * time . Millisecond ) } return nil , fmt . Errorf ( " " ) }
GetPublicKeyByKeyID returns the associated public key to given kid
GetPublicKeyByKeyID returns the associated public key to given kid
// back-off