Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8290532: Adjust PKCS11Exception and handle more PKCS11 error codes
Reviewed-by: valeriep
  • Loading branch information
MBaesken committed Jul 28, 2022
1 parent 93f96d8 commit 07f0612
Showing 1 changed file with 25 additions and 2 deletions.
Expand Up @@ -180,14 +180,37 @@ public static enum RV {
}
};

public static enum RV_VENDOR {
// NSS
CKR_NSS_CERTDB_FAILED(0xCE534351L),
CKR_NSS_KEYDB_FAILED(0xCE534352L);

private final long value;

RV_VENDOR(long value) {
this.value = value;
}
};

private static String lookup(long errorCode) {
for (RV r : RV.values()) {
if (r.value == errorCode) {
return r.name();
}
}
// for unknown PKCS11 return values, just use hex as its string
return "0x" + Functions.toFullHexString((int)errorCode);
// for unknown PKCS11 return values, use hex as its string
String res = "0x" + Functions.toFullHexString((int)errorCode);
// for vendor-defined values, check the enum for vendors and include
// potential matches
if ((errorCode & 0x80000000L) != 0) {
for (RV_VENDOR r : RV_VENDOR.values()) {
if (r.value == errorCode) {
res += "(" + r.name() + ")";
break;
}
}
}
return res;
}

/**
Expand Down

3 comments on commit 07f0612

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MBaesken
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 07f0612 Sep 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MBaesken the backport was successfully created on the branch MBaesken-backport-07f0612c in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 07f0612c from the openjdk/jdk repository.

The commit being backported was authored by Matthias Baesken on 28 Jul 2022 and was reviewed by Valerie Peng.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u-dev:

$ git fetch https://github.com/openjdk-bots/jdk17u-dev MBaesken-backport-07f0612c:MBaesken-backport-07f0612c
$ git checkout MBaesken-backport-07f0612c
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u-dev MBaesken-backport-07f0612c

Please sign in to comment.