diff options
Diffstat (limited to 'bcprov/src/main/java/org/bouncycastle/asn1/x509/sigi')
4 files changed, 0 insertions, 465 deletions
diff --git a/bcprov/src/main/java/org/bouncycastle/asn1/x509/sigi/NameOrPseudonym.java b/bcprov/src/main/java/org/bouncycastle/asn1/x509/sigi/NameOrPseudonym.java deleted file mode 100644 index 8c05277..0000000 --- a/bcprov/src/main/java/org/bouncycastle/asn1/x509/sigi/NameOrPseudonym.java +++ /dev/null @@ -1,188 +0,0 @@ -package org.bouncycastle.asn1.x509.sigi; - -import java.util.Enumeration; - -import org.bouncycastle.asn1.ASN1Choice; -import org.bouncycastle.asn1.ASN1EncodableVector; -import org.bouncycastle.asn1.ASN1Object; -import org.bouncycastle.asn1.ASN1Primitive; -import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.ASN1String; -import org.bouncycastle.asn1.DERSequence; -import org.bouncycastle.asn1.x500.DirectoryString; - -/** - * Structure for a name or pseudonym. - * - * <pre> - * NameOrPseudonym ::= CHOICE { - * surAndGivenName SEQUENCE { - * surName DirectoryString, - * givenName SEQUENCE OF DirectoryString - * }, - * pseudonym DirectoryString - * } - * </pre> - * - * @see org.bouncycastle.asn1.x509.sigi.PersonalData - * - */ -public class NameOrPseudonym - extends ASN1Object - implements ASN1Choice -{ - private DirectoryString pseudonym; - - private DirectoryString surname; - - private ASN1Sequence givenName; - - public static NameOrPseudonym getInstance(Object obj) - { - if (obj == null || obj instanceof NameOrPseudonym) - { - return (NameOrPseudonym)obj; - } - - if (obj instanceof ASN1String) - { - return new NameOrPseudonym(DirectoryString.getInstance(obj)); - } - - if (obj instanceof ASN1Sequence) - { - return new NameOrPseudonym((ASN1Sequence)obj); - } - - throw new IllegalArgumentException("illegal object in getInstance: " - + obj.getClass().getName()); - } - - /** - * Constructor from DirectoryString. - * <p> - * The sequence is of type NameOrPseudonym: - * <pre> - * NameOrPseudonym ::= CHOICE { - * surAndGivenName SEQUENCE { - * surName DirectoryString, - * givenName SEQUENCE OF DirectoryString - * }, - * pseudonym DirectoryString - * } - * </pre> - * @param pseudonym pseudonym value to use. - */ - public NameOrPseudonym(DirectoryString pseudonym) - { - this.pseudonym = pseudonym; - } - - /** - * Constructor from ASN1Sequence. - * <p> - * The sequence is of type NameOrPseudonym: - * <pre> - * NameOrPseudonym ::= CHOICE { - * surAndGivenName SEQUENCE { - * surName DirectoryString, - * givenName SEQUENCE OF DirectoryString - * }, - * pseudonym DirectoryString - * } - * </pre> - * </p> - * @param seq The ASN.1 sequence. - */ - private NameOrPseudonym(ASN1Sequence seq) - { - if (seq.size() != 2) - { - throw new IllegalArgumentException("Bad sequence size: " - + seq.size()); - } - - if (!(seq.getObjectAt(0) instanceof ASN1String)) - { - throw new IllegalArgumentException("Bad object encountered: " - + seq.getObjectAt(0).getClass()); - } - - surname = DirectoryString.getInstance(seq.getObjectAt(0)); - givenName = ASN1Sequence.getInstance(seq.getObjectAt(1)); - } - - /** - * Constructor from a given details. - * - * @param pseudonym The pseudonym. - */ - public NameOrPseudonym(String pseudonym) - { - this(new DirectoryString(pseudonym)); - } - - /** - * Constructor from a given details. - * - * @param surname The surname. - * @param givenName A sequence of directory strings making up the givenName - */ - public NameOrPseudonym(DirectoryString surname, ASN1Sequence givenName) - { - this.surname = surname; - this.givenName = givenName; - } - - public DirectoryString getPseudonym() - { - return pseudonym; - } - - public DirectoryString getSurname() - { - return surname; - } - - public DirectoryString[] getGivenName() - { - DirectoryString[] items = new DirectoryString[givenName.size()]; - int count = 0; - for (Enumeration e = givenName.getObjects(); e.hasMoreElements();) - { - items[count++] = DirectoryString.getInstance(e.nextElement()); - } - return items; - } - - /** - * Produce an object suitable for an ASN1OutputStream. - * <p> - * Returns: - * <pre> - * NameOrPseudonym ::= CHOICE { - * surAndGivenName SEQUENCE { - * surName DirectoryString, - * givenName SEQUENCE OF DirectoryString - * }, - * pseudonym DirectoryString - * } - * </pre> - * - * @return a DERObject - */ - public ASN1Primitive toASN1Primitive() - { - if (pseudonym != null) - { - return pseudonym.toASN1Primitive(); - } - else - { - ASN1EncodableVector vec1 = new ASN1EncodableVector(); - vec1.add(surname); - vec1.add(givenName); - return new DERSequence(vec1); - } - } -} diff --git a/bcprov/src/main/java/org/bouncycastle/asn1/x509/sigi/PersonalData.java b/bcprov/src/main/java/org/bouncycastle/asn1/x509/sigi/PersonalData.java deleted file mode 100644 index 883ed8d..0000000 --- a/bcprov/src/main/java/org/bouncycastle/asn1/x509/sigi/PersonalData.java +++ /dev/null @@ -1,212 +0,0 @@ -package org.bouncycastle.asn1.x509.sigi; - -import java.math.BigInteger; -import java.util.Enumeration; - -import org.bouncycastle.asn1.ASN1EncodableVector; -import org.bouncycastle.asn1.ASN1GeneralizedTime; -import org.bouncycastle.asn1.ASN1Integer; -import org.bouncycastle.asn1.ASN1Object; -import org.bouncycastle.asn1.ASN1Primitive; -import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.ASN1TaggedObject; -import org.bouncycastle.asn1.DERPrintableString; -import org.bouncycastle.asn1.DERSequence; -import org.bouncycastle.asn1.DERTaggedObject; -import org.bouncycastle.asn1.x500.DirectoryString; - -/** - * Contains personal data for the otherName field in the subjectAltNames - * extension. - * - * <pre> - * PersonalData ::= SEQUENCE { - * nameOrPseudonym NameOrPseudonym, - * nameDistinguisher [0] INTEGER OPTIONAL, - * dateOfBirth [1] GeneralizedTime OPTIONAL, - * placeOfBirth [2] DirectoryString OPTIONAL, - * gender [3] PrintableString OPTIONAL, - * postalAddress [4] DirectoryString OPTIONAL - * } - * </pre> - * - * @see org.bouncycastle.asn1.x509.sigi.NameOrPseudonym - * @see org.bouncycastle.asn1.x509.sigi.SigIObjectIdentifiers - */ -public class PersonalData - extends ASN1Object -{ - private NameOrPseudonym nameOrPseudonym; - private BigInteger nameDistinguisher; - private ASN1GeneralizedTime dateOfBirth; - private DirectoryString placeOfBirth; - private String gender; - private DirectoryString postalAddress; - - public static PersonalData getInstance(Object obj) - { - if (obj == null || obj instanceof PersonalData) - { - return (PersonalData)obj; - } - - if (obj instanceof ASN1Sequence) - { - return new PersonalData((ASN1Sequence)obj); - } - - throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName()); - } - - /** - * Constructor from ASN1Sequence. - * <p> - * The sequence is of type NameOrPseudonym: - * <pre> - * PersonalData ::= SEQUENCE { - * nameOrPseudonym NameOrPseudonym, - * nameDistinguisher [0] INTEGER OPTIONAL, - * dateOfBirth [1] GeneralizedTime OPTIONAL, - * placeOfBirth [2] DirectoryString OPTIONAL, - * gender [3] PrintableString OPTIONAL, - * postalAddress [4] DirectoryString OPTIONAL - * } - * </pre> - * </p> - * @param seq The ASN.1 sequence. - */ - private PersonalData(ASN1Sequence seq) - { - if (seq.size() < 1) - { - throw new IllegalArgumentException("Bad sequence size: " - + seq.size()); - } - - Enumeration e = seq.getObjects(); - - nameOrPseudonym = NameOrPseudonym.getInstance(e.nextElement()); - - while (e.hasMoreElements()) - { - ASN1TaggedObject o = ASN1TaggedObject.getInstance(e.nextElement()); - int tag = o.getTagNo(); - switch (tag) - { - case 0: - nameDistinguisher = ASN1Integer.getInstance(o, false).getValue(); - break; - case 1: - dateOfBirth = ASN1GeneralizedTime.getInstance(o, false); - break; - case 2: - placeOfBirth = DirectoryString.getInstance(o, true); - break; - case 3: - gender = DERPrintableString.getInstance(o, false).getString(); - break; - case 4: - postalAddress = DirectoryString.getInstance(o, true); - break; - default: - throw new IllegalArgumentException("Bad tag number: " + o.getTagNo()); - } - } - } - - /** - * Constructor from a given details. - * - * @param nameOrPseudonym Name or pseudonym. - * @param nameDistinguisher Name distinguisher. - * @param dateOfBirth Date of birth. - * @param placeOfBirth Place of birth. - * @param gender Gender. - * @param postalAddress Postal Address. - */ - public PersonalData(NameOrPseudonym nameOrPseudonym, - BigInteger nameDistinguisher, ASN1GeneralizedTime dateOfBirth, - DirectoryString placeOfBirth, String gender, DirectoryString postalAddress) - { - this.nameOrPseudonym = nameOrPseudonym; - this.dateOfBirth = dateOfBirth; - this.gender = gender; - this.nameDistinguisher = nameDistinguisher; - this.postalAddress = postalAddress; - this.placeOfBirth = placeOfBirth; - } - - public NameOrPseudonym getNameOrPseudonym() - { - return nameOrPseudonym; - } - - public BigInteger getNameDistinguisher() - { - return nameDistinguisher; - } - - public ASN1GeneralizedTime getDateOfBirth() - { - return dateOfBirth; - } - - public DirectoryString getPlaceOfBirth() - { - return placeOfBirth; - } - - public String getGender() - { - return gender; - } - - public DirectoryString getPostalAddress() - { - return postalAddress; - } - - /** - * Produce an object suitable for an ASN1OutputStream. - * <p> - * Returns: - * <pre> - * PersonalData ::= SEQUENCE { - * nameOrPseudonym NameOrPseudonym, - * nameDistinguisher [0] INTEGER OPTIONAL, - * dateOfBirth [1] GeneralizedTime OPTIONAL, - * placeOfBirth [2] DirectoryString OPTIONAL, - * gender [3] PrintableString OPTIONAL, - * postalAddress [4] DirectoryString OPTIONAL - * } - * </pre> - * - * @return a DERObject - */ - public ASN1Primitive toASN1Primitive() - { - ASN1EncodableVector vec = new ASN1EncodableVector(); - vec.add(nameOrPseudonym); - if (nameDistinguisher != null) - { - vec.add(new DERTaggedObject(false, 0, new ASN1Integer(nameDistinguisher))); - } - if (dateOfBirth != null) - { - vec.add(new DERTaggedObject(false, 1, dateOfBirth)); - } - if (placeOfBirth != null) - { - vec.add(new DERTaggedObject(true, 2, placeOfBirth)); - } - if (gender != null) - { - vec.add(new DERTaggedObject(false, 3, new DERPrintableString(gender, true))); - } - if (postalAddress != null) - { - vec.add(new DERTaggedObject(true, 4, postalAddress)); - } - return new DERSequence(vec); - } -} diff --git a/bcprov/src/main/java/org/bouncycastle/asn1/x509/sigi/SigIObjectIdentifiers.java b/bcprov/src/main/java/org/bouncycastle/asn1/x509/sigi/SigIObjectIdentifiers.java deleted file mode 100644 index d338614..0000000 --- a/bcprov/src/main/java/org/bouncycastle/asn1/x509/sigi/SigIObjectIdentifiers.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.bouncycastle.asn1.x509.sigi; - -import org.bouncycastle.asn1.ASN1ObjectIdentifier; - -/** - * Object Identifiers of SigI specifciation (German Signature Law - * Interoperability specification). - */ -public interface SigIObjectIdentifiers -{ - /** - * OID: 1.3.36.8 - */ - public final static ASN1ObjectIdentifier id_sigi = new ASN1ObjectIdentifier("1.3.36.8"); - - /** - * Key purpose IDs for German SigI (Signature Interoperability - * Specification) - * <p> - * OID: 1.3.36.8.2 - */ - public final static ASN1ObjectIdentifier id_sigi_kp = new ASN1ObjectIdentifier("1.3.36.8.2"); - - /** - * Certificate policy IDs for German SigI (Signature Interoperability - * Specification) - * <p> - * OID: 1.3.36.8.1 - */ - public final static ASN1ObjectIdentifier id_sigi_cp = new ASN1ObjectIdentifier("1.3.36.8.1"); - - /** - * Other Name IDs for German SigI (Signature Interoperability Specification) - * <p> - * OID: 1.3.36.8.4 - */ - public final static ASN1ObjectIdentifier id_sigi_on = new ASN1ObjectIdentifier("1.3.36.8.4"); - - /** - * To be used for for the generation of directory service certificates. - * <p> - * OID: 1.3.36.8.2.1 - */ - public static final ASN1ObjectIdentifier id_sigi_kp_directoryService = new ASN1ObjectIdentifier("1.3.36.8.2.1"); - - /** - * ID for PersonalData - * <p> - * OID: 1.3.36.8.4.1 - */ - public static final ASN1ObjectIdentifier id_sigi_on_personalData = new ASN1ObjectIdentifier("1.3.36.8.4.1"); - - /** - * Certificate is conformant to german signature law. - * <p> - * OID: 1.3.36.8.1.1 - */ - public static final ASN1ObjectIdentifier id_sigi_cp_sigconform = new ASN1ObjectIdentifier("1.3.36.8.1.1"); - -} diff --git a/bcprov/src/main/java/org/bouncycastle/asn1/x509/sigi/package.html b/bcprov/src/main/java/org/bouncycastle/asn1/x509/sigi/package.html deleted file mode 100644 index 4e073ce..0000000 --- a/bcprov/src/main/java/org/bouncycastle/asn1/x509/sigi/package.html +++ /dev/null @@ -1,5 +0,0 @@ -<html> -<body bgcolor="#ffffff"> -Support classes for the German SigI (Signature Interoperability Specification) standard. -</body> -</html> |