Class TSLValidatorMappingCalculator
- java.lang.Object
-
- es.gob.afirma.tsl.certValidation.impl.TSLValidatorMappingCalculator
-
public final class TSLValidatorMappingCalculator extends java.lang.ObjectThis class offers static methods to extract mappings of a certificate validated through a TSL.
Project:Library for the integration with the services of @Firma, eVisor and TS@.
- Version:
- 1.4, 19/09/2022.
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Set<java.lang.String>STATIC_MAPPING_NAMES_SETConstant attribute that represents the set of mapping names that are static.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Map<java.lang.String,java.lang.String>addMappingsAndCheckCertClassification(java.util.Map<java.lang.String,java.lang.String> certInfoMap, java.util.Map<java.lang.String,java.lang.String> certInfoMapFromTSL)Adds the mappings extracted from the TSL information (and certificate) over the mappings configured in the certificate policies.static java.lang.StringcalculateMappingCertClassificationFromMappingClassification(java.lang.String classificationValue)Calculates the mapping for the logic field 'certClassification' from the input mapping value of the logic field 'clasificacion'.static booleanchecksIfMappingNameMatchesWithSomeStaticMappingName(java.lang.String mappingName)Checks if the input mapping name matches with some of the static mapping names.static voidextractStaticMappingsFromResult(TSLCertificateExtensionAnalyzer tslCertExtAnalyzer, java.util.Map<java.lang.String,java.lang.String> mappings, ITSLValidatorResult tslValidationResult)Extracts the static mappings from the validation result, and add these on the input mapping set.static java.lang.StringgetMappingClassificationFromCertificate(TSLCertificateExtensionAnalyzer tslCertExtAnalyzer, boolean translateMapping)Tries to extract from the certificate its classification type.static java.lang.StringgetMappingQSCDFromCertificate(TSLCertificateExtensionAnalyzer tslCertExtAnalyzer)Tries to extract from the certificate if it has its private key in a QSCD.static java.lang.StringgetMappingTypeQualifiedFromCertificate(TSLCertificateExtensionAnalyzer tslCertExtAnalyzer)Tries to extract from the certificate if it is qualified or not.
-
-
-
Method Detail
-
checksIfMappingNameMatchesWithSomeStaticMappingName
public static boolean checksIfMappingNameMatchesWithSomeStaticMappingName(java.lang.String mappingName)
Checks if the input mapping name matches with some of the static mapping names.- Parameters:
mappingName- Mapping name to check.- Returns:
trueif the input mapping name matches with some of the static mapping names, otherwisefalse.
-
extractStaticMappingsFromResult
public static void extractStaticMappingsFromResult(TSLCertificateExtensionAnalyzer tslCertExtAnalyzer, java.util.Map<java.lang.String,java.lang.String> mappings, ITSLValidatorResult tslValidationResult)
Extracts the static mappings from the validation result, and add these on the input mapping set.- Parameters:
tslCertExtAnalyzer- TSL Certificate Extension Analyzer needed to resolve the mappings of the certificate.mappings- Map in which adds the pairs <MappingName, MappingValue> calculated for the validated certificate.tslValidationResult- TSL validation result from which get the static mapping information.
-
getMappingTypeQualifiedFromCertificate
public static java.lang.String getMappingTypeQualifiedFromCertificate(TSLCertificateExtensionAnalyzer tslCertExtAnalyzer) throws TSLValidationException
Tries to extract from the certificate if it is qualified or not.- Parameters:
tslCertExtAnalyzer- TSL Certificate Extension Analyzer needed to resolve the mappings of the certificate.- Returns:
- String that represents the mapping type of the input certificate. It only can be one of the following:
- Throws:
TSLValidationException- In case of some error parsing the input certificate with BC provider.
-
getMappingClassificationFromCertificate
public static java.lang.String getMappingClassificationFromCertificate(TSLCertificateExtensionAnalyzer tslCertExtAnalyzer, boolean translateMapping) throws TSLValidationException
Tries to extract from the certificate its classification type.- Parameters:
tslCertExtAnalyzer- TSL Certificate Extension Analyzer needed to resolve the mappings of the certificate.translateMapping- Flag that if it istrue, then the returned mapping valuesITslMappingConstants.MAPPING_VALUE_CLASSIFICATION_NATURAL_PERSONandITslMappingConstants.MAPPING_VALUE_CLASSIFICATION_LEGALPERSONare translated toITslMappingConstants.MAPPING_VALUE_CLASSIFICATION_ESEALandITslMappingConstants.MAPPING_VALUE_CLASSIFICATION_ESIGrespectively.- Returns:
- String that represents the mapping classification of the input certificate. It only can be one of the following:
ITslMappingConstants.MAPPING_VALUE_UNKNOWNITslMappingConstants.MAPPING_VALUE_CLASSIFICATION_NATURAL_PERSONITslMappingConstants.MAPPING_VALUE_CLASSIFICATION_LEGALPERSONITslMappingConstants.MAPPING_VALUE_CLASSIFICATION_ESEALITslMappingConstants.MAPPING_VALUE_CLASSIFICATION_ESIGITslMappingConstants.MAPPING_VALUE_CLASSIFICATION_WSAITslMappingConstants.MAPPING_VALUE_CLASSIFICATION_TSA
- Throws:
TSLValidationException- In case of some error parsing the input certificate with BC provider.
-
getMappingQSCDFromCertificate
public static java.lang.String getMappingQSCDFromCertificate(TSLCertificateExtensionAnalyzer tslCertExtAnalyzer) throws TSLValidationException
Tries to extract from the certificate if it has its private key in a QSCD.- Parameters:
tslCertExtAnalyzer- TSL Certificate Extension Analyzer needed to resolve the mappings of the certificate.- Returns:
- String that represents the mapping for the input certificate. It only can be one of the following:
- Throws:
TSLValidationException- In case of some error parsing the input certificate with BC provider.
-
calculateMappingCertClassificationFromMappingClassification
public static java.lang.String calculateMappingCertClassificationFromMappingClassification(java.lang.String classificationValue)
Calculates the mapping for the logic field 'certClassification' from the input mapping value of the logic field 'clasificacion'.- Parameters:
classificationValue- String representation of the mapping value of the logical field 'clasificacion'.- Returns:
- String that represents the mapping classification for the input value. It only can be one of the following:
ITslMappingConstants.MAPPING_VALUE_UNKNOWNITslMappingConstants.MAPPING_VALUE_CLASSIFICATION_NATURAL_PERSONITslMappingConstants.MAPPING_VALUE_CLASSIFICATION_LEGALPERSONITslMappingConstants.MAPPING_VALUE_CLASSIFICATION_ESEALITslMappingConstants.MAPPING_VALUE_CLASSIFICATION_ESIGITslMappingConstants.MAPPING_VALUE_CLASSIFICATION_WSAITslMappingConstants.MAPPING_VALUE_CLASSIFICATION_TSA
-
addMappingsAndCheckCertClassification
public static java.util.Map<java.lang.String,java.lang.String> addMappingsAndCheckCertClassification(java.util.Map<java.lang.String,java.lang.String> certInfoMap, java.util.Map<java.lang.String,java.lang.String> certInfoMapFromTSL)Adds the mappings extracted from the TSL information (and certificate) over the mappings configured in the certificate policies. If theITslMappingConstants.MAPPING_KEY_CERT_CLASSIFICATIONis withITslMappingConstants.MAPPING_VALUE_UNKNOWNin TSL mappings, then is calculated from theITslMappingConstants.MAPPING_KEY_CERT_CLASIFICACIONfield from the original mappings.- Parameters:
certInfoMap- Mappings calculated from the certificate policy configuration.certInfoMapFromTSL- Mappings calculated from the information in the TSL and the certificate.- Returns:
- Map with all the mixed mappings.
-
-