Skip to content

Commit

Permalink
browser: Added SNMPv3 AES encryption (issue #24)
Browse files Browse the repository at this point in the history
  • Loading branch information
cederberg committed Feb 20, 2017
1 parent 4b44898 commit 3a6bb8e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
17 changes: 12 additions & 5 deletions src/doc/release/version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@

<list>
<item>
<title>Fixed NPE if imported MIB not found</title>
<text>The <code>MibImport</code> class unfortunately threw a
<code>NullPointerException</code> when an imported MIB wasn't found.
Thanks to Yonghao Yu for fixing and reporting this.
<ref issue="23" /></text>
<title>Added AES encryption to MibbleBrowser</title>
<text>The MibbleBrowser application now supports AES encryption of
messages. Thanks to Richard Thompson for suggesting this.
<ref issue="24" /></text>
</item>

<item>
Expand All @@ -22,6 +21,14 @@
6.1 to enable AES privacy. This library is only used by the example
MibbleBrowser application and isn't required for MIB parsing.</text>
</item>

<item>
<title>Fixed NPE when imported MIB not found</title>
<text>The <code>MibImport</code> class unfortunately threw a
<code>NullPointerException</code> when an imported MIB wasn't found.
Thanks to Yonghao Yu for fixing and reporting this.
<ref issue="23" /></text>
</item>
</list>


Expand Down
6 changes: 5 additions & 1 deletion src/java/net/percederberg/mibble/browser/SnmpManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,11 @@ public static SnmpManager createSNMPv3(String host,
}
if (auth != null && privacy != null) {
type = privacy.getType();
if (!type.equals(SnmpPrivacy.CBC_DES_TYPE)) {
if (type.equals(SnmpPrivacy.DES_TYPE)) {
pool.setPrivacyProtocol(SnmpContextv3Face.DES_ENCRYPT);
} else if (type.equals(SnmpPrivacy.AES_TYPE)) {
pool.setPrivacyProtocol(SnmpContextv3Face.AES_ENCRYPT);
} else {
throw new SnmpException("Unsupported privacy " +
"protocol: " + type);
}
Expand Down
3 changes: 2 additions & 1 deletion src/java/net/percederberg/mibble/browser/SnmpPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ private void initialize() {
authTypeCombo.addItem(SnmpAuthentication.MD5_TYPE);
authTypeCombo.addItem(SnmpAuthentication.SHA1_TYPE);
privacyTypeCombo.addItem("None");
privacyTypeCombo.addItem(SnmpPrivacy.CBC_DES_TYPE);
privacyTypeCombo.addItem(SnmpPrivacy.DES_TYPE);
privacyTypeCombo.addItem(SnmpPrivacy.AES_TYPE);

// Associate labels
hostLabel.setLabelFor(hostField);
Expand Down
9 changes: 7 additions & 2 deletions src/java/net/percederberg/mibble/browser/SnmpPrivacy.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@
public class SnmpPrivacy {

/**
* The CBC-DES privacy type.
* The DES privacy type.
*/
public static final String CBC_DES_TYPE = "CBC-DES";
public static final String DES_TYPE = "3-DES (CBC-DES)";

/**
* The AES privacy type.
*/
public static final String AES_TYPE = "AES (CFB128-AES-128)";

/**
* The privacy type.
Expand Down

0 comments on commit 3a6bb8e

Please sign in to comment.