use of org.openecard.bouncycastle.asn1.ASN1ObjectIdentifier in project keystore-explorer by kaikramer.
the class DPolicyMappingChooser method populate.
private void populate(PolicyMapping policyMapping) {
if (policyMapping != null) {
ASN1ObjectIdentifier issuerDomainPolicy = policyMapping.getIssuerDomainPolicy();
ASN1ObjectIdentifier subjectDomainPolicy = policyMapping.getSubjectDomainPolicy();
joiIssuerDomainPolicy.setObjectId(issuerDomainPolicy);
joiSubjectDomainPolicy.setObjectId(subjectDomainPolicy);
}
}
use of org.openecard.bouncycastle.asn1.ASN1ObjectIdentifier in project keystore-explorer by kaikramer.
the class DPolicyMappingChooser method okPressed.
private void okPressed() {
ASN1ObjectIdentifier issuerDomainPolicy = joiIssuerDomainPolicy.getObjectId();
if (issuerDomainPolicy == null) {
JOptionPane.showMessageDialog(this, res.getString("DPolicyMappingChooser.IssuerDomainPolicyValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
return;
}
ASN1ObjectIdentifier subjectDomainPolicy = joiSubjectDomainPolicy.getObjectId();
if (subjectDomainPolicy == null) {
JOptionPane.showMessageDialog(this, res.getString("DPolicyMappingChooser.SubjectDomainPolicyValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
return;
}
policyMapping = new PolicyMapping(issuerDomainPolicy, subjectDomainPolicy);
closeDialog();
}
use of org.openecard.bouncycastle.asn1.ASN1ObjectIdentifier in project keystore-explorer by kaikramer.
the class Spkac method decodeSpkac.
private void decodeSpkac(byte[] der) throws SpkacException {
try {
ASN1Sequence signedPublicKeyAndChallenge = ASN1Sequence.getInstance(der);
ASN1Sequence publicKeyAndChallenge = (ASN1Sequence) signedPublicKeyAndChallenge.getObjectAt(0);
ASN1Sequence signatureAlgorithm = (ASN1Sequence) signedPublicKeyAndChallenge.getObjectAt(1);
DERBitString signature = (DERBitString) signedPublicKeyAndChallenge.getObjectAt(2);
ASN1ObjectIdentifier signatureAlgorithmOid = (ASN1ObjectIdentifier) signatureAlgorithm.getObjectAt(0);
ASN1Sequence spki = (ASN1Sequence) publicKeyAndChallenge.getObjectAt(0);
DERIA5String challenge = (DERIA5String) publicKeyAndChallenge.getObjectAt(1);
ASN1Sequence publicKeyAlgorithm = (ASN1Sequence) spki.getObjectAt(0);
DERBitString publicKey = (DERBitString) spki.getObjectAt(1);
ASN1ObjectIdentifier publicKeyAlgorithmOid = (ASN1ObjectIdentifier) publicKeyAlgorithm.getObjectAt(0);
ASN1Primitive algorithmParameters = publicKeyAlgorithm.getObjectAt(1).toASN1Primitive();
this.challenge = challenge.getString();
this.publicKey = decodePublicKeyFromBitString(publicKeyAlgorithmOid, algorithmParameters, publicKey);
this.signatureAlgorithm = getSignatureAlgorithm(signatureAlgorithmOid);
this.signature = signature.getBytes();
} catch (Exception ex) {
throw new SpkacException(res.getString("NoDecodeSpkac.exception.message"), ex);
}
}
use of org.openecard.bouncycastle.asn1.ASN1ObjectIdentifier in project keystore-explorer by kaikramer.
the class GeneralNameUtil method parseUPN.
/**
* Parse UPN/otherName
*
* @param generalName otherName object
* @return UPN as string
*/
public static String parseUPN(GeneralName generalName) {
// OtherName ::= SEQUENCE {
// type-id OBJECT IDENTIFIER,
// value [0] EXPLICIT ANY DEFINED BY type-id }
ASN1Sequence otherName = (ASN1Sequence) generalName.getName();
ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier) otherName.getObjectAt(0);
if (UPN_OID.equals(oid.getId())) {
DERTaggedObject derTaggedObject = (DERTaggedObject) otherName.getObjectAt(1);
DERUTF8String upn = DERUTF8String.getInstance(derTaggedObject.getObject());
return MessageFormat.format(res.getString("GeneralNameUtil.OtherGeneralName"), "UPN", upn.getString());
}
// fallback to generic handling
ASN1Encodable value = otherName.getObjectAt(1);
try {
return MessageFormat.format(res.getString("GeneralNameUtil.OtherGeneralName"), ObjectIdUtil.toString(oid), HexUtil.getHexString(value.toASN1Primitive().getEncoded(ASN1Encoding.DER)));
} catch (IOException e) {
return MessageFormat.format(res.getString("GeneralNameUtil.OtherGeneralName"), ObjectIdUtil.toString(oid), "");
}
}
use of org.openecard.bouncycastle.asn1.ASN1ObjectIdentifier in project keystore-explorer by kaikramer.
the class DObjectIdChooser method okPressed.
private void okPressed() {
String firstArc = "" + jcbFirstArc.getSelectedItem();
String secondArc = "" + jcbSecondArc.getSelectedItem();
String remainingArcs = jtfRemainingArcs.getText().trim();
ASN1ObjectIdentifier newObjectId = new ASN1ObjectIdentifier(firstArc + "." + secondArc + "." + remainingArcs);
try {
ObjectIdUtil.validate(newObjectId);
} catch (InvalidObjectIdException e) {
JOptionPane.showMessageDialog(this, e.getMessage(), getTitle(), JOptionPane.WARNING_MESSAGE);
return;
}
objectId = newObjectId;
closeDialog();
}
Aggregations