use of org.gluu.oxtrust.model.scim2.Extension in project xipki by xipki.
the class IdentifiedX509Certprofile method addRequestedExtKeyusage.
// method addRequestedKeyusage
private static void addRequestedExtKeyusage(List<ASN1ObjectIdentifier> usages, Extensions requestedExtensions, Set<ExtKeyUsageControl> usageOccs) {
Extension extension = requestedExtensions.getExtension(Extension.extendedKeyUsage);
if (extension == null) {
return;
}
ExtendedKeyUsage reqKeyUsage = ExtendedKeyUsage.getInstance(extension.getParsedValue());
for (ExtKeyUsageControl k : usageOccs) {
if (k.isRequired()) {
continue;
}
if (reqKeyUsage.hasKeyPurposeId(KeyPurposeId.getInstance(k.getExtKeyUsage()))) {
usages.add(k.getExtKeyUsage());
}
}
}
use of org.gluu.oxtrust.model.scim2.Extension in project xipki by xipki.
the class ScepUtil method generateRequest.
public static PKCS10CertificationRequest generateRequest(PrivateKey privatekey, SubjectPublicKeyInfo subjectPublicKeyInfo, X500Name subjectDn, String challengePassword, List<Extension> extensions) throws OperatorCreationException {
requireNonNull("privatekey", privatekey);
requireNonNull("subjectPublicKeyInfo", subjectPublicKeyInfo);
requireNonNull("subjectDn", subjectDn);
Map<ASN1ObjectIdentifier, ASN1Encodable> attributes = new HashMap<ASN1ObjectIdentifier, ASN1Encodable>();
if (challengePassword != null && !challengePassword.isEmpty()) {
DERPrintableString asn1Pwd = new DERPrintableString(challengePassword);
attributes.put(PKCSObjectIdentifiers.pkcs_9_at_challengePassword, asn1Pwd);
}
if (extensions != null && !extensions.isEmpty()) {
Extensions asn1Extensions = new Extensions(extensions.toArray(new Extension[0]));
attributes.put(PKCSObjectIdentifiers.pkcs_9_at_extensionRequest, asn1Extensions);
}
return generateRequest(privatekey, subjectPublicKeyInfo, subjectDn, attributes);
}
use of org.gluu.oxtrust.model.scim2.Extension in project jruby-openssl by jruby.
the class OCSPRequest method addNonceImpl.
// BC doesn't have support for nonces... gotta do things manually
private void addNonceImpl() {
GeneralName requestorName = null;
ASN1Sequence requestList = new DERSequence();
Extensions extensions = null;
Signature sig = null;
List<Extension> tmpExtensions = new ArrayList<Extension>();
if (asn1bcReq != null) {
TBSRequest currentTbsReq = asn1bcReq.getTbsRequest();
extensions = currentTbsReq.getRequestExtensions();
sig = asn1bcReq.getOptionalSignature();
Enumeration<ASN1ObjectIdentifier> oids = extensions.oids();
while (oids.hasMoreElements()) {
tmpExtensions.add(extensions.getExtension(oids.nextElement()));
}
}
tmpExtensions.add(new Extension(OCSPObjectIdentifiers.id_pkix_ocsp_nonce, false, nonce));
Extension[] exts = new Extension[tmpExtensions.size()];
Extensions newExtensions = new Extensions(tmpExtensions.toArray(exts));
TBSRequest newTbsReq = new TBSRequest(requestorName, requestList, newExtensions);
asn1bcReq = new org.bouncycastle.asn1.ocsp.OCSPRequest(newTbsReq, sig);
}
use of org.gluu.oxtrust.model.scim2.Extension in project jruby-openssl by jruby.
the class OCSPSingleResponse method extensions.
@JRubyMethod(name = "extensions")
public IRubyObject extensions() {
Ruby runtime = getRuntime();
Extensions exts = bcSingleResponse.getSingleExtensions();
if (exts == null)
return RubyArray.newEmptyArray(runtime);
ASN1ObjectIdentifier[] extOIDs = exts.getExtensionOIDs();
RubyArray retExts = runtime.newArray(extOIDs.length);
for (ASN1ObjectIdentifier extOID : extOIDs) {
Extension ext = exts.getExtension(extOID);
ASN1Encodable extAsn1 = ext.getParsedValue();
X509Extension retExt = X509Extension.newExtension(runtime, extOID, extAsn1, ext.isCritical());
retExts.append(retExt);
}
return retExts;
}
use of org.gluu.oxtrust.model.scim2.Extension in project jruby-openssl by jruby.
the class OCSPBasicResponse method add_nonce.
@JRubyMethod(name = "add_nonce", rest = true)
public OCSPBasicResponse add_nonce(IRubyObject[] args) {
Ruby runtime = getRuntime();
byte[] tmpNonce;
if (Arity.checkArgumentCount(runtime, args, 0, 1) == 0) {
tmpNonce = generateNonce();
} else {
RubyString input = (RubyString) args[0];
tmpNonce = input.getBytes();
}
extensions.add(new Extension(OCSPObjectIdentifiers.id_pkix_ocsp_nonce, false, tmpNonce));
nonce = tmpNonce;
return this;
}
Aggregations