001/*
002 * Copyright 2015-2020 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.record;
012
013import org.minidns.constants.DnssecConstants.DigestAlgorithm;
014import org.minidns.constants.DnssecConstants.SignatureAlgorithm;
015import org.minidns.record.Record.TYPE;
016
017import java.io.DataInputStream;
018import java.io.IOException;
019/**
020 * DS (Delegation Signer) record payload.
021 *
022 * @see <a href="https://tools.ietf.org/html/rfc4034#section-5">RFC 4034 ยง 5</a>
023 */
024public class DS extends DelegatingDnssecRR {
025
026    public static DS parse(DataInputStream dis, int length) throws IOException {
027        SharedData parsedData = DelegatingDnssecRR.parseSharedData(dis, length);
028        return new DS(parsedData.keyTag, parsedData.algorithm, parsedData.digestType, parsedData.digest);
029    }
030
031    public DS(int keyTag, byte algorithm, byte digestType, byte[] digest) {
032        super(keyTag, algorithm, digestType, digest);
033    }
034
035    public DS(int keyTag, SignatureAlgorithm algorithm, byte digestType, byte[] digest) {
036        super(keyTag, algorithm, digestType, digest);
037    }
038
039    public DS(int keyTag, SignatureAlgorithm algorithm, DigestAlgorithm digestType, byte[] digest) {
040        super(keyTag, algorithm, digestType, digest);
041    }
042
043    @Override
044    public TYPE getType() {
045        return TYPE.DS;
046    }
047
048}