Skip to content

Commit

Permalink
update fourdot1 and snmp1218 pdu creation
Browse files Browse the repository at this point in the history
  • Loading branch information
mwodahl committed Nov 13, 2023
1 parent 21a55bc commit e1e6e75
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@

import org.snmp4j.security.AuthMD5;
import org.snmp4j.security.AuthSHA;
import org.snmp4j.security.AuthHMAC128SHA224;
import org.snmp4j.security.AuthHMAC192SHA256;
import org.snmp4j.security.AuthHMAC256SHA384;
import org.snmp4j.security.AuthHMAC384SHA512;
import org.snmp4j.security.PrivAES128;
import org.snmp4j.security.PrivAES192;
import org.snmp4j.security.PrivAES256;

import org.snmp4j.security.SecurityProtocols;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
Expand All @@ -50,7 +58,13 @@ public static void main(String[] args) throws MalformedObjectNameException, Inte
mbs.registerMBean(mBean, name);

SecurityProtocols.getInstance().addAuthenticationProtocol(new AuthSHA());
SecurityProtocols.getInstance().addAuthenticationProtocol(new AuthHMAC128SHA224());
SecurityProtocols.getInstance().addAuthenticationProtocol(new AuthHMAC192SHA256());
SecurityProtocols.getInstance().addAuthenticationProtocol(new AuthHMAC256SHA384());
SecurityProtocols.getInstance().addAuthenticationProtocol(new AuthHMAC384SHA512());
SecurityProtocols.getInstance().addAuthenticationProtocol(new AuthMD5());
SecurityProtocols.getInstance().addPrivacyProtocol(new PrivAES128());

}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ public static VariableBinding getVbRsuSrmTxInterval(int index, int interval) {
public static VariableBinding getVbRsuSrmDeliveryStart(int index, String deliveryStart) throws ParseException {
return new VariableBinding(
new OID(rsu_srm_delivery_start_oid().concat(".").concat(Integer.toString(index))),
new OctetString(DatatypeConverter.parseHexBinary(SNMP.snmpTimestampFromIso(deliveryStart)))
new OctetString(DatatypeConverter.parseHexBinary(SNMP.fourOneSnmpTimestampFromIso(deliveryStart)))
);
}

public static VariableBinding getVbRsuSrmDeliveryStop(int index, String deliveryStop) throws ParseException {
return new VariableBinding(
new OID(rsu_srm_delivery_stop_oid().concat(".").concat(Integer.toString(index))),
new OctetString(DatatypeConverter.parseHexBinary(SNMP.snmpTimestampFromIso(deliveryStop)))
new OctetString(DatatypeConverter.parseHexBinary(SNMP.fourOneSnmpTimestampFromIso(deliveryStop)))
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@ public static VariableBinding getVbRsuMsgRepeatPriority(int index) {
}

public static VariableBinding getVbRsuMsgRepeatOptions(int index) {
byte[] val = {(byte) 0xc0};
return new VariableBinding(
new OID(rsu_msg_repeat_options_oid().concat(".").concat(Integer.toString(index))),
new OctetString("C0")
new OctetString(val)
);
}

Expand Down

0 comments on commit e1e6e75

Please sign in to comment.