public class OnionRouter
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static mybouncycastle.org.bouncycastle.crypto.params.DHParameters |
DH_PARAMS |
private int |
m_circID |
private MyAES |
m_decryptionEngine |
private ORDescriptor |
m_description |
private mybouncycastle.org.bouncycastle.crypto.agreement.DHBasicAgreement |
m_dhe |
private mybouncycastle.org.bouncycastle.crypto.digests.SHA1Digest |
m_digestDb |
private mybouncycastle.org.bouncycastle.crypto.digests.SHA1Digest |
m_digestDf |
private MyAES |
m_encryptionEngine |
private boolean |
m_extended |
private OnionRouter |
m_nextOR |
private static java.math.BigInteger |
MAXKEY |
private static java.math.BigInteger |
MINKEY |
private static java.math.BigInteger |
SAFEPRIME |
Constructor and Description |
---|
OnionRouter(int circID,
ORDescriptor description)
Constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkCreatedCell(Cell cell)
checks the created cell if the answer was right
|
boolean |
checkExtendedCell(RelayCell cell)
checks if the extendedcell has the right parameters and hash
|
private void |
checkExtendParameters(byte[] param,
int offset,
int len)
checks the parameters of a extend cell and calculate the secrets
|
CreateCell |
createConnection()
create cell
this cell is needed to connect to the first OR.
|
private byte[] |
createExtendOnionSkin()
creates the onion skin for a create or extend cell
|
RelayCell |
decryptCell(RelayCell cell)
decrypts a RelayCell
|
RelayCell |
encryptCell(RelayCell cell)
encrypts a RelayCell
|
RelayCell |
extendConnection(ORDescriptor description)
extends the connction to another OR and encrypts the data
|
private RelayCell |
extendConnection(java.lang.String address,
int port)
extends the connection to another OR
|
ORDescriptor |
getDescription()
returns a description of this router
|
private static final java.math.BigInteger SAFEPRIME
private static final java.math.BigInteger MINKEY
private static final java.math.BigInteger MAXKEY
private static final mybouncycastle.org.bouncycastle.crypto.params.DHParameters DH_PARAMS
private ORDescriptor m_description
private mybouncycastle.org.bouncycastle.crypto.agreement.DHBasicAgreement m_dhe
private MyAES m_encryptionEngine
private MyAES m_decryptionEngine
private OnionRouter m_nextOR
private int m_circID
private mybouncycastle.org.bouncycastle.crypto.digests.SHA1Digest m_digestDf
private mybouncycastle.org.bouncycastle.crypto.digests.SHA1Digest m_digestDb
private boolean m_extended
public OnionRouter(int circID, ORDescriptor description) throws java.io.IOException
circID
- circID of the circuit where it is useddescription
- ORDescription of the onionrouterjava.io.IOException
public ORDescriptor getDescription()
public RelayCell encryptCell(RelayCell cell) throws java.lang.Exception
cell
- unencrypted celljava.lang.Exception
public RelayCell decryptCell(RelayCell cell) throws java.lang.Exception
cell
- encrypted celljava.lang.Exception
public CreateCell createConnection() throws java.lang.Exception
java.lang.Exception
public boolean checkCreatedCell(Cell cell)
cell
- createdcelljava.lang.Exception
private RelayCell extendConnection(java.lang.String address, int port) throws java.io.IOException, mybouncycastle.org.bouncycastle.crypto.InvalidCipherTextException, java.lang.Exception
address
- address of the ORport
- portjava.io.IOException
mybouncycastle.org.bouncycastle.crypto.InvalidCipherTextException
java.lang.Exception
public RelayCell extendConnection(ORDescriptor description) throws java.io.IOException, mybouncycastle.org.bouncycastle.crypto.InvalidCipherTextException, java.lang.Exception
description
- ORDescriptionjava.io.IOException
mybouncycastle.org.bouncycastle.crypto.InvalidCipherTextException
java.lang.Exception
public boolean checkExtendedCell(RelayCell cell)
cell
- celljava.lang.Exception
private byte[] createExtendOnionSkin() throws java.io.IOException, mybouncycastle.org.bouncycastle.crypto.InvalidCipherTextException, java.lang.Exception
java.io.IOException
mybouncycastle.org.bouncycastle.crypto.InvalidCipherTextException
java.lang.Exception
private void checkExtendParameters(byte[] param, int offset, int len) throws java.lang.Exception
param
- parametersoffset
- offset of the parameterslen
- length of the parametersjava.lang.Exception
Copyright © 2023. All rights reserved.