Skip to content

Commit

Permalink
Move CRMFPopClient.createCertTemplate() to CryptoUtil
Browse files Browse the repository at this point in the history
  • Loading branch information
edewata committed Feb 7, 2025
1 parent f011ccf commit ef49dcf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,16 @@ public static PKCS10 createCertificationRequest(
return pkcs10;
}

public static CertTemplate createCertTemplate(Name subject, PublicKey publicKey) throws Exception {

CertTemplate template = new CertTemplate();
template.setVersion(new INTEGER(2));
template.setSubject(subject);
template.setPublicKey(new SubjectPublicKeyInfo(publicKey));

return template;
}

public static Signature createSigner(
CryptoToken token,
String algorithm,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.security.Key;
import java.security.KeyPair;
import java.security.MessageDigest;
import java.security.PublicKey;

import javax.crypto.Mac;

Expand Down Expand Up @@ -70,7 +69,6 @@
import org.mozilla.jss.pkix.primitive.AVA;
import org.mozilla.jss.pkix.primitive.AlgorithmIdentifier;
import org.mozilla.jss.pkix.primitive.Name;
import org.mozilla.jss.pkix.primitive.SubjectPublicKeyInfo;
import org.mozilla.jss.util.Password;

import com.netscape.certsrv.client.ClientConfig;
Expand Down Expand Up @@ -643,7 +641,7 @@ public CertRequest createCertRequest(
Name subject,
KeyWrapAlgorithm keyWrapAlgorithm) throws Exception {

CertTemplate certTemplate = createCertTemplate(subject, keyPair.getPublic());
CertTemplate certTemplate = CryptoUtil.createCertTemplate(subject, keyPair.getPublic());

SEQUENCE seq = new SEQUENCE();

Expand Down Expand Up @@ -721,16 +719,6 @@ public OCTET_STRING createIDPOPLinkWitness() throws Exception {
return new OCTET_STRING(finalDigest);
}

public CertTemplate createCertTemplate(Name subject, PublicKey publicKey) throws Exception {

CertTemplate template = new CertTemplate();
template.setVersion(new INTEGER(2));
template.setSubject(subject);
template.setPublicKey(new SubjectPublicKeyInfo(publicKey));

return template;
}

public void submitRequest(
String request,
String hostPort,
Expand Down

0 comments on commit ef49dcf

Please sign in to comment.