...
Code Block |
---|
// create the TLS transport mapping: AbstractTransportMapping transport = new TLSTM(); // set the security callback (only required for command responder, // but also recommended for authentication ( command generators) - // the callback will be configured later): TlsTmSecurityCallback<X509Certificate>DefaultTlsTmSecurityCallback securityCallback = new DefaultTlsTmSecurityCallback(); ((TLSTM)transport).setSecurityCallback(securityCallback); MessageDispatcher md = new MessageDispatcherImpl(); // we need MPv3 for TLSTM: md.addMessageProcessingModel(new MPv3()); Snmp snmp = new Snmp(md, transport); // create and initialize the TransportSecurityModel TSM: SecurityModels.getInstance().addSecurityModel(new TSM(new OctetString(mpv3.getLocalEngineID()), false)); // do not forget to listen for responses: snmp.listen(); |
...
Code Block |
---|
// add the distinguished name (DN) of the certificates we want to accept as peer: securityCallback.addAcceptedSubjectDN(""EMAILADDRESS=info@company.com, C=US, CN=Foo Bar""); // |