-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WSS-714 RecipientKeyInfo improved (#418)
* WSS-714 RecipientKeyInfo improved * Change findElement to getDirectChildElement --------- Co-authored-by: Colm O hEigeartaigh <coheigea@users.noreply.github.com>
- Loading branch information
Showing
4 changed files
with
472 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
ws-security-common/src/main/java/org/apache/wss4j/common/token/DOMX509SKI.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.apache.wss4j.common.token; | ||
|
||
import org.apache.wss4j.common.util.DOM2Writer; | ||
import org.apache.wss4j.common.util.XMLUtils; | ||
import org.w3c.dom.Element; | ||
|
||
|
||
/** | ||
* An X.509 SKI token. | ||
*/ | ||
public final class DOMX509SKI { | ||
private final Element element; | ||
private final byte[] skiBytes; | ||
|
||
/** | ||
* Constructor. | ||
*/ | ||
public DOMX509SKI(Element skiElement) { | ||
element = skiElement; | ||
|
||
String text = XMLUtils.getElementText(element); | ||
if (text == null) { | ||
skiBytes = new byte[0]; | ||
} else { | ||
skiBytes = org.apache.xml.security.utils.XMLUtils.decode(text); | ||
} | ||
} | ||
|
||
/** | ||
* return the dom element. | ||
* | ||
* @return the dom element. | ||
*/ | ||
public Element getElement() { | ||
return element; | ||
} | ||
|
||
/** | ||
* Return the SKI bytes. | ||
*/ | ||
public byte[] getSKIBytes() { | ||
return skiBytes; | ||
} | ||
|
||
/** | ||
* return the string representation of the token. | ||
* | ||
* @return the string representation of the token. | ||
*/ | ||
public String toString() { | ||
return DOM2Writer.nodeToString(element); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.