Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package ee.openeid.siga.common.model;

/**
* KeyUsage type as defined in @see
* <a href="https://datatracker.ietf.org/doc/html/rfc5280">RFC 5280</a>.
*/
public class KeyUsageType
{
public static final int DIGITAL_SIGNATURE = 0;
public static final int NON_REPUDIATION = 1;
public static final int CONTENT_COMMITMENT = NON_REPUDIATION;
public static final int KEY_ENCIPHERMENT = 2;
public static final int DATA_ENCIPHERMENT = 3;
public static final int KEY_AGREEMENT = 4;
public static final int KEY_CERT_SIGN = 5;
public static final int CRL_SIGN = 6;
public static final int ENCIPHER_ONLY = 7;
public static final int DECIPHER_ONLY = 8;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import ee.openeid.siga.common.exception.InvalidCertificateException;
import ee.openeid.siga.common.exception.TechnicalException;
import ee.openeid.siga.common.model.KeyUsageType;
import eu.europa.esig.dss.utils.Utils;
import lombok.experimental.UtilityClass;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -45,7 +46,7 @@ public static boolean isSigningCertificate(X509Certificate certificate) {
if (certificate.getKeyUsage() == null || certificate.getKeyUsage().length < 2) {
return false;
}
return certificate.getKeyUsage()[1];
return certificate.getKeyUsage()[KeyUsageType.NON_REPUDIATION];
}


Expand Down