func LoadRevocationsFromBug()

in entryMaker/oneCRL/oneCRL.go [328:361]


func LoadRevocationsFromBug(filename string, loader OneCRLLoader) error {
	conf := config.GetConfig()
	file, err := os.Open(filename)
	if err != nil {
		log.Fatal(err)
	}
	defer file.Close()

	scanner := bufio.NewScanner(file)
	for scanner.Scan() {
		// process line
		line := scanner.Text()

		// parse the issuer and serial lines from the bug data
		issuerIndex := strings.Index(line, IssuerPrefix)
		serialIndex := strings.Index(line, SerialPrefix)

		issuer := line[issuerIndex+len(IssuerPrefix) : serialIndex-1]
		serial := line[serialIndex+len(SerialPrefix) : len(line)]

		if "yes" == conf.OneCRLVerbose {
			fmt.Printf("Loading revocation. issuer: \"%s\", serial: \"%s\"\n", issuer, serial)
		}

		record := Record{IssuerName: issuer, SerialNumber: serial}
		loader.LoadRecord(record)
	}

	if err = scanner.Err(); err != nil {
		log.Fatal(err)
	}

	return nil
}