Search in sources :

Example 1 with PrivAES256

use of org.snmp4j.security.PrivAES256 in project ovirt-engine by oVirt.

the class Snmp method createSnmp3.

private org.snmp4j.Snmp createSnmp3(Profile profile) {
    try {
        TransportMapping<?> transport = new DefaultUdpTransportMapping();
        org.snmp4j.Snmp snmp = new org.snmp4j.Snmp(transport);
        SecurityProtocols securityProtocols = SecurityProtocols.getInstance();
        securityProtocols.addDefaultProtocols();
        securityProtocols.addAuthenticationProtocol(new AuthMD5());
        securityProtocols.addAuthenticationProtocol(new AuthSHA());
        securityProtocols.addPrivacyProtocol(new PrivAES128());
        securityProtocols.addPrivacyProtocol(new PrivAES192());
        securityProtocols.addPrivacyProtocol(new PrivAES256());
        USM usm = new USM(securityProtocols, profile.engineId, 0);
        ((org.snmp4j.mp.MPv3) snmp.getMessageProcessingModel(org.snmp4j.mp.MPv3.ID)).setLocalEngineID(profile.engineId.getValue());
        ((org.snmp4j.mp.MPv3) snmp.getMessageProcessingModel(org.snmp4j.mp.MPv3.ID)).getSecurityModels().addSecurityModel(usm);
        SecurityModels.getInstance().addSecurityModel(usm);
        transport.listen();
        snmp.getUSM().addUser(profile.username, getUsmUser(profile));
        return snmp;
    } catch (IOException e) {
        throw new NotificationServiceException("error creating version 3 snmp " + getClass().getName());
    }
}
Also used : NotificationServiceException(org.ovirt.engine.core.notifier.NotificationServiceException) SecurityProtocols(org.snmp4j.security.SecurityProtocols) DefaultUdpTransportMapping(org.snmp4j.transport.DefaultUdpTransportMapping) AuthSHA(org.snmp4j.security.AuthSHA) IOException(java.io.IOException) USM(org.snmp4j.security.USM) PrivAES192(org.snmp4j.security.PrivAES192) PrivAES128(org.snmp4j.security.PrivAES128) PrivAES256(org.snmp4j.security.PrivAES256) AuthMD5(org.snmp4j.security.AuthMD5)

Aggregations

IOException (java.io.IOException)1 NotificationServiceException (org.ovirt.engine.core.notifier.NotificationServiceException)1 AuthMD5 (org.snmp4j.security.AuthMD5)1 AuthSHA (org.snmp4j.security.AuthSHA)1 PrivAES128 (org.snmp4j.security.PrivAES128)1 PrivAES192 (org.snmp4j.security.PrivAES192)1 PrivAES256 (org.snmp4j.security.PrivAES256)1 SecurityProtocols (org.snmp4j.security.SecurityProtocols)1 USM (org.snmp4j.security.USM)1 DefaultUdpTransportMapping (org.snmp4j.transport.DefaultUdpTransportMapping)1