Package org.apache.xml.security.keys.content

Examples of org.apache.xml.security.keys.content.KeyInfoReference


        assertEquals(uriControl, keyInfoReference.getURI());
    }

    @org.junit.Test
    public void testId() throws Exception {
        KeyInfoReference keyInfoReference = new KeyInfoReference(documentBuilder.newDocument(), uriControl);
        assertEquals("", keyInfoReference.getId());
        assertNull(keyInfoReference.getElement().getAttributeNodeNS(null, Constants._ATT_ID));

        keyInfoReference.setId(idControl);
        assertEquals(idControl, keyInfoReference.getId());
        assertTrue(keyInfoReference.getElement().getAttributeNodeNS(null, Constants._ATT_ID).isId());

        keyInfoReference.setId(null);
        assertEquals("", keyInfoReference.getId());
        assertNull(keyInfoReference.getElement().getAttributeNodeNS(null, Constants._ATT_ID));
    }
View Full Code Here


     * @param storage
     * @return the KeyInfo which is referred to by this KeyInfoReference, or null if can not be resolved
     * @throws XMLSecurityException
     */
    private KeyInfo resolveReferentKeyInfo(Element element, String baseURI, StorageResolver storage) throws XMLSecurityException {
        KeyInfoReference reference = new KeyInfoReference(element, baseURI);
        Attr uriAttr = reference.getURIAttr();

        XMLSignatureInput resource = resolveInput(uriAttr, baseURI, secureValidation);

        Element referentElement = null;
        try {
View Full Code Here

     *
     * @param URI
     * @throws XMLSecurityException
     */
    public void addKeyInfoReference(String URI) throws XMLSecurityException {
        this.add(new KeyInfoReference(getDocument(), URI));
    }
View Full Code Here

        Element e =
            XMLUtils.selectDs11Node(
                getFirstChild(), Constants._TAG_KEYINFOREFERENCE, i);

        if (e != null) {
            return new KeyInfoReference(e, this.baseURI);
        }
        return null;    
    }
View Full Code Here

     * @param storage
     * @return the KeyInfo which is referred to by this KeyInfoReference, or null if can not be resolved
     * @throws XMLSecurityException
     */
    private KeyInfo resolveReferentKeyInfo(Element element, String baseURI, StorageResolver storage) throws XMLSecurityException {
        KeyInfoReference reference = new KeyInfoReference(element, baseURI);
        Attr uriAttr = reference.getURIAttr();

        XMLSignatureInput resource = resolveInput(uriAttr, baseURI, secureValidation);

        Element referentElement = null;
        try {
View Full Code Here

      documentBuilder = dbf.newDocumentBuilder();
    }
   
  @org.junit.Test
  public void testSchema() throws Exception {
      KeyInfoReference keyInfoReference = new KeyInfoReference(documentBuilder.newDocument(), uriControl);
      Element element = keyInfoReference.getElement();
     
      assertEquals("http://www.w3.org/2009/xmldsig11#", element.getNamespaceURI());
      assertEquals("KeyInfoReference", element.getLocalName());
  }
View Full Code Here

  public void testURIFromElement() throws Exception {
      Document doc = loadXML("KeyInfoReference.xml");
      NodeList nl = doc.getElementsByTagNameNS(Constants.SignatureSpec11NS, Constants._TAG_KEYINFOREFERENCE);
      Element element = (Element) nl.item(0);
     
      KeyInfoReference keyInfoReference = new KeyInfoReference(element, "");
      assertEquals(uriControl, keyInfoReference.getURI());
      assertEquals(idControl, keyInfoReference.getId());
  }
View Full Code Here

      assertEquals(idControl, keyInfoReference.getId());
  }

  @org.junit.Test
  public void testURIOnConstruction() throws Exception {
      KeyInfoReference keyInfoReference = new KeyInfoReference(documentBuilder.newDocument(), uriControl);
      assertEquals(uriControl, keyInfoReference.getURI());
  }
View Full Code Here

      assertEquals(uriControl, keyInfoReference.getURI());
  }
 
  @org.junit.Test
  public void testId() throws Exception {
    KeyInfoReference keyInfoReference = new KeyInfoReference(documentBuilder.newDocument(), uriControl);
    assertEquals("", keyInfoReference.getId());
    assertNull(keyInfoReference.getElement().getAttributeNodeNS(null, Constants._ATT_ID));
   
    keyInfoReference.setId(idControl);
    assertEquals(idControl, keyInfoReference.getId());
    assertTrue(keyInfoReference.getElement().getAttributeNodeNS(null, Constants._ATT_ID).isId());
   
    keyInfoReference.setId(null);
    assertEquals("", keyInfoReference.getId());
    assertNull(keyInfoReference.getElement().getAttributeNodeNS(null, Constants._ATT_ID));
  }
View Full Code Here

     *
     * @param URI
     * @throws XMLSecurityException
     */
    public void addKeyInfoReference(String URI) throws XMLSecurityException {
        this.add(new KeyInfoReference(this.doc, URI));
    }
View Full Code Here

TOP

Related Classes of org.apache.xml.security.keys.content.KeyInfoReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.