private static void populateTextField(Attribute[] attrs, JTextField textField, ASN1ObjectIdentifier pkcs9Attr) { if (attrs != null) { for (Attribute attribute : attrs) { ASN1ObjectIdentifier attributeOid = attribute.getAttrType(); if (attributeOid.equals(pkcs9Attr)) { ASN1Encodable challenge = attribute.getAttributeValues()[0]; // data type can be one of IA5String or UTF8String if (challenge instanceof DERPrintableString) { textField.setText(((DERPrintableString) challenge).getString()); } else if (challenge instanceof DERUTF8String) { textField.setText(((DERUTF8String) challenge).getString()); } textField.setCaretPosition(0); } } } } }
/** * Extract sequence with extensions from CSR * * @param pkcs10Csr The CSR * @return Extensions from that CSR (if any) */ public static X509ExtensionSet getExtensions(PKCS10CertificationRequest pkcs10Csr) { Attribute[] attributes = pkcs10Csr.getAttributes(pkcs_9_at_extensionRequest); X509ExtensionSet x509ExtensionSet = new X509ExtensionSet(); if ((attributes != null) && (attributes.length > 0)) { ASN1Encodable[] attributeValues = attributes[0].getAttributeValues(); if (attributeValues.length > 0) { ASN1Sequence asn1Sequence = ASN1Sequence.getInstance(attributeValues[0]); x509ExtensionSet = new X509ExtensionSet(asn1Sequence); } } return x509ExtensionSet; }
private static String getChallengePassword(CertificationRequestInfo csr) { ASN1Set attrs = csr.getAttributes(); for (int i = 0; i < attrs.size(); i++) { Attribute attr = Attribute.getInstance(attrs.getObjectAt(i)); if (PKCSObjectIdentifiers.pkcs_9_at_challengePassword.equals(attr.getAttrType())) { ASN1String str = (ASN1String) attr.getAttributeValues()[0]; return str.getString(); } } return null; }
public static Extensions getExtensions(CertificationRequestInfo csr) { Args.notNull(csr, "csr"); ASN1Set attrs = csr.getAttributes(); for (int i = 0; i < attrs.size(); i++) { Attribute attr = Attribute.getInstance(attrs.getObjectAt(i)); if (PKCSObjectIdentifiers.pkcs_9_at_extensionRequest.equals(attr.getAttrType())) { return Extensions.getInstance(attr.getAttributeValues()[0]); } } return null; }
public static String getChallengePassword(CertificationRequestInfo csr) { Args.notNull(csr, "csr"); ASN1Set attrs = csr.getAttributes(); for (int i = 0; i < attrs.size(); i++) { Attribute attr = Attribute.getInstance(attrs.getObjectAt(i)); if (PKCSObjectIdentifiers.pkcs_9_at_challengePassword.equals(attr.getAttrType())) { ASN1String str = (ASN1String) attr.getAttributeValues()[0]; return str.getString(); } } return null; }
proxySubjectName, subjectPublicKeyInfo); for (Attribute attribute: attributes) builder.addAttribute(attribute.getAttrType(), attribute.getAttributeValues()); AlgorithmIdentifier signatureAi = new AlgorithmIdentifier(OIWObjectIdentifiers.sha1WithRSA); AlgorithmIdentifier hashAi = new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1);
Attribute attr = Attribute.getInstance(attrs.getObjectAt(i)); if (PKCSObjectIdentifiers.pkcs_9_at_extensionRequest.equals(attr.getAttrType())) { extensions = Extensions.getInstance(attr.getAttributeValues()[0]);
Attribute attr = Attribute.getInstance(attrs.getObjectAt(i)); if (PKCSObjectIdentifiers.pkcs_9_at_extensionRequest.equals(attr.getAttrType())) { extensions = Extensions.getInstance(attr.getAttributeValues()[0]);