Showing 17 of 307 total issues
Method fromBytes
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static jpakePassivePayload fromBytes(byte[] input) throws EmIllegalArgumentException,IllegalArgumentException, ArrayIndexOutOfBoundsException, NullPointerException, SystemException
{
short currStart = 0;
short senderIDlen = input[currStart];
currStart += 1;
Method toBytes
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
public byte[] toBytes(){
byte[] encodedG1 = G1.getEncoded(false);
byte[] encodedG2 = G2.getEncoded(false);
byte[] encA = A.getEncoded(false);
byte[] publicA1Encoded = ZKPx1.getPublicA().getEncoded(false);
Method fromBytes
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static jpakeActiveFirstPayload fromBytes(byte[] input) throws EmIllegalArgumentException, IllegalArgumentException, ArrayIndexOutOfBoundsException, NullPointerException, SystemException
{
short currStart = 0;
short senderIDlen = input[currStart];
currStart += 1;
File EmeraldApplicationCli.java
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
Team Emerald (in alphabetical order):
@OTristanF https://github.com/OTristanF
@lsolodkova https://github.com/lsolodkova
@mvondracek https://github.com/mvondracek
Method toBytes
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public byte[] toBytes(){
byte[] encodedG1 = G1.getEncoded(false);
byte[] encodedG2 = G2.getEncoded(false);
byte[] publicA1Encoded = ZKPx1.getPublicA().getEncoded(false);
byte[] publicV1Encoded = ZKPx1.getPublicV().getEncoded(false);
Method run
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void run() {
printBanner();
// connect to the card
try {
connect(RunConfig.CARD_TYPE.JCARDSIMLOCAL);
Method fromBytes
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static jpakeActiveSecondPayload fromBytes(byte[] input) throws EmIllegalArgumentException,IllegalArgumentException, ArrayIndexOutOfBoundsException, NullPointerException, SystemException
{
short currStart = 0;
short senderIDlen = input[currStart];
currStart += 1;
Method performKeyAgreement
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void performKeyAgreement() throws CardException, EmeraldProtocolException {
if (isSecureChannelEstablished()) {
// TODO count incorrect counter and consider blocking the application
// key agreement for this session already happened
throw new EmeraldProtocolException(new EmIllegalStateException());
Method process
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public void process(APDU apdu) {
byte[] apduBuffer = apdu.getBuffer();
// ignore SELECT command
if (selectingApplet()) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method toBytes
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public byte[] toBytes(){
byte[] encA = A.getEncoded(false);
byte[] encPublicA = ZKPx2s.getPublicA().getEncoded(false);
byte[] encPublicV = ZKPx2s.getPublicV().getEncoded(false);
byte[] encResult = getZKPx2s().getResult().toByteArray();
Method setPassword
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void setPassword(byte passwordSlotId, String password)
throws CardException, EmProtocolError, EmeraldProtocolException {
System.out.println(String.format("PC --> SC: Set password `%s` to slot %d.",
password, passwordSlotId));
Method requirePinInput
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private byte[] requirePinInput() {
byte[] pin = new byte[PIN_LENGTH];
Scanner scanner = new Scanner(System.in);
while (true) {
System.out.println("PC : Enter 4 digit PIN.");
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method verify
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static boolean verify(ECPoint publicA, ECPoint generator, ECPoint publicV,
BigInteger coFactor, BigInteger result, BigInteger challenge) {
Consider simplifying this complex logical expression. Open
if(G1 == null || G2 == null || A==null || ZKPx1 == null || ZKPx2 == null || ZKPx2s == null){
throw new CryptoException(CryptoException.ILLEGAL_VALUE);
}
Method processKeyAgreement
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public void processKeyAgreement(APDU apdu) throws EmeraldProtocolException {
if (isSecureChannelEstablished()) {
// count incorrect counter and consider blocking the card
// key agreement for this session already happened
throw new EmeraldProtocolException(new EmIllegalStateException());
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method process
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Confirmed
public byte[] process(byte[] message) throws EmeraldProtocolException {
byte slotId = message[PASSWORD_SLOT_ID_OFFSET];
if (!(0 <= slotId && slotId < PASSWORD_SLOTS_COUNT)) {
// incorrect password slot
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method performKeyAgreement
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public void performKeyAgreement() throws CardException, EmeraldProtocolException {
if (isSecureChannelEstablished()) {
// TODO count incorrect counter and consider blocking the application
// key agreement for this session already happened
throw new EmeraldProtocolException(new EmIllegalStateException());
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"