use of com.sun.identity.saml2.jaxb.metadata.KeyDescriptorElement in project OpenAM by OpenRock.
the class SAML2MetaSecurityUtils method removeKeyDescriptor.
private static void removeKeyDescriptor(RoleDescriptorType desp, boolean isSigningUse) {
List keys = desp.getKeyDescriptor();
for (Iterator iter = keys.iterator(); iter.hasNext(); ) {
KeyDescriptorElement key = (KeyDescriptorElement) iter.next();
String keyUse = "encryption";
if (isSigningUse) {
keyUse = "signing";
}
if ((key.getUse() != null) && key.getUse().equalsIgnoreCase(keyUse)) {
iter.remove();
}
}
}
use of com.sun.identity.saml2.jaxb.metadata.KeyDescriptorElement in project OpenAM by OpenRock.
the class SAMLv2ModelImpl method getKeyandAlgorithm.
/**
* retrieves the encryption key size and algorithm
*
* @param ssodescriptor the SSODescriptorType which can be idpsso/spsso.
* @param map the Map which contains the attribute/value pairs.
*/
private void getKeyandAlgorithm(SSODescriptorType ssodescriptor, Map map) {
List keyList = ssodescriptor.getKeyDescriptor();
for (int i = 0; i < keyList.size(); i++) {
KeyDescriptorElement keyOne = (KeyDescriptorElement) keyList.get(i);
String type = keyOne.getUse();
if ((type == null) || (type.length() == 0) || type.equals("encryption")) {
List encryptMethod = keyOne.getEncryptionMethod();
if (!encryptMethod.isEmpty()) {
EncryptionMethodElement encrptElement = (EncryptionMethodElement) encryptMethod.get(0);
String alg = encrptElement.getAlgorithm();
String size = null;
List keySizeList = encrptElement.getContent();
if (!keySizeList.isEmpty()) {
for (Iterator itt = keySizeList.listIterator(); itt.hasNext(); ) {
Object encrptType = (Object) itt.next();
if (encrptType.getClass().getName().contains("KeySizeImpl")) {
EncryptionMethodType.KeySize keysizeElem = (EncryptionMethodType.KeySize) keySizeList.get(0);
BigInteger keysize = keysizeElem.getValue();
size = Integer.toString(keysize.intValue());
}
}
}
map.put(TF_KEY_NAME, returnEmptySetIfValueIsNull(size));
map.put(TF_ALGORITHM, returnEmptySetIfValueIsNull(alg));
}
}
}
}
Aggregations