com.sun.org.apache.xml.internal.security.keys.content.keyvalues.DSAKeyValue Java Examples

The following examples show how to use com.sun.org.apache.xml.internal.security.keys.content.keyvalues.DSAKeyValue. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KeyValue.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor KeyValue
 *
 * @param doc
 * @param pk
 */
public KeyValue(Document doc, PublicKey pk) {
    super(doc);

    XMLUtils.addReturnToElement(this.constructionElement);

    if (pk instanceof java.security.interfaces.DSAPublicKey) {
        DSAKeyValue dsa = new DSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(dsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    } else if (pk instanceof java.security.interfaces.RSAPublicKey) {
        RSAKeyValue rsa = new RSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(rsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    }
}
 
Example #2
Source File: KeyValue.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor KeyValue
 *
 * @param doc
 * @param pk
 */
public KeyValue(Document doc, PublicKey pk) {
    super(doc);

    XMLUtils.addReturnToElement(this.constructionElement);

    if (pk instanceof java.security.interfaces.DSAPublicKey) {
        DSAKeyValue dsa = new DSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(dsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    } else if (pk instanceof java.security.interfaces.RSAPublicKey) {
        RSAKeyValue rsa = new RSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(rsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    }
}
 
Example #3
Source File: KeyValue.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor KeyValue
 *
 * @param doc
 * @param pk
 */
public KeyValue(Document doc, PublicKey pk) {
    super(doc);

    XMLUtils.addReturnToElement(this.constructionElement);

    if (pk instanceof java.security.interfaces.DSAPublicKey) {
        DSAKeyValue dsa = new DSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(dsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    } else if (pk instanceof java.security.interfaces.RSAPublicKey) {
        RSAKeyValue rsa = new RSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(rsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    }
}
 
Example #4
Source File: KeyValue.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor KeyValue
 *
 * @param doc
 * @param pk
 */
public KeyValue(Document doc, PublicKey pk) {
    super(doc);

    XMLUtils.addReturnToElement(this.constructionElement);

    if (pk instanceof java.security.interfaces.DSAPublicKey) {
        DSAKeyValue dsa = new DSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(dsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    } else if (pk instanceof java.security.interfaces.RSAPublicKey) {
        RSAKeyValue rsa = new RSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(rsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    }
}
 
Example #5
Source File: KeyValue.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor KeyValue
 *
 * @param doc
 * @param pk
 */
public KeyValue(Document doc, PublicKey pk) {
    super(doc);

    XMLUtils.addReturnToElement(this.constructionElement);

    if (pk instanceof java.security.interfaces.DSAPublicKey) {
        DSAKeyValue dsa = new DSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(dsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    } else if (pk instanceof java.security.interfaces.RSAPublicKey) {
        RSAKeyValue rsa = new RSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(rsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    }
}
 
Example #6
Source File: KeyValue.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor KeyValue
 *
 * @param doc
 * @param pk
 */
public KeyValue(Document doc, PublicKey pk) {
    super(doc);

    XMLUtils.addReturnToElement(this.constructionElement);

    if (pk instanceof java.security.interfaces.DSAPublicKey) {
        DSAKeyValue dsa = new DSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(dsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    } else if (pk instanceof java.security.interfaces.RSAPublicKey) {
        RSAKeyValue rsa = new RSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(rsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    }
}
 
Example #7
Source File: KeyValue.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Constructor KeyValue
 *
 * @param doc
 * @param pk
 */
public KeyValue(Document doc, PublicKey pk) {
    super(doc);

    XMLUtils.addReturnToElement(this.constructionElement);

    if (pk instanceof java.security.interfaces.DSAPublicKey) {
        DSAKeyValue dsa = new DSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(dsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    } else if (pk instanceof java.security.interfaces.RSAPublicKey) {
        RSAKeyValue rsa = new RSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(rsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    }
}
 
Example #8
Source File: KeyValue.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor KeyValue
 *
 * @param doc
 * @param pk
 */
public KeyValue(Document doc, PublicKey pk) {
    super(doc);

    XMLUtils.addReturnToElement(this.constructionElement);

    if (pk instanceof java.security.interfaces.DSAPublicKey) {
        DSAKeyValue dsa = new DSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(dsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    } else if (pk instanceof java.security.interfaces.RSAPublicKey) {
        RSAKeyValue rsa = new RSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(rsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    }
}
 
Example #9
Source File: KeyValue.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor KeyValue
 *
 * @param doc
 * @param pk
 */
public KeyValue(Document doc, PublicKey pk) {
    super(doc);

    XMLUtils.addReturnToElement(this.constructionElement);

    if (pk instanceof java.security.interfaces.DSAPublicKey) {
        DSAKeyValue dsa = new DSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(dsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    } else if (pk instanceof java.security.interfaces.RSAPublicKey) {
        RSAKeyValue rsa = new RSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(rsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    }
}
 
Example #10
Source File: KeyValue.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor KeyValue
 *
 * @param doc
 * @param pk
 */
public KeyValue(Document doc, PublicKey pk) {
    super(doc);

    XMLUtils.addReturnToElement(this.constructionElement);

    if (pk instanceof java.security.interfaces.DSAPublicKey) {
        DSAKeyValue dsa = new DSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(dsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    } else if (pk instanceof java.security.interfaces.RSAPublicKey) {
        RSAKeyValue rsa = new RSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(rsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    }
}
 
Example #11
Source File: KeyValue.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor KeyValue
 *
 * @param doc
 * @param pk
 */
public KeyValue(Document doc, PublicKey pk) {
    super(doc);

    XMLUtils.addReturnToElement(this.constructionElement);

    if (pk instanceof java.security.interfaces.DSAPublicKey) {
        DSAKeyValue dsa = new DSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(dsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    } else if (pk instanceof java.security.interfaces.RSAPublicKey) {
        RSAKeyValue rsa = new RSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(rsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    }
}
 
Example #12
Source File: KeyValue.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor KeyValue
 *
 * @param doc
 * @param pk
 */
public KeyValue(Document doc, PublicKey pk) {
    super(doc);

    XMLUtils.addReturnToElement(this.constructionElement);

    if (pk instanceof java.security.interfaces.DSAPublicKey) {
        DSAKeyValue dsa = new DSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(dsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    } else if (pk instanceof java.security.interfaces.RSAPublicKey) {
        RSAKeyValue rsa = new RSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(rsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    }
}
 
Example #13
Source File: KeyValue.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor KeyValue
 *
 * @param doc
 * @param pk
 */
public KeyValue(Document doc, PublicKey pk) {
    super(doc);

    XMLUtils.addReturnToElement(this.constructionElement);

    if (pk instanceof java.security.interfaces.DSAPublicKey) {
        DSAKeyValue dsa = new DSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(dsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    } else if (pk instanceof java.security.interfaces.RSAPublicKey) {
        RSAKeyValue rsa = new RSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(rsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    }
}
 
Example #14
Source File: KeyValue.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor KeyValue
 *
 * @param doc
 * @param pk
 */
public KeyValue(Document doc, PublicKey pk) {
    super(doc);

    XMLUtils.addReturnToElement(this.constructionElement);

    if (pk instanceof java.security.interfaces.DSAPublicKey) {
        DSAKeyValue dsa = new DSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(dsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    } else if (pk instanceof java.security.interfaces.RSAPublicKey) {
        RSAKeyValue rsa = new RSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(rsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    }
}
 
Example #15
Source File: KeyValue.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor KeyValue
 *
 * @param doc
 * @param pk
 */
public KeyValue(Document doc, PublicKey pk) {
    super(doc);

    XMLUtils.addReturnToElement(this.constructionElement);

    if (pk instanceof java.security.interfaces.DSAPublicKey) {
        DSAKeyValue dsa = new DSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(dsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    } else if (pk instanceof java.security.interfaces.RSAPublicKey) {
        RSAKeyValue rsa = new RSAKeyValue(this.doc, pk);

        this.constructionElement.appendChild(rsa.getElement());
        XMLUtils.addReturnToElement(this.constructionElement);
    }
}
 
Example #16
Source File: DSAKeyValueResolver.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Method engineResolvePublicKey
 *
 * @param element
 * @param BaseURI
 * @param storage
 * @return null if no {@link PublicKey} could be obtained
 */
public PublicKey engineLookupAndResolvePublicKey(
    Element element, String BaseURI, StorageResolver storage
) {
    if (element == null) {
        return null;
    }
    Element dsaKeyElement = null;
    boolean isKeyValue =
        XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_KEYVALUE);
    if (isKeyValue) {
        dsaKeyElement =
            XMLUtils.selectDsNode(element.getFirstChild(), Constants._TAG_DSAKEYVALUE, 0);
    } else if (XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_DSAKEYVALUE)) {
        // this trick is needed to allow the RetrievalMethodResolver to eat a
        // ds:DSAKeyValue directly (without KeyValue)
        dsaKeyElement = element;
    }

    if (dsaKeyElement == null) {
        return null;
    }

    try {
        DSAKeyValue dsaKeyValue = new DSAKeyValue(dsaKeyElement, BaseURI);
        PublicKey pk = dsaKeyValue.getPublicKey();

        return pk;
    } catch (XMLSecurityException ex) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, ex.getMessage(), ex);
        }
        //do nothing
    }

    return null;
}
 
Example #17
Source File: KeyValue.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor KeyValue
 *
 * @param doc
 * @param dsaKeyValue
 */
public KeyValue(Document doc, DSAKeyValue dsaKeyValue) {
    super(doc);

    XMLUtils.addReturnToElement(this.constructionElement);
    this.constructionElement.appendChild(dsaKeyValue.getElement());
    XMLUtils.addReturnToElement(this.constructionElement);
}
 
Example #18
Source File: DSAKeyValueResolver.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Method engineResolvePublicKey
 *
 * @param element
 * @param BaseURI
 * @param storage
 * @return null if no {@link PublicKey} could be obtained
 */
public PublicKey engineLookupAndResolvePublicKey(
    Element element, String BaseURI, StorageResolver storage
) {
    if (element == null) {
        return null;
    }
    Element dsaKeyElement = null;
    boolean isKeyValue =
        XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_KEYVALUE);
    if (isKeyValue) {
        dsaKeyElement =
            XMLUtils.selectDsNode(element.getFirstChild(), Constants._TAG_DSAKEYVALUE, 0);
    } else if (XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_DSAKEYVALUE)) {
        // this trick is needed to allow the RetrievalMethodResolver to eat a
        // ds:DSAKeyValue directly (without KeyValue)
        dsaKeyElement = element;
    }

    if (dsaKeyElement == null) {
        return null;
    }

    try {
        DSAKeyValue dsaKeyValue = new DSAKeyValue(dsaKeyElement, BaseURI);
        PublicKey pk = dsaKeyValue.getPublicKey();

        return pk;
    } catch (XMLSecurityException ex) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, ex.getMessage(), ex);
        }
        //do nothing
    }

    return null;
}
 
Example #19
Source File: KeyValue.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructor KeyValue
 *
 * @param doc
 * @param dsaKeyValue
 */
public KeyValue(Document doc, DSAKeyValue dsaKeyValue) {
    super(doc);

    XMLUtils.addReturnToElement(this.constructionElement);
    this.constructionElement.appendChild(dsaKeyValue.getElement());
    XMLUtils.addReturnToElement(this.constructionElement);
}
 
Example #20
Source File: KeyValue.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructor KeyValue
 *
 * @param doc
 * @param dsaKeyValue
 */
public KeyValue(Document doc, DSAKeyValue dsaKeyValue) {
    super(doc);

    XMLUtils.addReturnToElement(this.constructionElement);
    this.constructionElement.appendChild(dsaKeyValue.getElement());
    XMLUtils.addReturnToElement(this.constructionElement);
}
 
Example #21
Source File: DSAKeyValueResolver.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Method engineResolvePublicKey
 *
 * @param element
 * @param BaseURI
 * @param storage
 * @return null if no {@link PublicKey} could be obtained
 */
public PublicKey engineLookupAndResolvePublicKey(
    Element element, String BaseURI, StorageResolver storage
) {
    if (element == null) {
        return null;
    }
    Element dsaKeyElement = null;
    boolean isKeyValue =
        XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_KEYVALUE);
    if (isKeyValue) {
        dsaKeyElement =
            XMLUtils.selectDsNode(element.getFirstChild(), Constants._TAG_DSAKEYVALUE, 0);
    } else if (XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_DSAKEYVALUE)) {
        // this trick is needed to allow the RetrievalMethodResolver to eat a
        // ds:DSAKeyValue directly (without KeyValue)
        dsaKeyElement = element;
    }

    if (dsaKeyElement == null) {
        return null;
    }

    try {
        DSAKeyValue dsaKeyValue = new DSAKeyValue(dsaKeyElement, BaseURI);
        PublicKey pk = dsaKeyValue.getPublicKey();

        return pk;
    } catch (XMLSecurityException ex) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, ex.getMessage(), ex);
        }
        //do nothing
    }

    return null;
}
 
Example #22
Source File: KeyValue.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructor KeyValue
 *
 * @param doc
 * @param dsaKeyValue
 */
public KeyValue(Document doc, DSAKeyValue dsaKeyValue) {
    super(doc);

    XMLUtils.addReturnToElement(this.constructionElement);
    this.constructionElement.appendChild(dsaKeyValue.getElement());
    XMLUtils.addReturnToElement(this.constructionElement);
}
 
Example #23
Source File: DSAKeyValueResolver.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Method engineResolvePublicKey
 *
 * @param element
 * @param BaseURI
 * @param storage
 * @return null if no {@link PublicKey} could be obtained
 */
public PublicKey engineLookupAndResolvePublicKey(
    Element element, String BaseURI, StorageResolver storage
) {
    if (element == null) {
        return null;
    }
    Element dsaKeyElement = null;
    boolean isKeyValue =
        XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_KEYVALUE);
    if (isKeyValue) {
        dsaKeyElement =
            XMLUtils.selectDsNode(element.getFirstChild(), Constants._TAG_DSAKEYVALUE, 0);
    } else if (XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_DSAKEYVALUE)) {
        // this trick is needed to allow the RetrievalMethodResolver to eat a
        // ds:DSAKeyValue directly (without KeyValue)
        dsaKeyElement = element;
    }

    if (dsaKeyElement == null) {
        return null;
    }

    try {
        DSAKeyValue dsaKeyValue = new DSAKeyValue(dsaKeyElement, BaseURI);
        PublicKey pk = dsaKeyValue.getPublicKey();

        return pk;
    } catch (XMLSecurityException ex) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, ex.getMessage(), ex);
        }
        //do nothing
    }

    return null;
}
 
Example #24
Source File: KeyValue.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructor KeyValue
 *
 * @param doc
 * @param dsaKeyValue
 */
public KeyValue(Document doc, DSAKeyValue dsaKeyValue) {
    super(doc);

    XMLUtils.addReturnToElement(this.constructionElement);
    this.constructionElement.appendChild(dsaKeyValue.getElement());
    XMLUtils.addReturnToElement(this.constructionElement);
}
 
Example #25
Source File: KeyValue.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructor KeyValue
 *
 * @param doc
 * @param dsaKeyValue
 */
public KeyValue(Document doc, DSAKeyValue dsaKeyValue) {
    super(doc);

    XMLUtils.addReturnToElement(this.constructionElement);
    this.constructionElement.appendChild(dsaKeyValue.getElement());
    XMLUtils.addReturnToElement(this.constructionElement);
}
 
Example #26
Source File: DSAKeyValueResolver.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Method engineResolvePublicKey
 *
 * @param element
 * @param BaseURI
 * @param storage
 * @return null if no {@link PublicKey} could be obtained
 */
public PublicKey engineLookupAndResolvePublicKey(
    Element element, String BaseURI, StorageResolver storage
) {
    if (element == null) {
        return null;
    }
    Element dsaKeyElement = null;
    boolean isKeyValue =
        XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_KEYVALUE);
    if (isKeyValue) {
        dsaKeyElement =
            XMLUtils.selectDsNode(element.getFirstChild(), Constants._TAG_DSAKEYVALUE, 0);
    } else if (XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_DSAKEYVALUE)) {
        // this trick is needed to allow the RetrievalMethodResolver to eat a
        // ds:DSAKeyValue directly (without KeyValue)
        dsaKeyElement = element;
    }

    if (dsaKeyElement == null) {
        return null;
    }

    try {
        DSAKeyValue dsaKeyValue = new DSAKeyValue(dsaKeyElement, BaseURI);
        PublicKey pk = dsaKeyValue.getPublicKey();

        return pk;
    } catch (XMLSecurityException ex) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, ex.getMessage(), ex);
        }
        //do nothing
    }

    return null;
}
 
Example #27
Source File: KeyValue.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructor KeyValue
 *
 * @param doc
 * @param dsaKeyValue
 */
public KeyValue(Document doc, DSAKeyValue dsaKeyValue) {
    super(doc);

    XMLUtils.addReturnToElement(this.constructionElement);
    this.constructionElement.appendChild(dsaKeyValue.getElement());
    XMLUtils.addReturnToElement(this.constructionElement);
}
 
Example #28
Source File: DSAKeyValueResolver.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Method engineResolvePublicKey
 *
 * @param element
 * @param BaseURI
 * @param storage
 * @return null if no {@link PublicKey} could be obtained
 */
public PublicKey engineLookupAndResolvePublicKey(
    Element element, String BaseURI, StorageResolver storage
) {
    if (element == null) {
        return null;
    }
    Element dsaKeyElement = null;
    boolean isKeyValue =
        XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_KEYVALUE);
    if (isKeyValue) {
        dsaKeyElement =
            XMLUtils.selectDsNode(element.getFirstChild(), Constants._TAG_DSAKEYVALUE, 0);
    } else if (XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_DSAKEYVALUE)) {
        // this trick is needed to allow the RetrievalMethodResolver to eat a
        // ds:DSAKeyValue directly (without KeyValue)
        dsaKeyElement = element;
    }

    if (dsaKeyElement == null) {
        return null;
    }

    try {
        DSAKeyValue dsaKeyValue = new DSAKeyValue(dsaKeyElement, BaseURI);
        PublicKey pk = dsaKeyValue.getPublicKey();

        return pk;
    } catch (XMLSecurityException ex) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, ex.getMessage(), ex);
        }
        //do nothing
    }

    return null;
}
 
Example #29
Source File: DSAKeyValueResolver.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Method engineResolvePublicKey
 *
 * @param element
 * @param BaseURI
 * @param storage
 * @return null if no {@link PublicKey} could be obtained
 */
public PublicKey engineLookupAndResolvePublicKey(
    Element element, String BaseURI, StorageResolver storage
) {
    if (element == null) {
        return null;
    }
    Element dsaKeyElement = null;
    boolean isKeyValue =
        XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_KEYVALUE);
    if (isKeyValue) {
        dsaKeyElement =
            XMLUtils.selectDsNode(element.getFirstChild(), Constants._TAG_DSAKEYVALUE, 0);
    } else if (XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_DSAKEYVALUE)) {
        // this trick is needed to allow the RetrievalMethodResolver to eat a
        // ds:DSAKeyValue directly (without KeyValue)
        dsaKeyElement = element;
    }

    if (dsaKeyElement == null) {
        return null;
    }

    try {
        DSAKeyValue dsaKeyValue = new DSAKeyValue(dsaKeyElement, BaseURI);
        PublicKey pk = dsaKeyValue.getPublicKey();

        return pk;
    } catch (XMLSecurityException ex) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, ex.getMessage(), ex);
        }
        //do nothing
    }

    return null;
}
 
Example #30
Source File: KeyValue.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructor KeyValue
 *
 * @param doc
 * @param dsaKeyValue
 */
public KeyValue(Document doc, DSAKeyValue dsaKeyValue) {
    super(doc);

    XMLUtils.addReturnToElement(this.constructionElement);
    this.constructionElement.appendChild(dsaKeyValue.getElement());
    XMLUtils.addReturnToElement(this.constructionElement);
}