org.bouncycastle.asn1.esf.SPUserNotice Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcprov-jdk15 Show documentation
Show all versions of bcprov-jdk15 Show documentation
The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. This jar contains JCE provider and lightweight API for the Bouncy Castle Cryptography APIs for JDK 1.5.
package org.bouncycastle.asn1.esf;
import org.bouncycastle.asn1.x509.NoticeReference;
import org.bouncycastle.asn1.x509.DisplayText;
import org.bouncycastle.asn1.*;
import java.util.Enumeration;
public class SPUserNotice
{
private NoticeReference noticeRef;
private DisplayText explicitText;
public static SPUserNotice getInstance(
Object obj)
{
if (obj == null || obj instanceof SPUserNotice)
{
return (SPUserNotice) obj;
}
else if (obj instanceof ASN1Sequence)
{
return new SPUserNotice((ASN1Sequence) obj);
}
throw new IllegalArgumentException(
"unknown object in 'SPUserNotice' factory : "
+ obj.getClass().getName() + ".");
}
public SPUserNotice(
ASN1Sequence seq)
{
Enumeration e = seq.getObjects();
while (e.hasMoreElements())
{
DEREncodable object = (DEREncodable) e.nextElement();
if (object instanceof NoticeReference)
{
noticeRef = NoticeReference.getInstance(object);
}
else if (object instanceof DisplayText)
{
explicitText = DisplayText.getInstance(object);
}
else
{
throw new IllegalArgumentException("Invalid element in 'SPUserNotice'.");
}
}
}
public SPUserNotice(
NoticeReference noticeRef,
DisplayText explicitText)
{
this.noticeRef = noticeRef;
this.explicitText = explicitText;
}
public NoticeReference getNoticeRef()
{
return noticeRef;
}
public DisplayText getExplicitText()
{
return explicitText;
}
/**
*
* SPUserNotice ::= SEQUENCE {
* noticeRef NoticeReference OPTIONAL,
* explicitText DisplayText OPTIONAL }
*
*/
public DERObject toASN1Object()
{
ASN1EncodableVector v = new ASN1EncodableVector();
if (noticeRef != null)
{
v.add(noticeRef);
}
if (explicitText != null)
{
v.add(explicitText);
}
return new DERSequence(v);
}
}