-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SD-1822: Use certificates rather than public keys
As a side-effect of this, we can now support EC keys instead of only RSA keys (without having to manually parse and understand the DER/ASN.1 format).
- Loading branch information
Showing
3 changed files
with
130 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
ebl/src/main/java/org/dcsa/conformance/standards/ebl/crypto/impl/RSAPayloadSigner.java
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
...src/main/java/org/dcsa/conformance/standards/ebl/crypto/impl/X509BackedPayloadSigner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.dcsa.conformance.standards.ebl.crypto.impl; | ||
|
||
import org.bouncycastle.cert.X509CertificateHolder; | ||
import org.dcsa.conformance.standards.ebl.crypto.JWSSignerDetails; | ||
import org.dcsa.conformance.standards.ebl.crypto.PayloadSignerWithKey; | ||
|
||
import static org.dcsa.conformance.standards.ebl.crypto.PayloadSignerFactory.pemEncodeCertificate; | ||
|
||
public class X509BackedPayloadSigner extends DefaultPayloadSigner implements PayloadSignerWithKey { | ||
|
||
private final X509CertificateHolder x509Cert; | ||
|
||
public X509BackedPayloadSigner(JWSSignerDetails jwsSignerDetails, X509CertificateHolder x509Cert) { | ||
super(jwsSignerDetails); | ||
this.x509Cert = x509Cert; | ||
} | ||
|
||
@Override | ||
public String getPublicKeyInPemFormat() { | ||
return pemEncodeCertificate(this.x509Cert); | ||
} | ||
} |