Class TLcdS63ModelDecoder

java.lang.Object
com.luciad.format.s57.TLcdS57ModelDecoder
com.luciad.format.s63.TLcdS63ModelDecoder
All Implemented Interfaces:
ILcdMetadataDecoder, ILcdInputStreamFactoryCapable, ILcdModelDecoder, ILcdCloneable, Cloneable

public class TLcdS63ModelDecoder extends TLcdS57ModelDecoder
This ILcdModelDecoder decodes S-57 data, encrypted according to the S-63 standard (with extensions .000, .001,...). These formats are published by the International Hydrographic Organization in "IHO Transfer Standard for Digital Hydrographic Data, Special Publications No. 57 and No. 63".

To decode S-63 data, the following properties should be set:

  • the location of the SA (scheme administrator) public key: this can be done by either
    • setting the SA certificate file (setSACertificateSource(String aSourceName)) or
    • setting the SA public key file (setSAPublicKeySource(String aSourceName))
  • the location of the permit file(s) containing the cell permit entries: this can be done by either
    • making sure the basic permit file or meta permit file is located in the same directory as the cell file. The model decoder will then auto-detect the permit file and use it.
    • setting the basic permit file(s) (setBasicPermitSource(String aSourceName) or setBasicPermitSources(List<String> aSourceNames)) or
    • setting the meta permit file(s) (setMetaPermitSource(String aSourceName)) or setMetaPermitSources(List<String> aSourceNames)

Additionally, when you are not an Ecdis manufacturer yourself, the running LuciadLightspeed license should contain a valid S-63 User Permit. The model decoder will only work with S-63 files which were provided for this User Permit. Consult the developer guide for more information on how to work with User Permits.

The ILcdModelDescriptor of the decoded model is a TLcdS57ModelDescriptor.

Since:
5.1
See Also:
  • Constructor Details

  • Method Details

    • setUnencryptedHardwareID

      public static void setUnencryptedHardwareID(String aHardwareID)

      Sets an unencrypted version of the hardware ID (HW_ID) of this system. This method will encrypt the hardware ID, and pass it to the setEncryptedHardwareID(String) method.

      For convenience, this method is available on all of the S-63 model decoder classes (TLcdS63UnifiedModelDecoder, TLcdS63CatalogueModelDecoder and TLcdS63ModelDecoder). It is sufficient to call this method once on any of model decoders.

      Parameters:
      aHardwareID - The 5-digit hexadecimal number. For example "A79AB"
      Since:
      2015.1
      See Also:
    • setEncryptedHardwareID

      public static void setEncryptedHardwareID(String aHardwareID)

      Sets an encrypted version of the hardware ID (HW_ID) of this system. This method can only be called when you are a manufacturer of ECDIS systems, and have bought a corresponding license.
      You can check whether your license supports this by opening the development_license.txt file (this file is located inside the development_license.jar file). It must contain the s63Manufacturer = true key-value pair.

      If you want to specify the hardware ID using the API and do not want to do the encryption yourself, you can use the setUnencryptedHardwareID(String) method instead.

      If you want to do the encryption yourself, you can use the following code which uses an RSA encryption:

      
         String hardwareID =  ... ;//5-digit hexadecimal number (for example "A79AB")
      
         byte[] rsa_n = {0, -51, -16, -29, -89, -15, -58, -106, -80, -113, -6, 64, -111, -85, -60, -10, 47};
         byte[] rsa_e = {0, -128, -23};
      
         BigInteger hw_id_encrypted = new BigInteger(hardwareID, 16).modPow(new BigInteger(rsa_e), new BigInteger(rsa_n));
         return hw_id_encrypted.toString(16);
       

      The encrypted hardware ID can also be specified using a system property. Setting the unencrypted hardware ID using the system property is not supported.

      
         -Dcom.luciad.format.s63.encryptedHardwareID=xxxxxxx
       

      The S-63 specification requires that manufacturers take the necessary precautions to ensure that the HW_ID remains unknown to the end-user of the system. This method works with an encrypted form of the HW_ID, but this is not sufficient to ensure proper protection of the HW_ID. It is up to the manufacturer using the Luciad API to ensure that the end-user has no access to the runtime environment, and that the (encoded) version of the HW_ID is not accessible by the user.

      Note: this method should be called before triggering any S-63 related code. Calling this method a second time after any S-63 related code has been triggered has no effect.

      For convenience, this method is available on all of the S-63 model decoder classes (TLcdS63UnifiedModelDecoder, TLcdS63CatalogueModelDecoder and TLcdS63ModelDecoder). It is sufficient to call this method once on any of model decoders.

      Parameters:
      aHardwareID - The encrypted version of the 5-digit hexadecimal number.
      Since:
      2015.1
      See Also:
    • setS63CustomerSystemID

      public static void setS63CustomerSystemID(String aS63CustomerSystemId)
      Configures the S63 Customer System ID, a unique ID used to identify an S-63 system.

      Alternatively, you can set the JVM system property com.luciad.format.s63.s63CustomerSystemID:

        -Dcom.luciad.format.s63.s63CustomerSystemID=mys63id
       
      The system property will be overridden if the setter method is used.
      In Lucy, you can also use TLcyS63FormatAddOn.s63CustomerSystemID configuration setting of the S-63 add-on (TLcyS63FormatAddOn.cfg).

      If your LuciadLightspeed license is not linked to an S-63 Customer System ID, you should not use this method.

      If your LuciadLightspeed license is linked to an S-63 Customer System ID, you must set the ID before using canDecodeSource(java.lang.String) or decode(java.lang.String), or they will return false and throw IllegalArgumentException, respectively.

      The ID is verified against the ID linked to your LuciadLightspeed license. If the ID does not match:

      Parameters:
      aS63CustomerSystemId - The ID to validate with
      Throws:
      IllegalArgumentException - if the given ID does not match the ID linked with your license.
    • setInputStreamFactory

      public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
      Sets the factory that will create input streams from which models can be decoded.
      Specified by:
      setInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Overrides:
      setInputStreamFactory in class TLcdS57ModelDecoder
      Parameters:
      aInputStreamFactory - the factory that creates an input stream based on a source name.
    • getInputStreamFactory

      public ILcdInputStreamFactory getInputStreamFactory()
      Returns the factory that will create input streams from which models can be decoded.
      Specified by:
      getInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Overrides:
      getInputStreamFactory in class TLcdS57ModelDecoder
      Returns:
      the factory that will create input streams from which models can be decoded.
    • setSAPublicKeySource

      public void setSAPublicKeySource(String aSourceName)
      Sets the source URL where the SA's public key can be found. If set, this public key will be preferred over the public key that is extracted from a digital certificate.
      Parameters:
      aSourceName - data source containing the public key of the SA.
    • setSAPublicKeySources

      public void setSAPublicKeySources(List<String> aSourceNames)
      Sets the source URLs where the SA's public keys can be found. If set, these public keys will be preferred over the public key that is extracted from a digital certificate.
      Parameters:
      aSourceNames - data sources containing the public key of the SA.
    • getSAPublicKeySource

      public String getSAPublicKeySource()
      Returns the source URL where the SA's public key can be found.
      Returns:
      the source URL where the SA's public key can be found.
    • getSAPublicKeySources

      public List<String> getSAPublicKeySources()
      Returns the source URLs where the SA's public keys can be found.
      Returns:
      the source URLs where the SA's public keys can be found.
    • setSACertificateSource

      public void setSACertificateSource(String aSourceName)
      Sets the source URL where the SA's digital certificate can be found.
      Parameters:
      aSourceName - data source containing the SA's digital certificate.
    • setSACertificateSources

      public void setSACertificateSources(List<String> aSourceNames)
      Sets the source URLs where the SA's digital certificates can be found.
      Parameters:
      aSourceNames - data sources containing the SA's digital certificate.
    • getSACertificateSource

      public String getSACertificateSource()
      Returns the source URL where the SA's digital certificate can be found.
      Returns:
      the source URL where the SA's digital certificate can be found.
    • getSACertificateSources

      public List<String> getSACertificateSources()
      Returns the source URLs where the SA's digital certificates can be found.
      Returns:
      the source URLs where the SA's digital certificates can be found.
    • setBasicPermitSource

      public void setBasicPermitSource(String aSourceName)
      Sets the source URL of the basic permit file, containing the cell permits. If not set, the system will fall back on the meta permit file.
      Parameters:
      aSourceName - data source containing the cell permits.
    • setBasicPermitSources

      public void setBasicPermitSources(List<String> aSourceNames)
      Sets the source URLs of the basic permit files, containing the cell permits. If not set, the system will fall back on the meta permit files.
      Parameters:
      aSourceNames - list of source URLs of the basic permit files containing the cell permits.
    • getBasicPermitSource

      public String getBasicPermitSource()
      Returns the source URL of the basic permit file. In case multiple basic permit files were set, the first added permit file's source URL will be returned.
      Returns:
      the source URL of the basic permit file
    • getBasicPermitSources

      public List<String> getBasicPermitSources()
      Returns the source URLs of the basic permit files.
      Returns:
      the source URLs of the basic permit files
    • setMetaPermitSource

      public void setMetaPermitSource(String aSourceName)
      Sets the source URL of the meta permit file, containing the cell permits and meta information.
      Parameters:
      aSourceName - data source containing the cell permits plus meta info.
    • setMetaPermitSources

      public void setMetaPermitSources(List<String> aSourceNames)
      Sets the source URLs of the meta permit files, containing the cell permits and meta information.
      Parameters:
      aSourceNames - list of source URLs of the meta permit files containing the cell permits plus meta info.
    • getMetaPermitSource

      public String getMetaPermitSource()
      Returns the source URL of the meta permit file. In case multiple meta permit files were set, the first added permit file's source URL will be returned.
      Returns:
      the source URL of the meta permit file
    • getMetaPermitSources

      public List<String> getMetaPermitSources()
      Returns the source URLs of the meta permit files.
      Returns:
      the source URLs of the meta permit files
    • setDoAuthentication

      public void setDoAuthentication(boolean aDoAuthentication)
      Specifies whether data should be authenticated, based on the signature file. By default, the decoder will perform authentication.
      Parameters:
      aDoAuthentication - specifies whether data should be authenticated.
    • getUserPermit

      public String getUserPermit()

      Returns the S-63 User Permit that is attached to the running license.

      The returned instance can be null in the following situations:

      • Luciad is the S-63 manufacturer, but no user permit has been provided yet. In this case, you can only open the S-63 demo dataset.
      • You (the Luciad API user) are the S-63 manufacturer. In that case there is no user permit associated to your Luciad license. If you want to be able to open S-63 data, you need to call the setEncryptedHardwareID(String) method.

      Consult the S-63 developer guide for more information on user permits.

      Returns:
      the S-63 User Permit that is attached to the running license, possibly null.
    • getDisplayName

      public String getDisplayName()
      Description copied from interface: ILcdModelDecoder
      Returns a short, displayable name for the format that is decoded by this ILcdModelDecoder.
      Specified by:
      getDisplayName in interface ILcdModelDecoder
      Overrides:
      getDisplayName in class TLcdS57ModelDecoder
      Returns:
      the displayable name of this ILcdModelDecoder.
    • canDecodeSource

      public boolean canDecodeSource(String aSourceName)
      Description copied from interface: ILcdModelDecoder
      Checks whether this model decoder can decode the specified data source. It is acceptable for this method to return true for a source name while decode throws an exception for that same source name.

      For performance reasons, we strongly recommend that this will only be a simple test. For example: check the file extension of a file, but not that the file exists or contains expected content.

      Specified by:
      canDecodeSource in interface ILcdModelDecoder
      Overrides:
      canDecodeSource in class TLcdS57ModelDecoder
      Parameters:
      aSourceName - the data source to be verified; typically a file name or a URL.
      Returns:
      true if this decoder can likely decode the data specified by the source name, false otherwise.
      See Also:
    • canDecodeMetadata

      public boolean canDecodeMetadata(String aSourceName)
      Description copied from interface: ILcdMetadataDecoder
      Tells whether this metadata decoder can likely decode metadata for a given source name.
      Specified by:
      canDecodeMetadata in interface ILcdMetadataDecoder
      Overrides:
      canDecodeMetadata in class TLcdS57ModelDecoder
      Parameters:
      aSourceName - the source name to decode metadata for
      Returns:
      true if this metadata decoder can decode metadata for the given source name, false otherwise
    • decode

      public ILcdModel decode(String aSourceName) throws IOException
      Description copied from interface: ILcdModelDecoder
      Creates a new model from the given data source.
      Specified by:
      decode in interface ILcdModelDecoder
      Overrides:
      decode in class TLcdS57ModelDecoder
      Parameters:
      aSourceName - the data source to be decoded; typically a file name or a URL.
      Returns:
      A model containing the decoded data. While null is allowed, implementors are advised to throw an error instead.
      Throws:
      IOException - for any exceptions caused by IO problems or invalid data. Since decoding invalid data almost always results in RunTimeExceptions (NullPointerException, IndexOutOfBoundsException, IllegalArgumentException, ...) on unexpected places, implementations are advised to catch RuntimeExceptions in their decode() method, and wrap them into an IOException, as illustrated in the code snippet below.
      
         public ILcdModel decode( String aSourceName ) throws IOException {
            try (InputStream input = fInputStreamFactory.createInputStream(aSourceName)) {
               // Perform decoding ...
            } catch (RuntimeException e) {
               throw new IOException(e);
            }
         }
       
      See Also:
    • decodeMetadata

      public TLcdISO19115Metadata decodeMetadata(String aSourceName) throws IOException
      Description copied from interface: ILcdMetadataDecoder
      Decodes the metadata from a given source name as an ISO-19115 metadata object.

      Note that even if ILcdMetadataDecoder.canDecodeMetadata(String) returns true, this method may yet not be able to decode the given source name. While returning null is allowed when this decoder couldn't decode the given source name, implementors are advised to throw an error instead.

      Specified by:
      decodeMetadata in interface ILcdMetadataDecoder
      Overrides:
      decodeMetadata in class TLcdS57ModelDecoder
      Parameters:
      aSourceName - the source name to decode metadata from
      Returns:
      a metadata object
      Throws:
      IOException - if the metadata cannot be decoded for some reason
      See Also: