Fix OPENDJ-482: Validation for the CertificateSyntax
A huge thanks to Manuel Gaupp for this contribution.
In addition to the original contributed change I have made the following alterations:
* make the CertificateSyntax strictness configurable. By default the syntax will enforce the syntax, but this can be disabled if needed
* add a new method "isHumanReadable" to AttributeSyntax and AttributeType classes in order to make it easier to determine whether or not a syntax/type is human readable. This can be used in order to determine whether or not an attribute value can be included in log messages, for example.
4 files added
78 files modified
| | |
| | | dn: cn=Certificate,cn=Syntaxes,cn=config |
| | | objectClass: top |
| | | objectClass: ds-cfg-attribute-syntax |
| | | objectClass: ds-cfg-certificate-attribute-syntax |
| | | cn: Certificate |
| | | ds-cfg-java-class: org.opends.server.schema.CertificateSyntax |
| | | ds-cfg-enabled: true |
| | | ds-cfg-strict-format: true |
| | | |
| | | dn: cn=Certificate List,cn=Syntaxes,cn=config |
| | | objectClass: top |
| | |
| | | SUP ds-cfg-virtual-attribute |
| | | STRUCTURAL |
| | | X-ORIGIN 'OpenDJ Directory Server' ) |
| | | objectClasses: ( 1.3.6.1.4.1.36733.2.1.2.10 |
| | | NAME 'ds-cfg-certificate-attribute-syntax' |
| | | SUP ds-cfg-attribute-syntax |
| | | STRUCTURAL |
| | | MAY ds-cfg-strict-format |
| | | X-ORIGIN 'OpenDJ Directory Server' ) |
| New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <!-- |
| | | ! CDDL HEADER START |
| | | ! |
| | | ! The contents of this file are subject to the terms of the |
| | | ! Common Development and Distribution License, Version 1.0 only |
| | | ! (the "License"). You may not use this file except in compliance |
| | | ! with the License. |
| | | ! |
| | | ! You can obtain a copy of the license at |
| | | ! trunk/opends/resource/legal-notices/CDDLv1_0.txt |
| | | ! or http://forgerock.org/license/CDDLv1.0.html. |
| | | ! See the License for the specific language governing permissions |
| | | ! and limitations under the License. |
| | | ! |
| | | ! When distributing Covered Code, include this CDDL HEADER in each |
| | | ! file and include the License file at |
| | | ! trunk/opends/resource/legal-notices/CDDLv1_0.txt. If applicable, |
| | | ! add the following below this CDDL HEADER, with the fields enclosed |
| | | ! by brackets "[]" replaced with your own identifying information: |
| | | ! Portions Copyright [yyyy] [name of copyright owner] |
| | | ! |
| | | ! CDDL HEADER END |
| | | ! |
| | | ! |
| | | ! Copyright 2012 ForgeRock AS. |
| | | ! --> |
| | | <adm:managed-object name="certificate-attribute-syntax" |
| | | plural-name="certificate-attribute-syntaxes" |
| | | extends="attribute-syntax" package="org.opends.server.admin.std" |
| | | xmlns:adm="http://www.opends.org/admin" |
| | | xmlns:ldap="http://www.opends.org/admin-ldap"> |
| | | <adm:synopsis> |
| | | <adm:user-friendly-plural-name /> |
| | | define an attribute syntax for storing X.509 Certificates. |
| | | </adm:synopsis> |
| | | <adm:profile name="ldap"> |
| | | <ldap:object-class> |
| | | <ldap:name>ds-cfg-certificate-attribute-syntax</ldap:name> |
| | | <ldap:superior>ds-cfg-attribute-syntax</ldap:superior> |
| | | </ldap:object-class> |
| | | </adm:profile> |
| | | <adm:property-override name="java-class" advanced="true"> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value> |
| | | org.opends.server.schema.CertificateSyntax |
| | | </adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | </adm:property-override> |
| | | <adm:property name="strict-format" advanced="true"> |
| | | <adm:synopsis> |
| | | Indicates whether or not X.509 Certificate values are required to |
| | | strictly comply with the standard definition for this syntax. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | When set to false, certificates will not be validation and, as a result |
| | | any sequence of bytes will be acceptable. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>true</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:boolean /> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-strict-format</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | </adm:managed-object> |
| New file |
| | |
| | | user-friendly-name=Certificate Attribute Syntax |
| | | user-friendly-plural-name=Certificate Attribute Syntaxes |
| | | synopsis=Certificate Attribute Syntaxes define an attribute syntax for storing X.509 Certificates. |
| | | property.enabled.synopsis=Indicates whether the Certificate Attribute Syntax is enabled. |
| | | property.java-class.synopsis=Specifies the fully-qualified name of the Java class that provides the Certificate Attribute Syntax implementation. |
| | | property.strict-format.synopsis=Indicates whether or not X.509 Certificate values are required to strictly comply with the standard definition for this syntax. |
| | | property.strict-format.description=When set to false, certificates will not be validation and, as a result any sequence of bytes will be acceptable. |
| | |
| | | operation has been rejected because request handler thread was interrupted \ |
| | | while attempting to put the operation on the work queue |
| | | INFO_DISCONNECT_DUE_TO_INVALID_CREDENTIALS_741=Invalid Credentials |
| | | SEVERE_WARN_ADD_OP_INVALID_SYNTAX_NO_VALUE_742=Entry "%s" contains a value for \ |
| | | attribute %s that is invalid according to the syntax for that attribute: %s |
| | | MILD_ERR_MODIFY_ADD_INVALID_SYNTAX_NO_VALUE_743=When attempting to modify entry \ |
| | | %s, one value for attribute %s was found to be invalid according to the \ |
| | | associated syntax: %s |
| | | MILD_ERR_MODIFY_REPLACE_INVALID_SYNTAX_NO_VALUE_744=When attempting to modify \ |
| | | entry %s to replace the set of values for attribute %s, one value was found to \ |
| | | be invalid according to the associated syntax: %s |
| | |
| | | INFO_ERGONOMIC_SIZING_OF_WORKER_THREAD_POOL_720=No s'ha especificat cap mida de conjunt de fils d'execuci\u00f3 de la cua de treball: re-dimensionat autom\u00e0ticament a utilitzar %d fils d'execuci\u00f3 |
| | | SEVERE_ERR_CRYPTOMGR_FAILED_INSTANCE_CERTIFICATE_NULL_721=L'entrada CryptoManager "%s" (inst\u00e0ncia-parell-claus certificat-clau-p\u00fablica) no cont\u00e9 un certificat de clau-p\u00fablica |
| | | INFO_DSCORE_DESCRIPTION_TIMEOUT_722=Temps m\u00e0xim (ens segons) per esperar abans del retorn de la comanda (el servidor continua el proc\u00e9s d'arranc, independentment). Un valor de '0' indica una expiraci\u00f3 de temps infinita, la qual significa que la comanda \u00fanicament retorna quant el servidor ha completat l'arranc. El valor predeterminat es de 60 segons. Aquesta opci\u00f3 no pot ser utilitzada amb l'opci\u00f3 -N, --nodetach |
| | | SEVERE_WARN_ADD_OP_INVALID_SYNTAX_NO_VALUE_742=Entry "%s" contains a value for \ |
| | | attribute %s that is invalid according to the syntax for that attribute: %s |
| | | MILD_ERR_MODIFY_ADD_INVALID_SYNTAX_NO_VALUE_743=When attempting to modify entry \ |
| | | %s, one value for attribute %s was found to be invalid according to the \ |
| | | associated syntax: %s |
| | | MILD_ERR_MODIFY_REPLACE_INVALID_SYNTAX_NO_VALUE_744=When attempting to modify \ |
| | | entry %s to replace the set of values for attribute %s, one value was found to \ |
| | | be invalid according to the associated syntax: %s |
| | |
| | | MILD_ERR_RDN_MISSING_ATTRIBUTE_VALUE_727=Die angegebene Zeichenfolge "%s" konnte nicht als ein relativer Distinguished Name entschl\u00fcsselt werden, da die angegebene Zeichenfolge keinen Wert f\u00fcr den Attributtyp "%s" enth\u00e4lt |
| | | MILD_ERR_CRYPTOMGR_INVALID_SYMMETRIC_KEY_LENGTH_728=CryptoManager konnte nicht gestartet werden, weil die angegebene Schl\u00fcssell\u00e4nge "%d" f\u00fcr die Verschl\u00fcsselung \u00fcber der zul\u00e4ssigen Verschl\u00fcsselungsst\u00e4rke "%d" in Jurisdiction Policy-Dateien liegt |
| | | MILD_ERR_DISK_SPACE_MONITOR_UPDATE_FAILED_729=Fehler beim Aktualisieren des freien Speicherplatzes f\u00fcr Verzeichnis %s: %s |
| | | SEVERE_WARN_ADD_OP_INVALID_SYNTAX_NO_VALUE_742=Eintrag "%s" enth\u00e4lt einen Wert f\u00fcr Attribut %s, das entsprechend der Syntax f\u00fcr dieses Attribut ung\u00fcltig ist: %s |
| | | MILD_ERR_MODIFY_ADD_INVALID_SYNTAX_NO_VALUE_743=Beim Versuch, Eintrag %s zu \u00e4ndern und einen oder mehrere Werte f\u00fcr Attribut %s hinzuzuf\u00fcgen, wurde festgestellt, dass ein Wert nach der zugeordneten Syntax ung\u00fcltig ist: %s |
| | | MILD_ERR_MODIFY_REPLACE_INVALID_SYNTAX_NO_VALUE_744=Beim Versuch, Eintrag %s zu \u00e4ndern und den Satz mit Werten f\u00fcr Attribut %s zu ersetzen, wurde festgestellt, dass ein Wert nach der zugeordneten Syntax ung\u00fcltig ist: %s |
| | |
| | | MILD_ERR_RDN_MISSING_ATTRIBUTE_VALUE_727=No se puede decodificar la cadena proporcionada "%s" como un nombre distinguido relativo porque no contiene ning\u00fan valor para el tipo de atributo %s |
| | | MILD_ERR_CRYPTOMGR_INVALID_SYMMETRIC_KEY_LENGTH_728=CryptoManager no pudo inicializarse porque la longitud de la clave de cifrado de "%d" especificada supera la intensidad de criptograf\u00eda permitida de "%d" en los archivos de directiva de jurisdicci\u00f3n |
| | | MILD_ERR_DISK_SPACE_MONITOR_UPDATE_FAILED_729=No pudo actualizarse el espacio libre en el disco para el directorio %s: %s |
| | | SEVERE_WARN_ADD_OP_INVALID_SYNTAX_NO_VALUE_742=Entry "%s" contains a value for \ |
| | | attribute %s that is invalid according to the syntax for that attribute: %s |
| | | MILD_ERR_MODIFY_ADD_INVALID_SYNTAX_NO_VALUE_743=When attempting to modify entry \ |
| | | %s, one value for attribute %s was found to be invalid according to the \ |
| | | associated syntax: %s |
| | | MILD_ERR_MODIFY_REPLACE_INVALID_SYNTAX_NO_VALUE_744=When attempting to modify \ |
| | | entry %s to replace the set of values for attribute %s, one value was found to \ |
| | | be invalid according to the associated syntax: %s |
| | |
| | | MILD_ERR_RDN_MISSING_ATTRIBUTE_VALUE_727=Impossible de d\u00e9coder le cha\u00eene fournie "%s" en tant que nom distinctif relatif, car elle ne contient pas de valeur pour le type d'attribut %s |
| | | MILD_ERR_CRYPTOMGR_INVALID_SYMMETRIC_KEY_LENGTH_728=CryptoManager n'a pas r\u00e9ussi \u00e0 s'initialiser car la longueur de la cl\u00e9 de chiffrement sp\u00e9cifi\u00e9e "%d" est bien au-del\u00e0 de la force de chiffrement "%d" dans les fichiers de strat\u00e9gie de juridiction |
| | | MILD_ERR_DISK_SPACE_MONITOR_UPDATE_FAILED_729=\u00c9chec de la mise \u00e0 jour de l'espace disque libre dans le r\u00e9pertoire\u00a0%s: %s |
| | | SEVERE_WARN_ADD_OP_INVALID_SYNTAX_NO_VALUE_742=Entry "%s" contains a value for \ |
| | | attribute %s that is invalid according to the syntax for that attribute: %s |
| | | MILD_ERR_MODIFY_ADD_INVALID_SYNTAX_NO_VALUE_743=When attempting to modify entry \ |
| | | %s, one value for attribute %s was found to be invalid according to the \ |
| | | associated syntax: %s |
| | | MILD_ERR_MODIFY_REPLACE_INVALID_SYNTAX_NO_VALUE_744=When attempting to modify \ |
| | | entry %s to replace the set of values for attribute %s, one value was found to \ |
| | | be invalid according to the associated syntax: %s |
| | |
| | | MILD_ERR_RDN_MISSING_ATTRIBUTE_VALUE_727=\u6307\u5b9a\u3055\u308c\u305f\u6587\u5b57\u5217 "%s" \u3092\u76f8\u5bfe\u8b58\u5225\u540d\u3068\u3057\u3066\u5fa9\u53f7\u5316\u3067\u304d\u307e\u305b\u3093\u3002\u5c5e\u6027\u578b %s \u306e\u5024\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u305b\u3093 |
| | | MILD_ERR_CRYPTOMGR_INVALID_SYMMETRIC_KEY_LENGTH_728=\u6307\u5b9a\u3055\u308c\u305f\u6697\u53f7\u5316\u30ad\u30fc\u306e\u9577\u3055 "%d" \u304c\u7ba1\u8f44\u30dd\u30ea\u30b7\u30fc\u30d5\u30a1\u30a4\u30eb\u5185\u3067\u8a31\u53ef\u3055\u308c\u308b\u6697\u53f7\u5316\u306e\u9577\u3055 "%d" \u3092\u8d85\u3048\u3066\u3044\u308b\u305f\u3081\u3001CryptoManager \u306f\u521d\u671f\u5316\u306b\u5931\u6557\u3057\u307e\u3057\u305f |
| | | MILD_ERR_DISK_SPACE_MONITOR_UPDATE_FAILED_729=\u30c7\u30a3\u30ec\u30af\u30c8\u30ea %s \u306e\u7a7a\u304d\u30c7\u30a3\u30b9\u30af\u5bb9\u91cf\u3092\u66f4\u65b0\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f: %s |
| | | SEVERE_WARN_ADD_OP_INVALID_SYNTAX_NO_VALUE_742=Entry "%s" contains a value for \ |
| | | attribute %s that is invalid according to the syntax for that attribute: %s |
| | | MILD_ERR_MODIFY_ADD_INVALID_SYNTAX_NO_VALUE_743=When attempting to modify entry \ |
| | | %s, one value for attribute %s was found to be invalid according to the \ |
| | | associated syntax: %s |
| | | MILD_ERR_MODIFY_REPLACE_INVALID_SYNTAX_NO_VALUE_744=When attempting to modify \ |
| | | entry %s to replace the set of values for attribute %s, one value was found to \ |
| | | be invalid according to the associated syntax: %s |
| | |
| | | SEVERE_ERR_CRYPTOMGR_FAILED_INSTANCE_CERTIFICATE_NULL_721=The CryptoManager entry "%s" (the instance-key-pair public-key-certificate) does not contain a public-key certificate |
| | | INFO_DSCORE_DESCRIPTION_TIMEOUT_722=Maximum time (in seconds) to wait before the command returns (the server continues the startup process, regardless). A value of '0' indicates an infinite timeout, which means that the command returns only when the server startup is completed. The default value is 60 seconds. This option cannot be used with the -N, --nodetach option |
| | | FATAL_ERR_DSCORE_ERROR_NODETACH_TIMEOUT_723=In no-detach mode, the 'timeout' option cannot be used |
| | | SEVERE_WARN_ADD_OP_INVALID_SYNTAX_NO_VALUE_742=Entry "%s" contains a value for \ |
| | | attribute %s that is invalid according to the syntax for that attribute: %s |
| | | MILD_ERR_MODIFY_ADD_INVALID_SYNTAX_NO_VALUE_743=When attempting to modify entry \ |
| | | %s, one value for attribute %s was found to be invalid according to the \ |
| | | associated syntax: %s |
| | | MILD_ERR_MODIFY_REPLACE_INVALID_SYNTAX_NO_VALUE_744=When attempting to modify \ |
| | | entry %s to replace the set of values for attribute %s, one value was found to \ |
| | | be invalid according to the associated syntax: %s |
| | |
| | | INFO_RESULT_OTHER_105=Inny |
| | | INFO_RESULT_SIZE_LIMIT_EXCEEDED_67=Przekroczony limit rozmiary |
| | | SEVERE_ERR_ADD_ENTRY_ALREADY_EXISTS_400=Wpis %s nie mo\u017ce zosta\u0107 dodatny, gdy\u017c wpis o takiej nazwie ju\u017c istnieje |
| | | SEVERE_WARN_ADD_OP_INVALID_SYNTAX_NO_VALUE_742=Entry "%s" contains a value for \ |
| | | attribute %s that is invalid according to the syntax for that attribute: %s |
| | | MILD_ERR_MODIFY_ADD_INVALID_SYNTAX_NO_VALUE_743=When attempting to modify entry \ |
| | | %s, one value for attribute %s was found to be invalid according to the \ |
| | | associated syntax: %s |
| | | MILD_ERR_MODIFY_REPLACE_INVALID_SYNTAX_NO_VALUE_744=When attempting to modify \ |
| | | entry %s to replace the set of values for attribute %s, one value was found to \ |
| | | be invalid according to the associated syntax: %s |
| | |
| | | MILD_ERR_RDN_MISSING_ATTRIBUTE_VALUE_727=\u65e0\u6cd5\u5c06\u63d0\u4f9b\u7684\u5b57\u7b26\u4e32 "%s" \u89e3\u7801\u4e3a\u76f8\u5bf9\u6807\u8bc6\u540d\uff0c\u56e0\u4e3a\u5b83\u672a\u5305\u542b\u5c5e\u6027\u7c7b\u578b %s \u7684\u503c |
| | | MILD_ERR_CRYPTOMGR_INVALID_SYMMETRIC_KEY_LENGTH_728=CryptoManager \u65e0\u6cd5\u521d\u59cb\u5316\uff0c\u56e0\u4e3a\u6307\u5b9a\u7684\u52a0\u5bc6\u5668\u5bc6\u94a5\u957f\u5ea6 "%d" \u8d85\u8fc7\u7ba1\u8f96\u6743\u7b56\u7565\u6587\u4ef6\u4e2d\u5141\u8bb8\u7684\u52a0\u5bc6\u5f3a\u5ea6 "%d" |
| | | MILD_ERR_DISK_SPACE_MONITOR_UPDATE_FAILED_729=\u65e0\u6cd5\u66f4\u65b0\u76ee\u5f55 %s \u7684\u53ef\u7528\u78c1\u76d8\u7a7a\u95f4: %s |
| | | SEVERE_WARN_ADD_OP_INVALID_SYNTAX_NO_VALUE_742=Entry "%s" contains a value for \ |
| | | attribute %s that is invalid according to the syntax for that attribute: %s |
| | | MILD_ERR_MODIFY_ADD_INVALID_SYNTAX_NO_VALUE_743=When attempting to modify entry \ |
| | | %s, one value for attribute %s was found to be invalid according to the \ |
| | | associated syntax: %s |
| | | MILD_ERR_MODIFY_REPLACE_INVALID_SYNTAX_NO_VALUE_744=When attempting to modify \ |
| | | entry %s to replace the set of values for attribute %s, one value was found to \ |
| | | be invalid according to the associated syntax: %s |
| | |
| | | SEVERE_ERR_CRYPTOMGR_FAILED_INSTANCE_CERTIFICATE_NULL_721=The CryptoManager entry "%s" (the instance-key-pair public-key-certificate) does not contain a public-key certificate |
| | | INFO_DSCORE_DESCRIPTION_TIMEOUT_722=Maximum time (in seconds) to wait before the command returns (the server continues the startup process, regardless). A value of '0' indicates an infinite timeout, which means that the command returns only when the server startup is completed. The default value is 60 seconds. This option cannot be used with the -N, --nodetach option |
| | | FATAL_ERR_DSCORE_ERROR_NODETACH_TIMEOUT_723=In no-detach mode, the 'timeout' option cannot be used |
| | | SEVERE_WARN_ADD_OP_INVALID_SYNTAX_NO_VALUE_742=Entry "%s" contains a value for \ |
| | | attribute %s that is invalid according to the syntax for that attribute: %s |
| | | MILD_ERR_MODIFY_ADD_INVALID_SYNTAX_NO_VALUE_743=When attempting to modify entry \ |
| | | %s, one value for attribute %s was found to be invalid according to the \ |
| | | associated syntax: %s |
| | | MILD_ERR_MODIFY_REPLACE_INVALID_SYNTAX_NO_VALUE_744=When attempting to modify \ |
| | | entry %s to replace the set of values for attribute %s, one value was found to \ |
| | | be invalid according to the associated syntax: %s |
| | |
| | | MILD_ERR_ATTR_SYNTAX_LDAPSYNTAX_EXPECTED_QUOTE_AT_POS_329=The provided value \ |
| | | "%s" could not be parsed as an ldap syntax description because a single \ |
| | | quote was expected at position %d but the character %s was found instead |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_NOTVALID_330=The provided value is not a valid \ |
| | | X.509 Certificate |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_INVALID_VERSION_331=The provided value is not \ |
| | | a valid X.509 Certificate because it contains an invalid version number (%d) |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_INVALID_DER_332=The provided value is not a valid \ |
| | | X.509 Certificate because it contains invalid DER encodings |
| | |
| | | MILD_ERR_ATTR_SYNTAX_LDAPSYNTAX_EXTENSION_INVALID_CHARACTER_327=The provided value "%s" could not be parsed as an ldap syntax extension because an invalid character was found at position %d |
| | | MILD_ERR_ATTR_SYNTAX_LDAPSYNTAX_EXPECTED_CLOSE_PARENTHESIS_328=The provided value "%s" could not be parsed as an ldap syntax description because a close parenthesis was expected at position %d but instead a '%s' character was found |
| | | MILD_ERR_ATTR_SYNTAX_LDAPSYNTAX_EXPECTED_QUOTE_AT_POS_329=The provided value "%s" could not be parsed as an ldap syntax description because a single quote was expected at position %d but the character %s was found instead |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_NOTVALID_330=Der angegebene Wert ist kein g\u00fcltiges X.509 Zertifikat |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_INVALID_VERSION_331=Der angegebene Wert ist kein g\u00fcltiges X.509 Zertifikat, da es eine ung\u00fcltige Versionsnummer beinhaltet (%d) |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_INVALID_DER_332=Der angegebene Wert ist kein g\u00fcltiges X.509 Zertifikat, da es ung\u00fcltige DER Kodierungen beinhaltet |
| | |
| | | MILD_ERR_ATTR_SYNTAX_LDAPSYNTAX_EXTENSION_INVALID_CHARACTER_327=No se pudo analizar el valor proporcionado "%s" como sintaxis LDAP porque se encontr\u00f3 un car\u00e1cter no v\u00e1lido en la posici\u00f3n %d |
| | | MILD_ERR_ATTR_SYNTAX_LDAPSYNTAX_EXPECTED_CLOSE_PARENTHESIS_328=No se pudo analizar el valor proporcionado "%s" como sintaxis LDAP porque conten\u00eda un par\u00e9ntesis de cierre inesperado en la posici\u00f3n %d |
| | | MILD_ERR_ATTR_SYNTAX_LDAPSYNTAX_EXPECTED_QUOTE_AT_POS_329=No se pudo analizar el valor proporcionado "%s" como sintaxis LDAP porque, en lugar de la comilla sencilla esperada en la posici\u00f3n %d, se encontr\u00f3 el car\u00e1cter %s |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_NOTVALID_330=The provided value is not a valid \ |
| | | X.509 Certificate |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_INVALID_VERSION_331=The provided value is not \ |
| | | a valid X.509 Certificate because it contains an invalid version number (%d) |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_INVALID_DER_332=The provided value is not a valid \ |
| | | X.509 Certificate because it contains invalid DER encodings |
| | |
| | | MILD_ERR_ATTR_SYNTAX_LDAPSYNTAX_EXTENSION_INVALID_CHARACTER_327=Impossible d'analyser la valeur indiqu\u00e9e "%s" en tant qu'extension de syntaxe ldap car un caract\u00e8re invalide se trouve \u00e0 la position %d |
| | | MILD_ERR_ATTR_SYNTAX_LDAPSYNTAX_EXPECTED_CLOSE_PARENTHESIS_328=Impossible d'analyser la valeur indiqu\u00e9e "%s" en tant que syntaxe ldap car elle contient une parenth\u00e8se de fermeture inattendue \u00e0 la position %d |
| | | MILD_ERR_ATTR_SYNTAX_LDAPSYNTAX_EXPECTED_QUOTE_AT_POS_329=Impossible d'analyser la valeur fournie ("%s") en tant que syntaxe ldap car une apostrophe devrait se trouver \u00e0 la position %d au lieu du caract\u00e8re %s |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_NOTVALID_330=The provided value is not a valid \ |
| | | X.509 Certificate |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_INVALID_VERSION_331=The provided value is not \ |
| | | a valid X.509 Certificate because it contains an invalid version number (%d) |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_INVALID_DER_332=The provided value is not a valid \ |
| | | X.509 Certificate because it contains invalid DER encodings |
| | |
| | | MILD_ERR_ATTR_SYNTAX_LDAPSYNTAX_EXTENSION_INVALID_CHARACTER_327=The provided value "%s" could not be parsed as an ldap syntax extension because an invalid character was found at position %d |
| | | MILD_ERR_ATTR_SYNTAX_LDAPSYNTAX_EXPECTED_CLOSE_PARENTHESIS_328=The provided value "%s" could not be parsed as an ldap syntax description because a close parenthesis was expected at position %d but instead a '%s' character was found |
| | | MILD_ERR_ATTR_SYNTAX_LDAPSYNTAX_EXPECTED_QUOTE_AT_POS_329=The provided value "%s" could not be parsed as an ldap syntax description because a single quote was expected at position %d but the character %s was found instead |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_NOTVALID_330=The provided value is not a valid \ |
| | | X.509 Certificate |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_INVALID_VERSION_331=The provided value is not \ |
| | | a valid X.509 Certificate because it contains an invalid version number (%d) |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_INVALID_DER_332=The provided value is not a valid \ |
| | | X.509 Certificate because it contains invalid DER encodings |
| | |
| | | MILD_ERR_ATTR_SYNTAX_LDAPSYNTAX_EXTENSION_INVALID_CHARACTER_327=The provided value "%s" could not be parsed as an ldap syntax extension because an invalid character was found at position %d |
| | | MILD_ERR_ATTR_SYNTAX_LDAPSYNTAX_EXPECTED_CLOSE_PARENTHESIS_328=The provided value "%s" could not be parsed as an ldap syntax description because a close parenthesis was expected at position %d but instead a '%s' character was found |
| | | MILD_ERR_ATTR_SYNTAX_LDAPSYNTAX_EXPECTED_QUOTE_AT_POS_329=The provided value "%s" could not be parsed as an ldap syntax description because a single quote was expected at position %d but the character %s was found instead |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_NOTVALID_330=The provided value is not a valid \ |
| | | X.509 Certificate |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_INVALID_VERSION_331=The provided value is not \ |
| | | a valid X.509 Certificate because it contains an invalid version number (%d) |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_INVALID_DER_332=The provided value is not a valid \ |
| | | X.509 Certificate because it contains invalid DER encodings |
| | |
| | | MILD_ERR_ATTR_SYNTAX_LDAPSYNTAX_EXTENSION_INVALID_CHARACTER_327=The provided value "%s" could not be parsed as an ldap syntax extension because an invalid character was found at position %d |
| | | MILD_ERR_ATTR_SYNTAX_LDAPSYNTAX_EXPECTED_CLOSE_PARENTHESIS_328=The provided value "%s" could not be parsed as an ldap syntax description because a close parenthesis was expected at position %d but instead a '%s' character was found |
| | | MILD_ERR_ATTR_SYNTAX_LDAPSYNTAX_EXPECTED_QUOTE_AT_POS_329=The provided value "%s" could not be parsed as an ldap syntax description because a single quote was expected at position %d but the character %s was found instead |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_NOTVALID_330=The provided value is not a valid \ |
| | | X.509 Certificate |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_INVALID_VERSION_331=The provided value is not \ |
| | | a valid X.509 Certificate because it contains an invalid version number (%d) |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_INVALID_DER_332=The provided value is not a valid \ |
| | | X.509 Certificate because it contains invalid DER encodings |
| | |
| | | MILD_ERR_ATTR_SYNTAX_LDAPSYNTAX_EXTENSION_INVALID_CHARACTER_327=The provided value "%s" could not be parsed as an ldap syntax extension because an invalid character was found at position %d |
| | | MILD_ERR_ATTR_SYNTAX_LDAPSYNTAX_EXPECTED_CLOSE_PARENTHESIS_328=The provided value "%s" could not be parsed as an ldap syntax description because a close parenthesis was expected at position %d but instead a '%s' character was found |
| | | MILD_ERR_ATTR_SYNTAX_LDAPSYNTAX_EXPECTED_QUOTE_AT_POS_329=The provided value "%s" could not be parsed as an ldap syntax description because a single quote was expected at position %d but the character %s was found instead |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_NOTVALID_330=The provided value is not a valid \ |
| | | X.509 Certificate |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_INVALID_VERSION_331=The provided value is not \ |
| | | a valid X.509 Certificate because it contains an invalid version number (%d) |
| | | SEVERE_ERR_SYNTAX_CERTIFICATE_INVALID_DER_332=The provided value is not a valid \ |
| | | X.509 Certificate because it contains invalid DER encodings |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.api; |
| | | import org.opends.messages.Message; |
| | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether this attribute syntax is a binary one. |
| | | * @return {@code true} if it is a binary syntax rule |
| | | * , or {@code false} if not. |
| | | * Indicates whether this attribute syntax requires BER encoding. |
| | | * |
| | | * @return {@code true} if this syntax required BER encoding. |
| | | */ |
| | | public abstract boolean isBinary(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether this attribute syntax is human readable. |
| | | * |
| | | * @return {@code true} if this syntax is human readable. |
| | | */ |
| | | public abstract boolean isHumanReadable(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the hash code for this attribute syntax. It will be |
| | | * calculated as the sum of the characters in the OID. |
| | | * |
| | |
| | | return false; |
| | | } |
| | | |
| | | return getOID().equals(((AttributeSyntax) o).getOID()); |
| | | return getOID().equals(((AttributeSyntax<?>) o).getOID()); |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS. |
| | | * Portions copyright 2011-2012 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.protocols.asn1; |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void readEndExplicitTag() throws ASN1Exception { |
| | | reader.readEndExplicitTag(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void readEndSequence() throws ASN1Exception { |
| | | reader.readEndSequence(); |
| | | } |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void readStartExplicitTag() throws ASN1Exception { |
| | | reader.readStartExplicitTag(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void readStartSequence() throws ASN1Exception { |
| | | reader.readStartSequence(); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 Forgerock AS |
| | | */ |
| | | package org.opends.server.protocols.asn1; |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void readStartExplicitTag() throws ASN1Exception |
| | | { |
| | | // From an implementation point of view, an explicit tag is equivalent to a |
| | | // sequence, as it is a constructed type. |
| | | readStartSequence(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void readStartSet() throws ASN1Exception |
| | | { |
| | | // From an implementation point of view, a set is equivalent to a |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void readEndExplicitTag() throws ASN1Exception |
| | | { |
| | | // From an implementation point of view, an explicit tag is equivalent to a |
| | | // sequence, as it is also a constructed type. |
| | | readEndSequence(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void readEndSet() throws ASN1Exception |
| | | { |
| | | // From an implementation point of view, a set is equivalent to a |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 Forgerock AS |
| | | */ |
| | | package org.opends.server.protocols.asn1; |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * The BER type that is assigned to the universal bit string type. |
| | | */ |
| | | public static final byte UNIVERSAL_BIT_STRING_TYPE = 0x03; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The BER type that is assigned to the universal octet string type. |
| | | */ |
| | | public static final byte UNIVERSAL_OCTET_STRING_TYPE = 0x04; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.asn1; |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void readStartExplicitTag() throws ASN1Exception |
| | | { |
| | | // From an implementation point of view, an explicit tag is equivalent to a |
| | | // sequence, as it is also a constructed type. |
| | | readStartSequence(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void readStartSet() throws ASN1Exception |
| | | { |
| | | // From an implementation point of view, a set is equivalent to a |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void readEndExplicitTag() throws ASN1Exception |
| | | { |
| | | // From an implementation point of view, an explicit tag is equivalent to a |
| | | // sequence, as it is also a constructed type. |
| | | readEndSequence(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void readEndSet() throws ASN1Exception |
| | | { |
| | | // From an implementation point of view, a set is equivalent to a |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 Forgerock AS |
| | | */ |
| | | package org.opends.server.protocols.asn1; |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * Finishes reading an explicit tag. Any elements not read in the |
| | | * explicit tag will be discarded. |
| | | * |
| | | * @throws ASN1Exception |
| | | * If an error occurs while advancing to the end of the |
| | | * explicit tag. |
| | | */ |
| | | void readEndExplicitTag() throws ASN1Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Finishes reading a sequence. Any elements not read in the |
| | | * sequence will be discarded. |
| | | * |
| | |
| | | |
| | | |
| | | /** |
| | | * Reads the next ASN.1 element as an explicit tag. All further |
| | | * reads will read the elements in the explicit tag until |
| | | * {@link #readEndExplicitTag()} is called. |
| | | * |
| | | * @throws ASN1Exception |
| | | * If the next element is not an explicit tag. |
| | | */ |
| | | void readStartExplicitTag() throws ASN1Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Reads the next ASN.1 element as a sequence. All further reads |
| | | * will read the elements in the sequence until |
| | | * {@link #readEndSequence()} is called. |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | import org.opends.messages.Message; |
| | |
| | | List<String> typeNames = new LinkedList<String>(); |
| | | String description = null; |
| | | AttributeType superiorType = null; |
| | | AttributeSyntax syntax = DirectoryServer.getDefaultAttributeSyntax(); |
| | | AttributeSyntax<?> syntax = DirectoryServer.getDefaultAttributeSyntax(); |
| | | ApproximateMatchingRule approximateMatchingRule = null; |
| | | EqualityMatchingRule equalityMatchingRule = null; |
| | | OrderingMatchingRule orderingMatchingRule = null; |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.schema; |
| | | import org.opends.messages.Message; |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | import org.opends.messages.Message; |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 Forgerock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | | |
| | | |
| | | import org.opends.server.admin.std.server.AttributeSyntaxCfg; |
| | | import java.util.List; |
| | | |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.CertificateAttributeSyntaxCfg; |
| | | import org.opends.server.api.ApproximateMatchingRule; |
| | | import org.opends.server.api.AttributeSyntax; |
| | | import org.opends.server.api.EqualityMatchingRule; |
| | |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.ByteSequence; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.ResultCode; |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | |
| | | import static org.opends.server.loggers.ErrorLogger.*; |
| | | import static org.opends.messages.SchemaMessages.*; |
| | | |
| | | import org.opends.messages.Message; |
| | | import org.opends.messages.MessageBuilder; |
| | | import static org.opends.server.schema.SchemaConstants.*; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants.*; |
| | | |
| | | |
| | | /** |
| | |
| | | * bytes. It will be treated much like the octet string attribute syntax. |
| | | */ |
| | | public class CertificateSyntax |
| | | extends AttributeSyntax<AttributeSyntaxCfg> |
| | | extends AttributeSyntax<CertificateAttributeSyntaxCfg> |
| | | implements ConfigurationChangeListener<CertificateAttributeSyntaxCfg> |
| | | { |
| | | // The default equality matching rule for this syntax. |
| | | private EqualityMatchingRule defaultEqualityMatchingRule; |
| | |
| | | // The default substring matching rule for this syntax. |
| | | private SubstringMatchingRule defaultSubstringMatchingRule; |
| | | |
| | | // The current configuration. |
| | | private volatile CertificateAttributeSyntaxCfg config; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void initializeSyntax(AttributeSyntaxCfg configuration) |
| | | public void initializeSyntax(CertificateAttributeSyntaxCfg configuration) |
| | | throws ConfigException |
| | | { |
| | | defaultEqualityMatchingRule = |
| | |
| | | logError(ERR_ATTR_SYNTAX_UNKNOWN_SUBSTRING_MATCHING_RULE.get( |
| | | SMR_OCTET_STRING_OID, SYNTAX_CERTIFICATE_NAME)); |
| | | } |
| | | |
| | | this.config = configuration; |
| | | config.addCertificateChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isConfigurationChangeAcceptable( |
| | | CertificateAttributeSyntaxCfg configuration, |
| | | List<Message> unacceptableReasons) |
| | | { |
| | | // The configuration is always acceptable. |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | CertificateAttributeSyntaxCfg configuration) |
| | | { |
| | | this.config = configuration; |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | } |
| | | |
| | | |
| | |
| | | public boolean valueIsAcceptable(ByteSequence value, |
| | | MessageBuilder invalidReason) |
| | | { |
| | | // All values will be acceptable for the certificate syntax. |
| | | // Skip validation if strict validation is disabled. |
| | | if (!config.isStrictFormat()) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | // Validate the ByteSequence against the definitions of X.509, clause 7 |
| | | long x509Version=0; |
| | | ASN1Reader reader = ASN1.getReader(value); |
| | | try |
| | | { |
| | | // Certificate SIGNED SEQUENCE |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_SEQUENCE_TYPE) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | | } |
| | | reader.readStartSequence(); |
| | | |
| | | // CertificateContent SEQUENCE |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_SEQUENCE_TYPE) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | | } |
| | | reader.readStartSequence(); |
| | | |
| | | // Optional Version |
| | | if (reader.hasNextElement() && |
| | | reader.peekType() == (TYPE_MASK_CONTEXT | TYPE_MASK_CONSTRUCTED)) |
| | | { |
| | | reader.readStartExplicitTag(); |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_INTEGER_TYPE) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | | } |
| | | x509Version=reader.readInteger(); |
| | | if (x509Version < 0 || x509Version >2) |
| | | { |
| | | // invalid Version specified |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_INVALID_VERSION |
| | | .get(x509Version)); |
| | | return false; |
| | | } |
| | | if (x509Version == 0) |
| | | { |
| | | // DEFAULT values shall not be included in DER encoded SEQUENCE |
| | | // (X.690, 11.5) |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_INVALID_DER.get()); |
| | | return false; |
| | | } |
| | | reader.readEndExplicitTag(); |
| | | } |
| | | |
| | | // serialNumber |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_INTEGER_TYPE) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | | } |
| | | reader.skipElement(); |
| | | |
| | | // signature AlgorithmIdentifier |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_SEQUENCE_TYPE) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | | } |
| | | reader.skipElement(); |
| | | |
| | | // issuer name (SEQUENCE as of X.501, 9.2) |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_SEQUENCE_TYPE) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | | } |
| | | reader.skipElement(); |
| | | |
| | | // validity (SEQUENCE) |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_SEQUENCE_TYPE) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | | } |
| | | reader.skipElement(); |
| | | |
| | | // subject name (SEQUENCE as of X.501, 9.2) |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_SEQUENCE_TYPE) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | | } |
| | | reader.skipElement(); |
| | | |
| | | // SubjectPublicKeyInfo (SEQUENCE) |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_SEQUENCE_TYPE) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | | } |
| | | reader.skipElement(); |
| | | |
| | | // OPTIONAL issuerUniqueIdentifier |
| | | if (reader.hasNextElement() && |
| | | reader.peekType() == (TYPE_MASK_CONTEXT + 1)) |
| | | { |
| | | if (x509Version < 1) |
| | | { |
| | | // only valid in v2 and v3 |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | | } |
| | | reader.skipElement(); |
| | | } |
| | | |
| | | // OPTIONAL subjectUniqueIdentifier |
| | | if (reader.hasNextElement() && |
| | | reader.peekType() == (TYPE_MASK_CONTEXT + 2)) |
| | | { |
| | | if (x509Version < 1) |
| | | { |
| | | // only valid in v2 and v3 |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | | } |
| | | reader.skipElement(); |
| | | } |
| | | |
| | | // OPTIONAL extensions |
| | | if (reader.hasNextElement() && |
| | | reader.peekType() == ((TYPE_MASK_CONTEXT|TYPE_MASK_CONSTRUCTED) + 3)) |
| | | { |
| | | if (x509Version < 2) |
| | | { |
| | | // only valid in v3 |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | | } |
| | | reader.readStartExplicitTag(); // read Tag |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_SEQUENCE_TYPE) |
| | | { |
| | | // only valid in v3 |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | | } |
| | | reader.readEndExplicitTag(); // read end Tag |
| | | } |
| | | |
| | | // There should not be any further ASN.1 elements within this SEQUENCE |
| | | if (reader.hasNextElement()) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | | } |
| | | reader.readEndSequence(); // End CertificateContent SEQUENCE |
| | | |
| | | // AlgorithmIdentifier SEQUENCE |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_SEQUENCE_TYPE) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | | } |
| | | reader.skipElement(); |
| | | |
| | | // ENCRYPTED HASH BIT STRING |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_BIT_STRING_TYPE) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | | } |
| | | reader.skipElement(); |
| | | |
| | | // There should not be any further ASN.1 elements within this SEQUENCE |
| | | if (reader.hasNextElement()) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | | } |
| | | reader.readEndSequence(); // End Certificate SEQUENCE |
| | | |
| | | // There should not be any further ASN.1 elements |
| | | if (reader.hasNextElement()) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | | } |
| | | // End of the certificate |
| | | } |
| | | catch (ASN1Exception e) |
| | | { |
| | | System.out.println(e.getMessageObject()); |
| | | invalidReason.append(e.getMessageObject()); |
| | | return false; |
| | | } |
| | | |
| | | // The basic structure of the value is an X.509 certificate |
| | | return true; |
| | | } |
| | | |
| | |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | import org.opends.messages.Message; |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | import org.opends.messages.Message; |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | import org.opends.messages.Message; |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2009 D. J. Hagberg, Millibits Consulting, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | import org.opends.messages.Message; |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | StringBuilder woidBuffer = new StringBuilder(); |
| | | pos = readQuotedString(valueStr, woidBuffer, pos); |
| | | String syntaxOID = toLowerCase(woidBuffer.toString()); |
| | | AttributeSyntax subSyntax = schema.getSyntax(syntaxOID); |
| | | AttributeSyntax<?> subSyntax = schema.getSyntax(syntaxOID); |
| | | if (subSyntax == null) |
| | | { |
| | | Message message = ERR_ATTR_SYNTAX_LDAPSYNTAX_UNKNOWN_SYNTAX.get( |
| | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class provides a substitution mechanism where one unimplemented |
| | | * syntax can be substituted by another defined syntax. A substitution syntax |
| | | * is an LDAPSyntaxDescriptionSyntax with X-SUBST extension. |
| | |
| | | LDAPSyntaxDescriptionSyntax |
| | | { |
| | | // The syntax that will subsittute the unimplemented syntax. |
| | | private AttributeSyntax subSyntax; |
| | | private AttributeSyntax<?> subSyntax; |
| | | |
| | | // The description of this syntax. |
| | | private String description; |
| | |
| | | |
| | | |
| | | //Creates a new instance of this syntax. |
| | | private SubstitutionSyntax(AttributeSyntax subSyntax, |
| | | private SubstitutionSyntax(AttributeSyntax<?> subSyntax, |
| | | String definition, |
| | | String description, |
| | | String oid) |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | import org.opends.messages.Message; |
| | |
| | | // for everything else we might need to know. |
| | | ConcurrentHashMap<String,String> names = |
| | | new ConcurrentHashMap<String,String>(); |
| | | AttributeSyntax syntax = null; |
| | | AttributeSyntax<?> syntax = null; |
| | | ConcurrentHashMap<String,CopyOnWriteArrayList<String>> extraProperties = |
| | | new ConcurrentHashMap<String,CopyOnWriteArrayList<String>>(); |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | import org.opends.messages.Message; |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | import org.opends.messages.Message; |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | import org.opends.messages.Message; |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS |
| | | * Portions copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | import org.opends.messages.Message; |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | import org.opends.messages.Message; |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | private final ApproximateMatchingRule approximateMatchingRule; |
| | | |
| | | // The syntax for this attribute type. |
| | | private final AttributeSyntax syntax; |
| | | private final AttributeSyntax<?> syntax; |
| | | |
| | | // The superior attribute type from which this attribute type |
| | | // inherits. |
| | |
| | | Collection<String> typeNames, |
| | | String oid, String description, |
| | | AttributeType superiorType, |
| | | AttributeSyntax syntax, |
| | | AttributeSyntax<?> syntax, |
| | | AttributeUsage attributeUsage, |
| | | boolean isCollective, |
| | | boolean isNoUserModification, |
| | |
| | | Collection<String> typeNames, |
| | | String oid, String description, |
| | | AttributeType superiorType, |
| | | AttributeSyntax syntax, |
| | | AttributeSyntax<?> syntax, |
| | | ApproximateMatchingRule |
| | | approximateMatchingRule, |
| | | EqualityMatchingRule equalityMatchingRule, |
| | |
| | | * |
| | | * @return The syntax for this attribute type. |
| | | */ |
| | | public AttributeSyntax getSyntax() |
| | | public AttributeSyntax<?> getSyntax() |
| | | { |
| | | return syntax; |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether this attribute syntax is a binary one. |
| | | * @return {@code true} if it is a binary syntax rule |
| | | * , or {@code false} if not. |
| | | * Indicates whether this attribute syntax requires BER encoding. |
| | | * |
| | | * @return {@code true} if this syntax required BER encoding. |
| | | */ |
| | | public boolean isBinary() |
| | | { |
| | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether this attribute syntax is human readable. |
| | | * |
| | | * @return {@code true} if this syntax is human readable. |
| | | */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return syntax.isHumanReadable(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the OID for this syntax associated with this attribute |
| | | * type. |
| | | * |
| | |
| | | { |
| | | if (! syntax.valueIsAcceptable(v.getValue(), invalidReason)) |
| | | { |
| | | Message message = WARN_ADD_OP_INVALID_SYNTAX.get( |
| | | if (!syntax.isHumanReadable() || syntax.isBinary()) |
| | | { |
| | | // Value is not human-readable |
| | | Message message = WARN_ADD_OP_INVALID_SYNTAX_NO_VALUE.get( |
| | | String.valueOf(entryDN), |
| | | String.valueOf(a.getName()), |
| | | String.valueOf(invalidReason)); |
| | | |
| | | throw new DirectoryException( |
| | | ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | message); |
| | | } |
| | | else |
| | | { |
| | | Message message = WARN_ADD_OP_INVALID_SYNTAX.get( |
| | | String.valueOf(entryDN), |
| | | String.valueOf(v.getValue().toString()), |
| | | String.valueOf(a.getName()), |
| | | String.valueOf(invalidReason)); |
| | | |
| | | throw new DirectoryException( |
| | | throw new DirectoryException( |
| | | ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | if (! syntax.valueIsAcceptable(v.getValue(), |
| | | invalidReason)) |
| | | { |
| | | Message message = WARN_ADD_OP_INVALID_SYNTAX. |
| | | if (!syntax.isHumanReadable() || syntax.isBinary()) |
| | | { |
| | | // Value is not human-readable |
| | | Message message = WARN_ADD_OP_INVALID_SYNTAX_NO_VALUE. |
| | | get(String.valueOf(entryDN), |
| | | String.valueOf(a.getName()), |
| | | String.valueOf(invalidReason)); |
| | | |
| | | throw new DirectoryException( |
| | | ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | message); |
| | | } |
| | | else |
| | | { |
| | | Message message = WARN_ADD_OP_INVALID_SYNTAX. |
| | | get(String.valueOf(entryDN), |
| | | String.valueOf(v.getValue().toString()), |
| | | String.valueOf(a.getName()), |
| | | String.valueOf(invalidReason)); |
| | | |
| | | throw new DirectoryException( |
| | | throw new DirectoryException( |
| | | ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | if (! syntax.valueIsAcceptable(v.getValue(), |
| | | invalidReason)) |
| | | { |
| | | logError(WARN_ADD_OP_INVALID_SYNTAX.get( |
| | | if (!syntax.isHumanReadable() || syntax.isBinary()) |
| | | { |
| | | // Value is not human-readable |
| | | logError(WARN_ADD_OP_INVALID_SYNTAX_NO_VALUE.get( |
| | | String.valueOf(entryDN), |
| | | String.valueOf(a.getName()), |
| | | String.valueOf(invalidReason))); |
| | | } |
| | | else |
| | | { |
| | | logError(WARN_ADD_OP_INVALID_SYNTAX.get( |
| | | String.valueOf(entryDN), |
| | | String.valueOf(v.getValue().toString()), |
| | | String.valueOf(a.getName()), |
| | | String.valueOf(invalidReason))); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | if (! syntax.valueIsAcceptable(v.getValue(), |
| | | invalidReason)) |
| | | { |
| | | logError(WARN_ADD_OP_INVALID_SYNTAX.get( |
| | | if (!syntax.isHumanReadable() || syntax.isBinary()) |
| | | { |
| | | // Value is not human-readable |
| | | logError(WARN_ADD_OP_INVALID_SYNTAX_NO_VALUE.get( |
| | | String.valueOf(entryDN), |
| | | String.valueOf(a.getName()), |
| | | String.valueOf(invalidReason))); |
| | | } |
| | | else |
| | | { |
| | | logError(WARN_ADD_OP_INVALID_SYNTAX.get( |
| | | String.valueOf(entryDN), |
| | | String.valueOf(v.getValue().toString()), |
| | | String.valueOf(a.getName()), |
| | | String.valueOf(invalidReason))); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | if (!syntax.valueIsAcceptable(v.getValue(), invalidReason)) |
| | | { |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | if (!syntax.isHumanReadable() || syntax.isBinary()) |
| | | { |
| | | // Value is not human-readable |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | ERR_MODIFY_ADD_INVALID_SYNTAX_NO_VALUE.get( |
| | | String.valueOf(entryDN), attr.getName(), invalidReason)); |
| | | } |
| | | else |
| | | { |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | ERR_MODIFY_ADD_INVALID_SYNTAX.get(String.valueOf(entryDN), attr |
| | | .getName(), v.getValue().toString(), invalidReason)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | if (!syntax.valueIsAcceptable(v.getValue(), invalidReason)) |
| | | { |
| | | setResultCode(ResultCode.INVALID_ATTRIBUTE_SYNTAX); |
| | | logError(ERR_MODIFY_ADD_INVALID_SYNTAX.get(String.valueOf(entryDN), |
| | | attr.getName(), v.getValue().toString(), invalidReason)); |
| | | if (!syntax.isHumanReadable() || syntax.isBinary()) |
| | | { |
| | | // Value is not human-readable |
| | | logError(ERR_MODIFY_ADD_INVALID_SYNTAX_NO_VALUE.get( |
| | | String.valueOf(entryDN), attr.getName(), invalidReason)); |
| | | } |
| | | else |
| | | { |
| | | logError(ERR_MODIFY_ADD_INVALID_SYNTAX.get(String |
| | | .valueOf(entryDN), attr.getName(), v.getValue().toString(), |
| | | invalidReason)); |
| | | } |
| | | invalidReason = new MessageBuilder(); |
| | | } |
| | | } |
| | |
| | | { |
| | | if (!syntax.valueIsAcceptable(v.getValue(), invalidReason)) |
| | | { |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | if (!syntax.isHumanReadable() || syntax.isBinary()) |
| | | { |
| | | // Value is not human-readable |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | ERR_MODIFY_REPLACE_INVALID_SYNTAX_NO_VALUE.get( |
| | | String.valueOf(entryDN), attr.getName(), invalidReason)); |
| | | } |
| | | else |
| | | { |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | ERR_MODIFY_REPLACE_INVALID_SYNTAX.get(String.valueOf(entryDN), |
| | | attr.getName(), v.getValue().toString(), invalidReason)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | if (!syntax.valueIsAcceptable(v.getValue(), invalidReason)) |
| | | { |
| | | setResultCode(ResultCode.INVALID_ATTRIBUTE_SYNTAX); |
| | | logError(ERR_MODIFY_REPLACE_INVALID_SYNTAX.get(String |
| | | .valueOf(entryDN), attr.getName(), v.getValue().toString(), |
| | | invalidReason)); |
| | | if (!syntax.isHumanReadable() || syntax.isBinary()) |
| | | { |
| | | // Value is not human-readable |
| | | logError(ERR_MODIFY_REPLACE_INVALID_SYNTAX_NO_VALUE.get(String |
| | | .valueOf(entryDN), attr.getName(), invalidReason)); |
| | | } |
| | | else |
| | | { |
| | | logError(ERR_MODIFY_REPLACE_INVALID_SYNTAX.get(String |
| | | .valueOf(entryDN), attr.getName(), v.getValue().toString(), |
| | | invalidReason)); |
| | | } |
| | | invalidReason = new MessageBuilder(); |
| | | } |
| | | } |
| | |
| | | import org.opends.server.tools.LDAPModify; |
| | | import org.opends.server.tools.LDAPWriter; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.util.Base64; |
| | | import org.opends.server.util.ServerConstants; |
| | | import org.opends.server.workflowelement.localbackend.LocalBackendModifyOperation; |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | String certificateValue = |
| | | "MIICpTCCAg6gAwIBAgIJALeoA6I3ZC/cMA0GCSqGSIb3DQEBBQUAMFYxCzAJBgNV" + |
| | | "BAYTAlVTMRMwEQYDVQQHEwpDdXBlcnRpb25lMRwwGgYDVQQLExNQcm9kdWN0IERl" + |
| | | "dmVsb3BtZW50MRQwEgYDVQQDEwtCYWJzIEplbnNlbjAeFw0xMjA1MDIxNjM0MzVa" + |
| | | "Fw0xMjEyMjExNjM0MzVaMFYxCzAJBgNVBAYTAlVTMRMwEQYDVQQHEwpDdXBlcnRp" + |
| | | "b25lMRwwGgYDVQQLExNQcm9kdWN0IERldmVsb3BtZW50MRQwEgYDVQQDEwtCYWJz" + |
| | | "IEplbnNlbjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEApysa0c9qc8FB8gIJ" + |
| | | "8zAb1pbJ4HzC7iRlVGhRJjFORkGhyvU4P5o2wL0iz/uko6rL9/pFhIlIMbwbV8sm" + |
| | | "mKeNUPitwiKOjoFDmtimcZ4bx5UTAYLbbHMpEdwSpMC5iF2UioM7qdiwpAfZBd6Z" + |
| | | "69vqNxuUJ6tP+hxtr/aSgMH2i8ECAwEAAaN7MHkwCQYDVR0TBAIwADAsBglghkgB" + |
| | | "hvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYE" + |
| | | "FLlZD3aKDa8jdhzoByOFMAJDs2osMB8GA1UdIwQYMBaAFLlZD3aKDa8jdhzoByOF" + |
| | | "MAJDs2osMA0GCSqGSIb3DQEBBQUAA4GBAE5vccY8Ydd7by2bbwiDKgQqVyoKrkUg" + |
| | | "6CD0WRmc2pBeYX2z94/PWO5L3Fx+eIZh2wTxScF+FdRWJzLbUaBuClrxuy0Y5ifj" + |
| | | "axuJ8LFNbZtsp1ldW3i84+F5+SYT+xI67ZcoAtwx/VFVI9s5I/Gkmu9f9nxjPpK7" + |
| | | "1AIUXiE3Qcck"; |
| | | |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(); |
| | | values.add(ByteString.valueOf("2468")); |
| | | values.add(ByteString.wrap(Base64.decode(certificateValue))); |
| | | LDAPAttribute attr = new LDAPAttribute("usercertificate", values); |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(); |
| | | mods.add(new LDAPModification(ModificationType.ADD, attr)); |
| | |
| | | Attribute a = attrList.get(0); |
| | | assertTrue(a.hasOption("binary")); |
| | | assertEquals(a.size(), 1); |
| | | assertEquals(a.iterator().next().getValue().toString(), "2468"); |
| | | assertEquals(Base64.encode(a.iterator().next().getValue()), certificateValue); |
| | | } |
| | | |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 Forgerock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | String Certificate = |
| | | "MIICpTCCAg6gAwIBAgIJALeoA6I3ZC/cMA0GCSqGSIb3DQEBBQUAMFYxCzAJBgNV" + |
| | | "BAYTAlVTMRMwEQYDVQQHEwpDdXBlcnRpb25lMRwwGgYDVQQLExNQcm9kdWN0IERl" + |
| | | "dmVsb3BtZW50MRQwEgYDVQQDEwtCYWJzIEplbnNlbjAeFw0xMjA1MDIxNjM0MzVa" + |
| | | "Fw0xMjEyMjExNjM0MzVaMFYxCzAJBgNVBAYTAlVTMRMwEQYDVQQHEwpDdXBlcnRp" + |
| | | "b25lMRwwGgYDVQQLExNQcm9kdWN0IERldmVsb3BtZW50MRQwEgYDVQQDEwtCYWJz" + |
| | | "IEplbnNlbjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEApysa0c9qc8FB8gIJ" + |
| | | "8zAb1pbJ4HzC7iRlVGhRJjFORkGhyvU4P5o2wL0iz/uko6rL9/pFhIlIMbwbV8sm" + |
| | | "mKeNUPitwiKOjoFDmtimcZ4bx5UTAYLbbHMpEdwSpMC5iF2UioM7qdiwpAfZBd6Z" + |
| | | "69vqNxuUJ6tP+hxtr/aSgMH2i8ECAwEAAaN7MHkwCQYDVR0TBAIwADAsBglghkgB" + |
| | | "hvhCAQ0EHxYdSW52YWxpZCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYE" + |
| | | "FLlZD3aKDa8jdhzoByOFMAJDs2osMB8GA1UdIwQYMBaAFLlZD3aKDa8jdhzoByOF" + |
| | | "MAJDs2osMA0GCSqGSIb3DQEBBQUAA4GBAE5vccY8Ydd7by2bbwiDKgQqVyoKrkUg" + |
| | | "6CD0WRmc2pBeYX2z94/PWO5L3Fx+eIZh2wTxScF+FdRWJzLbUaBuClrxuy0Y5ifj" + |
| | | "axuJ8LFNbZtsp1ldW3i84+F5+SYT+xI67ZcoAtwx/VFVI9s5I/Gkmu9f9nxjPpK7" + |
| | | "1AIUXiE3Qcck"; |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | |
| | | "cn: Test User", |
| | | "givenName: Test", |
| | | "sn: User", |
| | | "userCertificate;binary: invalid"); |
| | | "userCertificate;binary:: " + Certificate); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | String Certificate = |
| | | "MIICpTCCAg6gAwIBAgIJALeoA6I3ZC/cMA0GCSqGSIb3DQEBBQUAMFYxCzAJBgNV" + |
| | | "BAYTAlVTMRMwEQYDVQQHEwpDdXBlcnRpb25lMRwwGgYDVQQLExNQcm9kdWN0IERl" + |
| | | "dmVsb3BtZW50MRQwEgYDVQQDEwtCYWJzIEplbnNlbjAeFw0xMjA1MDIxNjM0MzVa" + |
| | | "Fw0xMjEyMjExNjM0MzVaMFYxCzAJBgNVBAYTAlVTMRMwEQYDVQQHEwpDdXBlcnRp" + |
| | | "b25lMRwwGgYDVQQLExNQcm9kdWN0IERldmVsb3BtZW50MRQwEgYDVQQDEwtCYWJz" + |
| | | "IEplbnNlbjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEApysa0c9qc8FB8gIJ" + |
| | | "8zAb1pbJ4HzC7iRlVGhRJjFORkGhyvU4P5o2wL0iz/uko6rL9/pFhIlIMbwbV8sm" + |
| | | "mKeNUPitwiKOjoFDmtimcZ4bx5UTAYLbbHMpEdwSpMC5iF2UioM7qdiwpAfZBd6Z" + |
| | | "69vqNxuUJ6tP+hxtr/aSgMH2i8ECAwEAAaN7MHkwCQYDVR0TBAIwADAsBglghkgB" + |
| | | "hvhCAQ0EHxYdSW52YWxpZCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYE" + |
| | | "FLlZD3aKDa8jdhzoByOFMAJDs2osMB8GA1UdIwQYMBaAFLlZD3aKDa8jdhzoByOF" + |
| | | "MAJDs2osMA0GCSqGSIb3DQEBBQUAA4GBAE5vccY8Ydd7by2bbwiDKgQqVyoKrkUg" + |
| | | "6CD0WRmc2pBeYX2z94/PWO5L3Fx+eIZh2wTxScF+FdRWJzLbUaBuClrxuy0Y5ifj" + |
| | | "axuJ8LFNbZtsp1ldW3i84+F5+SYT+xI67ZcoAtwx/VFVI9s5I/Gkmu9f9nxjPpK7" + |
| | | "1AIUXiE3Qcck"; |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | |
| | | "cn: Test User", |
| | | "givenName: Test", |
| | | "sn: User", |
| | | "userCertificate;binary: invalid"); |
| | | "userCertificate;binary:: " + Certificate); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 Forgerock AS |
| | | */ |
| | | |
| | | package org.opends.server.protocols.ldap; |
| | |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.tools.*; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.util.Base64; |
| | | import org.testng.annotations.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | |
| | | |
| | | //Constant value of userCertificate attribute. |
| | | private static final String CERT= |
| | | ": MIIB5TCCAU6gAwIBAgIERloIajANBgkqhkiG9" + |
| | | "MIIB5TCCAU6gAwIBAgIERloIajANBgkqhkiG9" + |
| | | "w0BAQUFADA3MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRXhhbXBs" + |
| | | "ZSBDb3JwMREwDwYDVQQDEwhKb2huIERvZTAeFw0wNzA1MjcyMjM4" + |
| | | "MzRaFw0wNzA4MjUyMjM4MzRaMDcxCzAJBgNVBAYTAlVTMRUwEwYD" + |
| | |
| | | "uid: user.1", |
| | | "sn: 1", |
| | | "cn: user 1", |
| | | "userCertificate"+CERT |
| | | "userCertificate:: "+CERT |
| | | ); |
| | | String[] args = new String [] |
| | | { |
| | |
| | | "uid: user.2", |
| | | "sn: 2", |
| | | "cn: user 2", |
| | | "userCertificate;binary"+CERT |
| | | "userCertificate;binary:: "+CERT |
| | | ); |
| | | args = new String [] |
| | | { |
| | |
| | | addAttrs.add(RawAttribute.create("sn", "sn#1")); |
| | | addAttrs.add(RawAttribute.create("sn;x-foo", "sn#2")); |
| | | addAttrs.add(RawAttribute.create("sn;lang-fr", "sn#3")); |
| | | addAttrs.add(RawAttribute.create("userCertificate;binary", CERT)); |
| | | addAttrs.add(RawAttribute.create("userCertificate;binary", |
| | | ByteString.wrap(Base64.decode(CERT)))); |
| | | |
| | | AddRequestProtocolOp addRequest = |
| | | new AddRequestProtocolOp(ByteString.valueOf("uid=user.7,o=test"), |
| | |
| | | "dn: uid=user.4,o=test", |
| | | "changetype: modify", |
| | | "add: usercertificate;binary", |
| | | "userCertificate;binary" + CERT); |
| | | "userCertificate;binary:: " + CERT); |
| | | args = new String[] |
| | | { |
| | | "-h", "127.0.0.1", |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 Forgerock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | import org.opends.server.api.AttributeSyntax; |
| | | import org.opends.server.types.ByteString; |
| | | import org.opends.messages.MessageBuilder; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | public abstract class BinaryAttributeSyntaxTest extends SchemaTestCase |
| | | { |
| | | /** |
| | | * Create data for the testAcceptableValues test. |
| | | * This should be a table of tables with 2 elements. |
| | | * The first one should be the value to test, the second the expected |
| | | * result of the test. |
| | | * |
| | | * @return a table containing data for the testAcceptableValues Test. |
| | | */ |
| | | @DataProvider(name="acceptableValues") |
| | | public abstract Object[][] createAcceptableValues(); |
| | | |
| | | /** |
| | | * Get an instance of the attribute syntax that muste be tested. |
| | | * |
| | | * @return An instance of the attribute syntax that muste be tested. |
| | | */ |
| | | protected abstract AttributeSyntax getRule(); |
| | | |
| | | /** |
| | | * Test the normalization and the approximate comparison. |
| | | */ |
| | | @Test(dataProvider= "acceptableValues") |
| | | public void testAcceptableValues(ByteString value, Boolean result) |
| | | throws Exception |
| | | { |
| | | // Make sure that the specified class can be instantiated as a task. |
| | | AttributeSyntax syntax = getRule(); |
| | | |
| | | MessageBuilder reason = new MessageBuilder(); |
| | | // test the valueIsAcceptable method |
| | | Boolean liveResult = |
| | | syntax.valueIsAcceptable(value, reason); |
| | | |
| | | if (liveResult != result) |
| | | fail(syntax + ".valueIsAcceptable gave bad result for " + value.toString() + |
| | | "reason : " + reason); |
| | | |
| | | // call the getters |
| | | syntax.getApproximateMatchingRule(); |
| | | syntax.getDescription(); |
| | | syntax.getEqualityMatchingRule(); |
| | | syntax.getOID(); |
| | | syntax.getOrderingMatchingRule(); |
| | | syntax.getSubstringMatchingRule(); |
| | | syntax.getSyntaxName(); |
| | | syntax.toString(); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 Forgerock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.AttributeSyntaxCfg; |
| | | import org.opends.server.admin.std.server.CertificateAttributeSyntaxCfg; |
| | | import org.opends.server.api.AttributeSyntax; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.opends.server.types.ByteString; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.util.Base64; |
| | | |
| | | /** |
| | | * Test the CertificateSyntax. |
| | | */ |
| | | public class CertificateSyntaxTest extends BinaryAttributeSyntaxTest |
| | | { |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | protected AttributeSyntax<?> getRule() |
| | | { |
| | | CertificateSyntax syntax = new CertificateSyntax(); |
| | | CertificateAttributeSyntaxCfg cfg = new CertificateAttributeSyntaxCfg() |
| | | { |
| | | public DN dn() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | public void removeChangeListener( |
| | | ConfigurationChangeListener<AttributeSyntaxCfg> listener) |
| | | { |
| | | // Stub. |
| | | } |
| | | |
| | | |
| | | |
| | | public boolean isEnabled() |
| | | { |
| | | // Stub. |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | public void addChangeListener( |
| | | ConfigurationChangeListener<AttributeSyntaxCfg> listener) |
| | | { |
| | | // Stub. |
| | | } |
| | | |
| | | |
| | | |
| | | public void removeCertificateChangeListener( |
| | | ConfigurationChangeListener<CertificateAttributeSyntaxCfg> listener) |
| | | { |
| | | // Stub. |
| | | } |
| | | |
| | | |
| | | |
| | | public boolean isStrictFormat() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | public String getJavaClass() |
| | | { |
| | | // Stub. |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | public Class<? extends CertificateAttributeSyntaxCfg> configurationClass() |
| | | { |
| | | // Stub. |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | public void addCertificateChangeListener( |
| | | ConfigurationChangeListener<CertificateAttributeSyntaxCfg> listener) |
| | | { |
| | | // Stub. |
| | | } |
| | | }; |
| | | |
| | | try |
| | | { |
| | | syntax.initializeSyntax(cfg); |
| | | } |
| | | catch (ConfigException e) |
| | | { |
| | | // Should never happen. |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | return syntax; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | @DataProvider(name="acceptableValues") |
| | | public Object[][] createAcceptableValues() |
| | | { |
| | | String validcert1 = |
| | | "MIICpTCCAg6gAwIBAgIJALeoA6I3ZC/cMA0GCSqGSIb3DQEBBQUAMFYxCzAJBgNV" + |
| | | "BAYTAlVTMRMwEQYDVQQHEwpDdXBlcnRpb25lMRwwGgYDVQQLExNQcm9kdWN0IERl" + |
| | | "dmVsb3BtZW50MRQwEgYDVQQDEwtCYWJzIEplbnNlbjAeFw0xMjA1MDIxNjM0MzVa" + |
| | | "Fw0xMjEyMjExNjM0MzVaMFYxCzAJBgNVBAYTAlVTMRMwEQYDVQQHEwpDdXBlcnRp" + |
| | | "b25lMRwwGgYDVQQLExNQcm9kdWN0IERldmVsb3BtZW50MRQwEgYDVQQDEwtCYWJz" + |
| | | "IEplbnNlbjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEApysa0c9qc8FB8gIJ" + |
| | | "8zAb1pbJ4HzC7iRlVGhRJjFORkGhyvU4P5o2wL0iz/uko6rL9/pFhIlIMbwbV8sm" + |
| | | "mKeNUPitwiKOjoFDmtimcZ4bx5UTAYLbbHMpEdwSpMC5iF2UioM7qdiwpAfZBd6Z" + |
| | | "69vqNxuUJ6tP+hxtr/aSgMH2i8ECAwEAAaN7MHkwCQYDVR0TBAIwADAsBglghkgB" + |
| | | "hvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYE" + |
| | | "FLlZD3aKDa8jdhzoByOFMAJDs2osMB8GA1UdIwQYMBaAFLlZD3aKDa8jdhzoByOF" + |
| | | "MAJDs2osMA0GCSqGSIb3DQEBBQUAA4GBAE5vccY8Ydd7by2bbwiDKgQqVyoKrkUg" + |
| | | "6CD0WRmc2pBeYX2z94/PWO5L3Fx+eIZh2wTxScF+FdRWJzLbUaBuClrxuy0Y5ifj" + |
| | | "axuJ8LFNbZtsp1ldW3i84+F5+SYT+xI67ZcoAtwx/VFVI9s5I/Gkmu9f9nxjPpK7" + |
| | | "1AIUXiE3Qcck"; |
| | | |
| | | String invalidcert1 = |
| | | "MIICpTCCAg6gAwIBBQIJALeoA6I3ZC/cMA0GCSqGSIb3DQEBBQUAMFYxCzAJBgNV" + |
| | | "BAYTAlVTMRMwEQYDVQQHEwpDdXBlcnRpb25lMRwwGgYDVQQLExNQcm9kdWN0IERl" + |
| | | "dmVsb3BtZW50MRQwEgYDVQQDEwtCYWJzIEplbnNlbjAeFw0xMjA1MDIxNjM0MzVa" + |
| | | "Fw0xMjEyMjExNjM0MzVaMFYxCzAJBgNVBAYTAlVTMRMwEQYDVQQHEwpDdXBlcnRp" + |
| | | "b25lMRwwGgYDVQQLExNQcm9kdWN0IERldmVsb3BtZW50MRQwEgYDVQQDEwtCYWJz" + |
| | | "IEplbnNlbjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEApysa0c9qc8FB8gIJ" + |
| | | "8zAb1pbJ4HzC7iRlVGhRJjFORkGhyvU4P5o2wL0iz/uko6rL9/pFhIlIMbwbV8sm" + |
| | | "mKeNUPitwiKOjoFDmtimcZ4bx5UTAYLbbHMpEdwSpMC5iF2UioM7qdiwpAfZBd6Z" + |
| | | "69vqNxuUJ6tP+hxtr/aSgMH2i8ECAwEAAaN7MHkwCQYDVR0TBAIwADAsBglghkgB" + |
| | | "hvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYE" + |
| | | "FLlZD3aKDa8jdhzoByOFMAJDs2osMB8GA1UdIwQYMBaAFLlZD3aKDa8jdhzoByOF" + |
| | | "MAJDs2osMA0GCSqGSIb3DQEBBQUAA4GBAE5vccY8Ydd7by2bbwiDKgQqVyoKrkUg" + |
| | | "6CD0WRmc2pBeYX2z94/PWO5L3Fx+eIZh2wTxScF+FdRWJzLbUaBuClrxuy0Y5ifj" + |
| | | "axuJ8LFNbZtsp1ldW3i84+F5+SYT+xI67ZcoAtwx/VFVI9s5I/Gkmu9f9nxjPpK7" + |
| | | "1AIUXiE3Qcck"; |
| | | |
| | | String brokencert1 = |
| | | "MIICpTCCAg6gAwIBAgIJALeoA6I3ZC/cMA0GCSqGSIb3DQEBBQUAMFYxCzAJBgNV"; |
| | | |
| | | try { |
| | | return new Object [][] { |
| | | {ByteString.wrap(Base64.decode(validcert1)), true}, |
| | | {ByteString.valueOf(validcert1), false}, |
| | | {ByteString.wrap(Base64.decode(invalidcert1)), false}, |
| | | {ByteString.wrap(Base64.decode(brokencert1)), false}, |
| | | {ByteString.valueOf("invalid"), false} |
| | | }; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return new Object[][] {}; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |