예제 #1
0
  public static final DSData fromXML(final XMLDocument xmlDoc, final String dsDataXPath)
      throws Exception {
    final DSData result = new DSData();

    result.setKeyTag(
        Integer.parseInt(xmlDoc.getNodeValue(dsDataXPath + "/" + SEC_DNS_PREFIX + ":keyTag")));
    result.setAlg(
        Integer.parseInt(xmlDoc.getNodeValue(dsDataXPath + "/" + SEC_DNS_PREFIX + ":alg")));
    result.setDigestType(
        Integer.parseInt(xmlDoc.getNodeValue(dsDataXPath + "/" + SEC_DNS_PREFIX + ":digestType")));
    result.setDigest(xmlDoc.getNodeValue(dsDataXPath + "/" + SEC_DNS_PREFIX + ":digest"));
    setKeyDataInDSData(xmlDoc, dsDataXPath, result);

    return result;
  }
예제 #2
0
 private static void setKeyDataInDSData(
     final XMLDocument xmlDoc, final String dsDataXPath, final DSData result) throws Exception {
   final Node tempNode = xmlDoc.getElement(dsDataXPath + "/" + SEC_DNS_PREFIX + ":keyData");
   if (tempNode != null) {
     result.setKeyData(KeyData.fromXML(xmlDoc, dsDataXPath + "/" + SEC_DNS_PREFIX + ":keyData"));
   }
 }
예제 #3
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   DSData other = (DSData) obj;
   if (alg != other.alg) return false;
   if (digest == null) {
     if (other.digest != null) return false;
   } else if (!digest.equals(other.digest)) return false;
   if (digestType != other.digestType) return false;
   if (keyTag != other.keyTag) return false;
   if (keyData != null && !keyData.equals(other.getKeyData())) {
     return false;
   }
   return true;
 }
예제 #4
0
 public static final void appendDsDataElement(
     final XMLWriter xmlWriter, final Element parentElement, final DSData dsData) {
   final Element dsDataElement = SecDNSXMLUtil.createElement(xmlWriter, parentElement, "dsData");
   SecDNSXMLUtil.appendChildElement(xmlWriter, dsDataElement, "keyTag", dsData.getKeyTag());
   SecDNSXMLUtil.appendChildElement(xmlWriter, dsDataElement, "alg", dsData.getAlg());
   SecDNSXMLUtil.appendChildElement(
       xmlWriter, dsDataElement, "digestType", dsData.getDigestType());
   SecDNSXMLUtil.appendChildElement(xmlWriter, dsDataElement, "digest", dsData.getDigest());
   if (dsData.getKeyData() != null) {
     KeyData.appendKeyDataElement(xmlWriter, dsDataElement, dsData.getKeyData());
   }
 }