From 667af128d0adfeee2aa4748ab58411c91bc4905f Mon Sep 17 00:00:00 2001 From: mcentner Date: Tue, 26 Jan 2010 16:27:04 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/mocca/branches/mocca-1.2.11-sha2@600 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/idlink/ans1/CitizenPublicKey.java | 92 ------ .../java/at/gv/egiz/idlink/ans1/IdentityLink.java | 315 --------------------- .../java/at/gv/egiz/idlink/ans1/PersonData.java | 91 ------ .../at/gv/egiz/idlink/ans1/PhysicalPersonData.java | 143 ---------- 4 files changed, 641 deletions(-) delete mode 100644 mocca-1.2.11/utils/src/main/java/at/gv/egiz/idlink/ans1/CitizenPublicKey.java delete mode 100644 mocca-1.2.11/utils/src/main/java/at/gv/egiz/idlink/ans1/IdentityLink.java delete mode 100644 mocca-1.2.11/utils/src/main/java/at/gv/egiz/idlink/ans1/PersonData.java delete mode 100644 mocca-1.2.11/utils/src/main/java/at/gv/egiz/idlink/ans1/PhysicalPersonData.java (limited to 'mocca-1.2.11/utils/src/main/java/at/gv/egiz/idlink/ans1') diff --git a/mocca-1.2.11/utils/src/main/java/at/gv/egiz/idlink/ans1/CitizenPublicKey.java b/mocca-1.2.11/utils/src/main/java/at/gv/egiz/idlink/ans1/CitizenPublicKey.java deleted file mode 100644 index c32cf2b9..00000000 --- a/mocca-1.2.11/utils/src/main/java/at/gv/egiz/idlink/ans1/CitizenPublicKey.java +++ /dev/null @@ -1,92 +0,0 @@ -/* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package at.gv.egiz.idlink.ans1; - -import java.math.BigInteger; - -import iaik.asn1.*; - -/** - * This class implements the ASN.1 representation of the - * CitizenPublicKey of a compressed identity link. - * - *
CitizenPublicKey ::= CHOICE { 
-    onToken [0] INTEGER, 
-    referenceURL [1] UTF8String, 
-    x509Data [2] SubjectPublicKeyInfo 
-}  
-
- * - * @author mivkovic@egiz.gv.at, mcentner@egiz.gv.at - */ -public class CitizenPublicKey implements ASN1Type { - - /** - * onToken - */ - private int onToken; // INTEGER - - /** - * Creates a new CitizenPublicKey with the given - * onToken value. - * - * @param onToken - */ - public CitizenPublicKey(int onToken) { - this.onToken = onToken; - } - - /** - * Creates a new CitizenPublicKey from the given ASN.1 representation. - * - * @param obj - * @throws CodingException - */ - public CitizenPublicKey(ASN1Object obj) throws CodingException { - decode(obj); - } - - @Override - public void decode(ASN1Object obj) throws CodingException { - try { - BigInteger Value = (BigInteger)(obj.getValue()); - onToken = Value.intValue(); - } catch (Exception ex) { - throw new CodingException(ex.toString()); - } - } - - @Override - public ASN1Object toASN1Object() { - INTEGER ot = new INTEGER(onToken); - return ot; - } - - /** - * Returns the DER encoding of this CitizenPublicKey. - * - * @return the DER encoding of this CitizenPublicKey - */ - public byte[] getEncoded() { - return DerCoder.encode(toASN1Object()); - } - - public int getOnToken() { - return onToken; - } - -} \ No newline at end of file diff --git a/mocca-1.2.11/utils/src/main/java/at/gv/egiz/idlink/ans1/IdentityLink.java b/mocca-1.2.11/utils/src/main/java/at/gv/egiz/idlink/ans1/IdentityLink.java deleted file mode 100644 index 37e4b240..00000000 --- a/mocca-1.2.11/utils/src/main/java/at/gv/egiz/idlink/ans1/IdentityLink.java +++ /dev/null @@ -1,315 +0,0 @@ -/* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package at.gv.egiz.idlink.ans1; - -import iaik.asn1.ASN1Object; -import iaik.asn1.ASN1Type; -import iaik.asn1.BIT_STRING; -import iaik.asn1.CON_SPEC; -import iaik.asn1.CodingException; -import iaik.asn1.DerCoder; -import iaik.asn1.INTEGER; -import iaik.asn1.SEQUENCE; -import iaik.asn1.UTF8String; - -/** - * This class impelments an ASN.1 representation of the compressed IdentiyLink. - *
-PersonenBindung ::= SEQUENCE { 
-    version INTEGER, 
-    issuerTemplate UTF8String, 
-    assertionID UTF8String, 
-    issueInstant UTF8String, 
-    personData PersonData, 
-    citizenPublicKey SEQUENCE SIZE (1..MAX) OF CitizenPublicKey, 
-    signatureValue BIT STRING, 
-    referenceDigest [0] BIT STRING OPTIONAL, 
-    referenceManifestDigest [1] BIT STRING OPTIONAL, 
-    manifestReferenceDigest [2] BIT STRING OPTIONAL 
-} 
-
- * - * @author mivkovic@egiz.gv.at, mcentner@egiz.gv.at - */ -public class IdentityLink implements ASN1Type { - - private int version = 1; // INTEGER - private String issuerTemplate; // UTF8String - private String assertionID; // UTF8String - private String issueInstant; // UTF8String - private PersonData personData; // PersonData - private CitizenPublicKey[] citizenPublicKeys; // SEQUENCE SIZE (1..MAX) OF - private byte[] signatureValue; // BIT STRING - private byte[] referenceDigest; // BIT STRING OPTIONAL - private byte[] referenceManifestDigest; // BIT STRING OPTIONAL - private byte[] manifestReferenceDigest; // BIT STRING OPTIONAL - - /** - * Creates a new IdentityLink with the given - * issuerTemplate, assertionID, - * issueInstant, personData, - * citizenPublicKeys and signatureValue. - * - * @param issuerTemplate - * @param assertionID - * @param issueInstant - * @param personData - * @param citizenPublicKeys - * @param signatureValue - */ - public IdentityLink(String issuerTemplate, String assertionID, - String issueInstant, PersonData personData, - CitizenPublicKey[] citizenPublicKeys, byte[] signatureValue) { - this.issuerTemplate = issuerTemplate; - this.assertionID = assertionID; - this.issueInstant = issueInstant; - this.personData = personData; - this.citizenPublicKeys = citizenPublicKeys; - this.signatureValue = signatureValue; - } - - /** - * Create a new IdentityLink from an ASN1Object. - * - * @param identiyLink - * @throws CodingException - */ - public IdentityLink(ASN1Object identiyLink) throws CodingException { - decode(identiyLink); - } - - @Override - public void decode(ASN1Object obj) throws CodingException { - issuerTemplate = (String) ((ASN1Object) obj.getComponentAt(1)).getValue(); - assertionID = (String) ((ASN1Object) obj.getComponentAt(2)).getValue(); - issueInstant = (String) ((ASN1Object) obj.getComponentAt(3)).getValue(); - - if (((CON_SPEC) obj.getComponentAt(4)).getAsnType().getTag() == 0) - personData = new PersonData((ASN1Object) obj.getComponentAt(4).getValue()); - else { - throw new CodingException("CorporateBodyData currently not supported."); - } - - SEQUENCE publicKeySequence = (SEQUENCE) obj.getComponentAt(5); - int anz = publicKeySequence.countComponents(); - citizenPublicKeys = new CitizenPublicKey[anz]; - for (int i = 0; i < citizenPublicKeys.length; i++) { - CON_SPEC tmp = (CON_SPEC) publicKeySequence.getComponentAt(i); - if (tmp.getAsnType().getTag() == 0) { - citizenPublicKeys[i] = new CitizenPublicKey((ASN1Object) tmp.getValue()); - } else { - throw new CodingException( - "Currently only PublicKeys on token are supported."); - } - } - - signatureValue = (byte[]) ((ASN1Object) obj.getComponentAt(6)).getValue(); - - for (int i = 7; i < obj.countComponents(); i++) { - CON_SPEC tmp = (CON_SPEC) obj.getComponentAt(i); - switch (tmp.getAsnType().getTag()) { - case 0: - referenceDigest = (byte[]) ((BIT_STRING) tmp.getValue()).getValue(); - break; - case 1: - referenceManifestDigest = (byte[]) ((BIT_STRING) tmp.getValue()) - .getValue(); - break; - case 2: - manifestReferenceDigest = (byte[]) ((BIT_STRING) tmp.getValue()) - .getValue(); - break; - } - - } - - } - - @Override - public ASN1Object toASN1Object() { - SEQUENCE pb = new SEQUENCE(); - pb.addComponent(new INTEGER(version)); - pb.addComponent(new UTF8String(issuerTemplate)); - pb.addComponent(new UTF8String(assertionID)); - pb.addComponent(new UTF8String(issueInstant)); - - pb.addComponent(new CON_SPEC(0, personData.toASN1Object())); - SEQUENCE seq = new SEQUENCE(); - for (int i = 0; i < citizenPublicKeys.length; i++) { - seq.addComponent(new CON_SPEC(0, citizenPublicKeys[i].toASN1Object())); - } - pb.addComponent(seq); - pb.addComponent(new BIT_STRING(signatureValue)); - if (referenceDigest != null) - pb.addComponent(new CON_SPEC(0, new BIT_STRING(referenceDigest))); - if (referenceManifestDigest != null) - pb.addComponent(new CON_SPEC(1, new BIT_STRING(referenceManifestDigest))); - if (manifestReferenceDigest != null) - pb.addComponent(new CON_SPEC(2, new BIT_STRING(manifestReferenceDigest))); - return pb; - } - - /** - * Returns the DER encoding of this IdentityLink. - * - * @return the DER encoding of this IdentityLink - */ - public byte[] toByteArray() { - return DerCoder.encode(toASN1Object()); - } - - /** - * @return the version - */ - public int getVersion() { - return version; - } - - /** - * @param version the version to set - */ - public void setVersion(int version) { - this.version = version; - } - - /** - * @return the issuerTemplate - */ - public String getIssuerTemplate() { - return issuerTemplate; - } - - /** - * @param issuerTemplate the issuerTemplate to set - */ - public void setIssuerTemplate(String issuerTemplate) { - this.issuerTemplate = issuerTemplate; - } - - /** - * @return the assertionID - */ - public String getAssertionID() { - return assertionID; - } - - /** - * @param assertionID the assertionID to set - */ - public void setAssertionID(String assertionID) { - this.assertionID = assertionID; - } - - /** - * @return the issueInstant - */ - public String getIssueInstant() { - return issueInstant; - } - - /** - * @param issueInstant the issueInstant to set - */ - public void setIssueInstant(String issueInstant) { - this.issueInstant = issueInstant; - } - - /** - * @return the personData - */ - public PersonData getPersonData() { - return personData; - } - - /** - * @param personData the personData to set - */ - public void setPersonData(PersonData personData) { - this.personData = personData; - } - - /** - * @return the citizenPublicKeys - */ - public CitizenPublicKey[] getCitizenPublicKeys() { - return citizenPublicKeys; - } - - /** - * @param citizenPublicKeys the citizenPublicKeys to set - */ - public void setCitizenPublicKeys(CitizenPublicKey[] citizenPublicKeys) { - this.citizenPublicKeys = citizenPublicKeys; - } - - /** - * @return the signatureValue - */ - public byte[] getSignatureValue() { - return signatureValue; - } - - /** - * @param signatureValue the signatureValue to set - */ - public void setSignatureValue(byte[] signatureValue) { - this.signatureValue = signatureValue; - } - - /** - * @return the referenceDigest - */ - public byte[] getReferenceDigest() { - return referenceDigest; - } - - /** - * @param referenceDigest the referenceDigest to set - */ - public void setReferenceDigest(byte[] referenceDigest) { - this.referenceDigest = referenceDigest; - } - - /** - * @return the referenceManifestDigest - */ - public byte[] getReferenceManifestDigest() { - return referenceManifestDigest; - } - - /** - * @param referenceManifestDigest the referenceManifestDigest to set - */ - public void setReferenceManifestDigest(byte[] referenceManifestDigest) { - this.referenceManifestDigest = referenceManifestDigest; - } - - /** - * @return the manifestReferenceDigest - */ - public byte[] getManifestReferenceDigest() { - return manifestReferenceDigest; - } - - /** - * @param manifestReferenceDigest the manifestReferenceDigest to set - */ - public void setManifestReferenceDigest(byte[] manifestReferenceDigest) { - this.manifestReferenceDigest = manifestReferenceDigest; - } - -} diff --git a/mocca-1.2.11/utils/src/main/java/at/gv/egiz/idlink/ans1/PersonData.java b/mocca-1.2.11/utils/src/main/java/at/gv/egiz/idlink/ans1/PersonData.java deleted file mode 100644 index 2a537eb3..00000000 --- a/mocca-1.2.11/utils/src/main/java/at/gv/egiz/idlink/ans1/PersonData.java +++ /dev/null @@ -1,91 +0,0 @@ -/* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package at.gv.egiz.idlink.ans1; - -import iaik.asn1.*; - -/** - * This class represents the ASN.1 version of the PersonData - * of a compressed identity link. - * - *
-PersonData ::= CHOICE { 
-    physcialPerson [0] PhysicalPersonData, 
-    corporateBody [1] CorporateBodyData 
-} 
- * - * @author mivkovic@egiz.gv.at, mcentner@egiz.gv.at - * - */ -public class PersonData implements ASN1Type { - - /** - * physicalPerson - */ - private PhysicalPersonData physicalPerson; // PhysicalPersonData - - /** - * Creates a new PersonData with the given - * physicalPersonData. - * - * @param physicalPersonData - */ - public PersonData(PhysicalPersonData physicalPersonData) { - physicalPerson = physicalPersonData; - } - - /** - * Creates a new PersonData from its ASN.1 representation. - * - * @param obj - * @throws CodingException - */ - public PersonData(ASN1Object obj) throws CodingException { - decode(obj); - } - - @Override - public void decode(ASN1Object obj) throws CodingException { - try { - physicalPerson = new PhysicalPersonData(obj); - } catch (Exception ex) { - throw new CodingException(ex.toString()); - } - } - - @Override - public ASN1Object toASN1Object() { - return physicalPerson.toASN1Object(); - } - - /** - * Returns the DER encoded representation of this PersonData. - * - * @return the DER encoded representation of this PersonData - */ - public byte[] getEncoded() { - return DerCoder.encode(toASN1Object()); - } - - /** - * @return the physicalPerson - */ - public PhysicalPersonData getPhysicalPerson() { - return physicalPerson; - } - -} \ No newline at end of file diff --git a/mocca-1.2.11/utils/src/main/java/at/gv/egiz/idlink/ans1/PhysicalPersonData.java b/mocca-1.2.11/utils/src/main/java/at/gv/egiz/idlink/ans1/PhysicalPersonData.java deleted file mode 100644 index a6aea97e..00000000 --- a/mocca-1.2.11/utils/src/main/java/at/gv/egiz/idlink/ans1/PhysicalPersonData.java +++ /dev/null @@ -1,143 +0,0 @@ -/* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package at.gv.egiz.idlink.ans1; - -import iaik.asn1.*; - -/** - * This class represents the ASN.1 version of the PhysicalPersonData - * of an compressed identity link. - * - *
PhysicalPersonData ::= SEQUENCE { 
-    baseId UTF8String, 
-    givenName UTF8String, 
-    familyName UTF8String, 
-    dateOfBirth UTF8String
-}
- * - * @author mivkovic@egiz.gv.at, mcentner@eigz.gv.at - */ -public class PhysicalPersonData implements ASN1Type { - - /** - * baseId - */ - private String baseId; // UTF8String - - /** - * givenName - */ - private String givenName; // UTF8String - - /** - * familyName - */ - private String familyName; // UTF8String - - /** - * dataOfBirth - */ - private String dateOfBirth; // UTF8String - - /** - * Creates a new PhysicalPersonData with the - * given baseId, givenName, familyName - * and dataOfBirth. - * - * @param baseId - * @param givenName - * @param familyName - * @param dateOfBirth - */ - public PhysicalPersonData(String baseId, String givenName, String familyName, String dateOfBirth) { - this.baseId = baseId; - this.givenName = givenName; - this.familyName = familyName; - this.dateOfBirth = dateOfBirth; - } - - /** - * Creates a new PhysicalPersonData from its ASN.1 representation. - * - * @param obj - * - * @throws CodingException - */ - public PhysicalPersonData(ASN1Object obj) throws CodingException { - decode(obj); - } - - @Override - public void decode(ASN1Object obj) throws CodingException { - try { - baseId = (String) ((ASN1Object) obj.getComponentAt(0)).getValue(); - givenName = (String) ((ASN1Object) obj.getComponentAt(1)).getValue(); - familyName = (String) ((ASN1Object) obj.getComponentAt(2)).getValue(); - dateOfBirth = (String) ((ASN1Object) obj.getComponentAt(3)).getValue(); - } catch (Exception ex) { - throw new CodingException(ex.toString()); - } - } - - @Override - public ASN1Object toASN1Object() { - SEQUENCE ppd = new SEQUENCE(); - ppd.addComponent(new UTF8String(baseId)); - ppd.addComponent(new UTF8String(givenName)); - ppd.addComponent(new UTF8String(familyName)); - ppd.addComponent(new UTF8String(dateOfBirth)); - return ppd; - } - - /** - * Returns the DER encoding of this PhysicalPersonData. - * - * @return the DER encoding of this PhysicalPersonData - */ - public byte[] toByteArray() { - return DerCoder.encode(toASN1Object()); - } - - /** - * @return the baseId - */ - public String getBaseId() { - return baseId; - } - - /** - * @return the givenName - */ - public String getGivenName() { - return givenName; - } - - /** - * @return the familyName - */ - public String getFamilyName() { - return familyName; - } - - /** - * @return the dateOfBirth - */ - public String getDateOfBirth() { - return dateOfBirth; - } - -} \ No newline at end of file -- cgit v1.2.3