public class DHOperations
extends java.lang.Object
Modifier and Type | Class | Description |
---|---|---|
static class |
DHOperations.KeyType |
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
DH_AUTH_PROTOCOL_PROPERTY |
Property name for authentication protocol OID of the kickstart user entry.
|
static java.lang.String |
DH_KICKSTART_SEC_NAME |
|
static java.lang.String |
DH_KICKSTART_VIEW_NAME |
|
static java.lang.String |
DH_PRIV_PROTOCOL_PROPERTY |
Property name for privacy protocol OID of the kickstart user entry.
|
static java.lang.String |
DH_PRIVATE_KEY_PROPERTY |
Property name for private keys of Diffie Hellman key exchange property files.
|
static java.lang.String |
DH_PUBLIC_KEY_PROPERTY |
Property name for public keys of Diffie Hellman key exchange property files.
|
static java.lang.String |
DH_RESET_PROPERTY |
Property name to reset an USM user with a kickstart user entry.
|
static java.lang.String |
DH_VACM_ROLE_PROPERTY |
Property name for VACM role of the kickstart user entry.
|
static java.lang.String |
DIFFIE_HELLMAN |
|
static OID |
oidUsmDHKickstartMgrPublic |
|
static OID |
oidUsmDHKickstartMyPublic |
|
static OID |
oidUsmDHKickstartSecurityName |
Constructor | Description |
---|---|
DHOperations() |
Modifier and Type | Method | Description |
---|---|---|
static java.math.BigInteger |
bytesToBigInteger(byte[] bytes) |
Convert a byte array to a
BigInteger . |
static byte[] |
computeSharedKey(javax.crypto.KeyAgreement keyAgreement,
byte[] publicKey,
DHParameters dhParameters) |
|
static java.security.KeyPair |
createKeyPair(OctetString publicKeyOctets,
OctetString privateKeyOctets,
DHParameters dhParameters) |
|
static byte[] |
deriveKey(byte[] sharedKey,
int keyLength) |
Derive the USM key from the Diffie Hellman key exchange.
|
static OctetString |
derivePrivateKey(java.security.KeyPair keyPair) |
|
static OctetString |
derivePublicKey(java.security.KeyPair keyPair) |
|
static java.security.KeyPair |
generatePublicKey(DHParameters dhParameters) |
|
static java.util.Map<OctetString,OctetString[]> |
getDHKickstartPublicKeys(Session session,
PDUFactory pduFactory,
Target target,
java.util.Set<OctetString> managerPublic) |
Get the public keys of the agent's kickstart table that match the local public keys provided from a remote agent.
|
static javax.crypto.KeyAgreement |
getInitializedKeyAgreement(java.security.KeyPair keyPair) |
|
static byte[] |
keyToBytes(java.security.Key key) |
Convert a
Key to a byte array. |
public static final java.lang.String DIFFIE_HELLMAN
public static final java.lang.String DH_KICKSTART_SEC_NAME
public static final java.lang.String DH_KICKSTART_VIEW_NAME
public static final OID oidUsmDHKickstartMyPublic
public static final OID oidUsmDHKickstartMgrPublic
public static final OID oidUsmDHKickstartSecurityName
public static final java.lang.String DH_PRIVATE_KEY_PROPERTY
public static final java.lang.String DH_PUBLIC_KEY_PROPERTY
public static final java.lang.String DH_AUTH_PROTOCOL_PROPERTY
public static final java.lang.String DH_PRIV_PROTOCOL_PROPERTY
public static final java.lang.String DH_VACM_ROLE_PROPERTY
public static final java.lang.String DH_RESET_PROPERTY
public static byte[] computeSharedKey(javax.crypto.KeyAgreement keyAgreement, byte[] publicKey, DHParameters dhParameters)
public static java.math.BigInteger bytesToBigInteger(byte[] bytes)
BigInteger
.
Adds a leading zero-byte to ensure a positive BigInteger
.bytes
- The byte array to convert.BigInteger
containing the provided bytes as unsigned integer.public static byte[] keyToBytes(java.security.Key key)
Key
to a byte array. Uses X or Y values
of a key depending on key type (private or public). Cut off
a leading zero-byte if key length is not divisible by 8.key
- The Key
to convert.null
.public static java.security.KeyPair createKeyPair(OctetString publicKeyOctets, OctetString privateKeyOctets, DHParameters dhParameters)
public static OctetString derivePublicKey(java.security.KeyPair keyPair)
public static OctetString derivePrivateKey(java.security.KeyPair keyPair)
public static java.security.KeyPair generatePublicKey(DHParameters dhParameters) throws java.security.NoSuchAlgorithmException, java.security.InvalidAlgorithmParameterException
java.security.NoSuchAlgorithmException
java.security.InvalidAlgorithmParameterException
public static javax.crypto.KeyAgreement getInitializedKeyAgreement(java.security.KeyPair keyPair)
public static byte[] deriveKey(byte[] sharedKey, int keyLength)
sharedKey
- the shared key (z).keyLength
- the key length of the resulting key in bytes.keyLength
.public static java.util.Map<OctetString,OctetString[]> getDHKickstartPublicKeys(Session session, PDUFactory pduFactory, Target target, java.util.Set<OctetString> managerPublic) throws java.io.IOException
session
- the SNMP Session
to use.pduFactory
- the PDUFactory
to be used to create SNMP PDUs for requesting the data.target
- the SNMP agent target.managerPublic
- a set of public keys of this manager for which public keys of the agent should be retrieved.java.io.IOException
- if the SNMP communication fails.Copyright © 2018 SNMP4J.org. All rights reserved.