001/*
002 * Copyright 2015-2018 the original author or authors
003 *
004 * This software is licensed under the Apache License, Version 2.0,
005 * the GNU Lesser General Public License version 2 or later ("LGPL")
006 * and the WTFPL.
007 * You may choose either license to govern your use of this software only
008 * upon the condition that you accept all of the terms of either
009 * the Apache License 2.0, the LGPL 2.1+ or the WTFPL.
010 */
011package org.minidns.dnssec;
012
013import org.minidns.dnsmessage.DnsMessage;
014import org.minidns.record.RRSIG;
015import org.minidns.record.Record;
016
017import java.util.Collections;
018import java.util.Set;
019
020public class DnssecMessage extends DnsMessage {
021    private final Set<Record<RRSIG>> signatures;
022    private final Set<UnverifiedReason> result;
023
024    DnssecMessage(DnsMessage.Builder copy, Set<Record<RRSIG>> signatures, Set<UnverifiedReason> unverifiedReasons) {
025        super(copy.setAuthenticData(unverifiedReasons == null || unverifiedReasons.isEmpty()));
026        this.signatures = Collections.unmodifiableSet(signatures);
027        this.result = unverifiedReasons == null ? Collections.<UnverifiedReason>emptySet() : Collections.unmodifiableSet(unverifiedReasons);
028    }
029
030    public Set<Record<RRSIG>> getSignatures() {
031        return signatures;
032    }
033
034    public Set<UnverifiedReason> getUnverifiedReasons() {
035        return result;
036    }
037
038}