| | |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.api.EqualityMatchingRule; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.asn1.GSERException; |
| | | import org.opends.server.protocols.asn1.GSERParser; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.util.StaticUtils; |
| | | |
| | | import static org.opends.messages.SchemaMessages.*; |
| | |
| | | * |
| | | * @return The normalized version of the provided value. |
| | | * |
| | | * @throws DirectoryException If the provided value is invalid according to |
| | | * @throws DecodeException If the provided value is invalid according to |
| | | * the associated attribute syntax. |
| | | */ |
| | | @Override |
| | | public ByteString normalizeAttributeValue(ByteSequence value) |
| | | throws DirectoryException |
| | | throws DecodeException |
| | | { |
| | | // The normalized form of this value is the GSER encoded .... |
| | | final BigInteger serialNumber; |
| | |
| | | switch (DirectoryServer.getSyntaxEnforcementPolicy()) |
| | | { |
| | | case REJECT: |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | message); |
| | | throw DecodeException.error(message); |
| | | case WARN: |
| | | logger.error(message); |
| | | |
| | | certificateIssuer= toLowerCase(dnstring); |
| | | break; |
| | | |
| | | default: |
| | | certificateIssuer= toLowerCase(dnstring); |
| | | break; |
| | | } |
| | | certificateIssuer= toLowerCase(dnstring); |
| | | } |
| | | |
| | | // Create the encoded value |
| | |
| | | */ |
| | | @Override |
| | | public ByteString normalizeAssertionValue(ByteSequence value) |
| | | throws DirectoryException |
| | | throws DecodeException |
| | | { |
| | | // validate and normalize the GSER structure |
| | | // according to the definitions from RFC 4523, Appendix A.1 |
| | |
| | | { |
| | | LocalizableMessage message = ERR_CERTIFICATE_MATCH_IDENTIFIER_NOT_FOUND |
| | | .get(GSER_ID_SERIALNUMBER); |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | message); |
| | | throw DecodeException.error(message); |
| | | } |
| | | |
| | | // The value for the serialNumber |
| | |
| | | { |
| | | LocalizableMessage message = ERR_CERTIFICATE_MATCH_IDENTIFIER_NOT_FOUND |
| | | .get(GSER_ID_ISSUER); |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | message); |
| | | throw DecodeException.error(message); |
| | | } |
| | | |
| | | // expecting "rdnSequence:" |
| | |
| | | { |
| | | LocalizableMessage message = ERR_CERTIFICATE_MATCH_IDENTIFIER_NOT_FOUND |
| | | .get(GSER_ID_RDNSEQUENCE); |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | message); |
| | | throw DecodeException.error(message); |
| | | } |
| | | |
| | | // now the issuer dn |
| | |
| | | switch (DirectoryServer.getSyntaxEnforcementPolicy()) |
| | | { |
| | | case REJECT: |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | message); |
| | | throw DecodeException.error(message); |
| | | case WARN: |
| | | logger.error(message); |
| | | break; |
| | |
| | | { |
| | | LocalizableMessage message = ERR_CERTIFICATE_MATCH_GSER_INVALID.get( |
| | | getExceptionMessage(e)); |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | message); |
| | | throw DecodeException.error(message); |
| | | } |
| | | |
| | | // Normalize the DN |
| | |
| | | switch (DirectoryServer.getSyntaxEnforcementPolicy()) |
| | | { |
| | | case REJECT: |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | message); |
| | | throw DecodeException.error(message); |
| | | case WARN: |
| | | logger.error(message); |
| | | |
| | | certificateIssuer= toLowerCase(dnstring); |
| | | break; |
| | | |
| | | default: |
| | | certificateIssuer= toLowerCase(dnstring); |
| | | break; |
| | | } |
| | | certificateIssuer = toLowerCase(dnstring); |
| | | } |
| | | |
| | | // Create the encoded value |