diff options
Diffstat (limited to 'pki/base/util/src/netscape/security/extensions/SubjectInfoAccessExtension.java')
-rw-r--r-- | pki/base/util/src/netscape/security/extensions/SubjectInfoAccessExtension.java | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/pki/base/util/src/netscape/security/extensions/SubjectInfoAccessExtension.java b/pki/base/util/src/netscape/security/extensions/SubjectInfoAccessExtension.java index 25eb254a9..26d048dc5 100644 --- a/pki/base/util/src/netscape/security/extensions/SubjectInfoAccessExtension.java +++ b/pki/base/util/src/netscape/security/extensions/SubjectInfoAccessExtension.java @@ -17,6 +17,7 @@ // --- END COPYRIGHT BLOCK --- package netscape.security.extensions; + import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -36,15 +37,15 @@ import netscape.security.x509.Extension; import netscape.security.x509.GeneralName; import netscape.security.x509.URIName; + /** - * This represents the subject information access extension as defined in - * RFC3280. - * + * This represents the subject information access extension + * as defined in RFC3280. + * * @author thomask * @version $Revision$, $Date$ */ -public class SubjectInfoAccessExtension extends Extension implements - CertAttrSet { +public class SubjectInfoAccessExtension extends Extension implements CertAttrSet { /** * */ @@ -53,12 +54,12 @@ public class SubjectInfoAccessExtension extends Extension implements public static final String NAME = "SubjectInfoAccessExtension"; public static final int OID_OCSP[] = { 1, 3, 6, 1, 5, 5, 7, 48, 1 }; - public static final ObjectIdentifier METHOD_OCSP = new ObjectIdentifier( - OID_OCSP); + public static final ObjectIdentifier METHOD_OCSP = new + ObjectIdentifier(OID_OCSP); public static final int OID_CA_ISSUERS[] = { 1, 3, 6, 1, 5, 5, 7, 48, 2 }; - public static final ObjectIdentifier METHOD_CA_ISSUERS = new ObjectIdentifier( - OID_CA_ISSUERS); + public static final ObjectIdentifier METHOD_CA_ISSUERS = new + ObjectIdentifier(OID_CA_ISSUERS); public static final int OID[] = { 1, 3, 6, 1, 5, 5, 7, 1, 11 }; public static final ObjectIdentifier ID = new ObjectIdentifier(OID); @@ -67,7 +68,7 @@ public class SubjectInfoAccessExtension extends Extension implements /** * Create the extension from the passed DER encoded value of the same. - * + * * @param critical true if the extension is to be treated as critical. * @param value Array of DER encoded bytes of the actual value. * @exception IOException on error. @@ -78,8 +79,8 @@ public class SubjectInfoAccessExtension extends Extension implements this.extensionValue = null; // build this when encodeThis() is called } - public SubjectInfoAccessExtension(Boolean critical, Object value) - throws IOException { + public SubjectInfoAccessExtension(Boolean critical, Object value) + throws IOException { this.extensionId = ID; this.critical = critical.booleanValue(); this.extensionValue = (byte[]) ((byte[]) value).clone(); @@ -134,8 +135,10 @@ public class SubjectInfoAccessExtension extends Extension implements /** * Adds Access Description. */ - public void addAccessDescription(ObjectIdentifier method, GeneralName gn) { - clearValue(); + public void addAccessDescription( + ObjectIdentifier method, + GeneralName gn) { + clearValue(); mDesc.addElement(new AccessDescription(method, gn)); } @@ -154,8 +157,7 @@ public class SubjectInfoAccessExtension extends Extension implements DerValue val = new DerValue(this.extensionValue); if (val.tag != DerValue.tag_Sequence) { - throw new IOException( - "Invalid encoding of AuthInfoAccess extension"); + throw new IOException("Invalid encoding of AuthInfoAccess extension"); } while (val.data.available() != 0) { DerValue seq = val.data.getDerValue(); @@ -166,7 +168,7 @@ public class SubjectInfoAccessExtension extends Extension implements } } - private void encodeThis() throws IOException { + private void encodeThis() throws IOException { DerOutputStream seq = new DerOutputStream(); DerOutputStream tmp = new DerOutputStream(); @@ -181,10 +183,10 @@ public class SubjectInfoAccessExtension extends Extension implements seq.write(DerValue.tag_Sequence, tmp); this.extensionValue = seq.toByteArray(); } - + /** * Write the extension to the DerOutputStream. - * + * * @param out the DerOutputStream to write the extension to. * @exception IOException on encoding errors. */ @@ -216,21 +218,20 @@ public class SubjectInfoAccessExtension extends Extension implements public static void main(String[] argv) { AuthInfoAccessExtension aia = new AuthInfoAccessExtension(false); - GeneralName ocspName = new GeneralName(new URIName( - "http://ocsp.netscape.com")); + GeneralName ocspName = new GeneralName(new + URIName("http://ocsp.netscape.com")); aia.addAccessDescription(METHOD_OCSP, ocspName); - GeneralName caIssuersName = new GeneralName(new URIName( - "http://ocsp.netscape.com")); + GeneralName caIssuersName = new GeneralName(new + URIName("http://ocsp.netscape.com")); - aia.addAccessDescription(METHOD_CA_ISSUERS, caIssuersName); + aia.addAccessDescription(METHOD_CA_ISSUERS, caIssuersName); ByteArrayOutputStream os = new ByteArrayOutputStream(); try { aia.encode(os); - System.out - .println(com.netscape.osutil.OSUtil.BtoA(os.toByteArray())); + System.out.println(com.netscape.osutil.OSUtil.BtoA(os.toByteArray())); } catch (IOException e) { System.out.println(e.toString()); } @@ -245,8 +246,8 @@ public class SubjectInfoAccessExtension extends Extension implements ByteArrayInputStream bis = new ByteArrayInputStream( bos.toByteArray()); ObjectInputStream ois = new ObjectInputStream(bis); - AuthInfoAccessExtension clone = (AuthInfoAccessExtension) ois - .readObject(); + AuthInfoAccessExtension clone = (AuthInfoAccessExtension) + ois.readObject(); System.out.println(clone); } catch (Exception e) { |