/** * Return a top-level {@code IOP::TaggedComponent} to be stuffed into an IOR, containing a * structure {@code SSLIOP::SSL}, tagged as {@code TAG_SSL_SEC_TRANS}. * * <p>Should be called with non-null metadata, in which case we probably don't want to include * security info in the IOR. * * @param metadata the metadata object that contains the SSL configuration info. * @param codec the {@code Codec} used to encode the SSL component. * @param sslPort an {@code int} representing the SSL port. * @param orb a reference to the running {@code ORB}. * @return a {@code TaggedComponent} representing the encoded SSL component. */ public static TaggedComponent createSSLTaggedComponent( IORSecurityConfigMetaData metadata, Codec codec, int sslPort, ORB orb) { if (metadata == null) { JacORBLogger.ROOT_LOGGER.createSSLTaggedComponentWithNullMetaData(); return null; } TaggedComponent tc; try { int supports = createTargetSupports(metadata.getTransportConfig()); int requires = createTargetRequires(metadata.getTransportConfig()); SSL ssl = new SSL((short) supports, (short) requires, (short) sslPort); Any any = orb.create_any(); SSLHelper.insert(any, ssl); byte[] componentData = codec.encode_value(any); tc = new TaggedComponent(TAG_SSL_SEC_TRANS.value, componentData); } catch (InvalidTypeForEncoding e) { throw JacORBLogger.ROOT_LOGGER.unexpectedException(e); } return tc; }
/** * Return a top-level {@code IOP::TaggedComponent} to be stuffed into an IOR, containing an * structure {@code SSLIOP::SSL}, tagged as {@code TAG_SSL_SEC_TRANS}. * * <p>Should be called with non-null metadata, in which case we probably don't want to include * security info in the IOR. * * @param metadata the metadata object that contains the SSL configuration info. * @param codec the {@code Codec} used to encode the SSL component. * @param sslPort an {@code int} representing the SSL port. * @param orb a reference to the running {@code ORB}. * @return a {@code TaggedComponent} representing the encoded SSL component. */ public static TaggedComponent createSSLTaggedComponent( IORSecurityConfigMetadata metadata, Codec codec, int sslPort, ORB orb) { if (metadata == null) { log.debugf("createSSLTaggedComponent() called with null metadata"); return null; } TaggedComponent tc; try { int supports = createTargetSupports(metadata.getTransportConfig()); int requires = createTargetRequires(metadata.getTransportConfig()); SSL ssl = new SSL((short) supports, (short) requires, (short) sslPort); Any any = orb.create_any(); SSLHelper.insert(any, ssl); byte[] componentData = codec.encode_value(any); tc = new TaggedComponent(TAG_SSL_SEC_TRANS.value, componentData); } catch (InvalidTypeForEncoding e) { log.warn("Caught unexcepted exception while encoding SSL component", e); throw new RuntimeException(e); } return tc; }