use of com.sun.identity.saml2.jaxb.metadata.EncryptionMethodElement 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