本文整理汇总了Java中org.bouncycastle.asn1.DERGeneralString类的典型用法代码示例。如果您正苦于以下问题:Java DERGeneralString类的具体用法?Java DERGeneralString怎么用?Java DERGeneralString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DERGeneralString类属于org.bouncycastle.asn1包,在下文中一共展示了DERGeneralString类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getEntrustVersionExtensionStringValue
import org.bouncycastle.asn1.DERGeneralString; //导入依赖的package包/类
/**
* Get Entrust Version Extension (1.2.840.113533.7.65.0) extension value as a string.
*
* @param bValue The octet string value
* @return Extension value as a string
* @throws IOException If an I/O problem occurs
*/
private String getEntrustVersionExtensionStringValue(byte[] bValue)
throws IOException
{
// SEQUENCE encapsulated in a OCTET STRING
ASN1Sequence as = (ASN1Sequence) ASN1Primitive.fromByteArray(bValue);
// Also has BIT STRING, ignored here
// http://www.mail-archive.com/[email protected]/msg06546.html
return escapeHtml(((DERGeneralString) as.getObjectAt(0)).getString());
}
开发者ID:gavioto,项目名称:portecle,代码行数:17,代码来源:X509Ext.java
示例2: getEntrustVersionInformationStringValue
import org.bouncycastle.asn1.DERGeneralString; //导入依赖的package包/类
private String getEntrustVersionInformationStringValue(byte[] value) throws IOException {
// @formatter:off
/*
* EntrustVersInfoSyntax ::= OCTET STRING
*
* entrustVersInfo EXTENSION ::= { SYNTAX EntrustVersInfoSyntax,
* IDENTIFIED BY {id-entrust 0} }
*
* EntrustVersInfoSyntax ::= ASN1Sequence { entrustVers GeneralString,
* entrustInfoFlags EntrustInfoFlags }
*
* EntrustInfoFlags ::= BIT STRING { keyUpdateAllowed newExtensions (1),
* pKIXCertificate (2) }
*/
// @formatter:on
StringBuilder sb = new StringBuilder();
ASN1Sequence entrustVersInfo = (ASN1Sequence) ASN1Primitive.fromByteArray(value);
DERGeneralString entrustVers = (DERGeneralString) entrustVersInfo.getObjectAt(0);
DERBitString entrustInfoFlags = (DERBitString) entrustVersInfo.getObjectAt(1);
sb.append(MessageFormat.format(res.getString("EntrustVersion"), entrustVers.getString()));
sb.append(NEWLINE);
sb.append(MessageFormat.format(res.getString("EntrustInformationFlags"), entrustInfoFlags.getString()));
sb.append(NEWLINE);
return sb.toString();
}
开发者ID:kaikramer,项目名称:keystore-explorer,代码行数:33,代码来源:X509Ext.java
示例3: dumpString
import org.bouncycastle.asn1.DERGeneralString; //导入依赖的package包/类
private String dumpString(ASN1String asn1String) {
StringBuilder sb = new StringBuilder();
sb.append(indentSequence.toString(indentLevel));
if (asn1String instanceof DERBMPString) {
sb.append("BMP STRING=");
} else if (asn1String instanceof DERGeneralString) {
sb.append("GENERAL STRING=");
} else if (asn1String instanceof DERIA5String) {
sb.append("IA5 STRING=");
} else if (asn1String instanceof DERNumericString) {
sb.append("NUMERIC STRING=");
} else if (asn1String instanceof DERPrintableString) {
sb.append("PRINTABLE STRING=");
} else if (asn1String instanceof DERT61String) {
sb.append("TELETEX STRING=");
} else if (asn1String instanceof DERUniversalString) {
sb.append("UNIVERSAL STRING=");
} else if (asn1String instanceof DERUTF8String) {
sb.append("UTF8 STRING=");
} else if (asn1String instanceof DERVisibleString) {
sb.append("VISIBLE STRING=");
} else {
sb.append("UNKNOWN STRING=");
}
sb.append("'");
sb.append(asn1String.getString());
sb.append("'");
sb.append(NEWLINE);
return sb.toString();
}
开发者ID:kaikramer,项目名称:keystore-explorer,代码行数:35,代码来源:Asn1Dump.java
示例4: putGeneralString
import org.bouncycastle.asn1.DERGeneralString; //导入依赖的package包/类
DerOutputStream putGeneralString(String s) throws IOException {
aos.writeObject(new DERGeneralString(s));
return this;
}
开发者ID:cbsit,项目名称:JaasLounge,代码行数:5,代码来源:DerOutputStream.java
示例5: getGeneralString
import org.bouncycastle.asn1.DERGeneralString; //导入依赖的package包/类
String getGeneralString() throws IOException {
DERGeneralString obj = DERGeneralString.getInstance(is.readObject());
return obj.getString();
}
开发者ID:cbsit,项目名称:JaasLounge,代码行数:5,代码来源:DerInputStream.java
示例6: perform
import org.bouncycastle.asn1.DERGeneralString; //导入依赖的package包/类
public TestResult perform()
{
byte[] data = { 0, 1, 0, 1, 0, 0, 1 };
ASN1Primitive values[] = {
new BERConstructedOctetString(data),
new BERSequence(new DERPrintableString("hello world")),
new BERSet(new DERPrintableString("hello world")),
new BERTaggedObject(0, new DERPrintableString("hello world")),
new DERApplicationSpecific(0, data),
new DERBitString(data),
new DERBMPString("hello world"),
new DERBoolean(true),
new DERBoolean(false),
new DEREnumerated(100),
new DERGeneralizedTime("20070315173729Z"),
new DERGeneralString("hello world"),
new DERIA5String("hello"),
new DERInteger(1000),
new DERNull(),
new DERNumericString("123456"),
new DERObjectIdentifier("1.1.1.10000.1"),
new DEROctetString(data),
new DERPrintableString("hello world"),
new DERSequence(new DERPrintableString("hello world")),
new DERSet(new DERPrintableString("hello world")),
new DERT61String("hello world"),
new DERTaggedObject(0, new DERPrintableString("hello world")),
new DERUniversalString(data),
new DERUTCTime(new Date()),
new DERUTF8String("hello world"),
new DERVisibleString("hello world")
};
try
{
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
ASN1OutputStream aOut = new ASN1OutputStream(bOut);
for (int i = 0; i != values.length; i++)
{
aOut.writeObject(values[i]);
}
ASN1Primitive[] readValues = new ASN1Primitive[values.length];
ByteArrayInputStream bIn = new ByteArrayInputStream(bOut.toByteArray());
ASN1InputStream aIn = new ASN1InputStream(bIn);
for (int i = 0; i != values.length; i++)
{
ASN1Primitive o = aIn.readObject();
if (!o.equals(values[i]))
{
return new SimpleTestResult(false, getName() + ": Failed equality test for " + o.getClass());
}
if (o.hashCode() != values[i].hashCode())
{
return new SimpleTestResult(false, getName() + ": Failed hashCode test for " + o.getClass());
}
}
}
catch (Exception e)
{
return new SimpleTestResult(false, getName() + ": Failed - exception " + e.toString(), e);
}
return new SimpleTestResult(true, getName() + ": Okay");
}
开发者ID:credentials,项目名称:irma_future_id,代码行数:71,代码来源:EqualsAndHashCodeTest.java
示例7: getVOMSFQANs
import org.bouncycastle.asn1.DERGeneralString; //导入依赖的package包/类
public ArrayList<String> getVOMSFQANs() throws Exception
{
ArrayList<String> theseFQANs = new ArrayList<String>() ;
try
{
// could have more than one AC in here...
for( Enumeration a = this.attributes.getObjects() ; a.hasMoreElements() ; )
{
ASN1Sequence sequence = (ASN1Sequence) a.nextElement() ;
// sequence contains the OID [voms 4] (as a DERObjectIdentifier) at address 0 , and an SET at address 1
ASN1Set set = (ASN1Set) sequence.getObjectAt( 1 ) ;
// set contains only a SEQUENCE at address 0
ASN1Sequence sequence2 = (ASN1Sequence) set.getObjectAt( 0 ) ;
// sequence2 contains a TAGGED OBJECT ad address 0 and another SEQUENCE at address 1
ASN1TaggedObject taggedObject = (ASN1TaggedObject) sequence2.getObjectAt( 0 ) ;
// dig down the tagged object... (undocumented?) - TagNumber value is 0
ASN1TaggedObject taggedObject2 = (ASN1TaggedObject) taggedObject.getObject() ;
// this tagged object has TagNumber value of 6 (?)
ASN1OctetString originOctetString = (ASN1OctetString) taggedObject2.getObject() ;
String origin = ( new DERGeneralString( originOctetString.getOctets() ) ).getString() ;
ASN1Sequence fqanSequence = (ASN1Sequence) sequence2.getObjectAt( 1 ) ;
// this is the actual sequence of FQANs
for( int fqan = 0 ; fqan < fqanSequence.size() ; fqan ++ )
{
ASN1OctetString fqanOctetString = (ASN1OctetString) fqanSequence.getObjectAt( fqan ) ;
String FQAN_Value = ( new DERGeneralString( fqanOctetString.getOctets() ) ).getString() ;
theseFQANs.add( FQAN_Value ) ;
}
}
}
catch( Exception e )
{
throw e ;
}
return theseFQANs ;
}
开发者ID:NLeSC,项目名称:vbrowser,代码行数:45,代码来源:VOMSAttributeCertificate.java
示例8: setVOMSFQANs
import org.bouncycastle.asn1.DERGeneralString; //导入依赖的package包/类
public void setVOMSFQANs( String[] fqans ) throws Exception
{
try
{
//--------------------------------------------------------------------------
// put the FQANs into the SEQUENCE
DEREncodableVector fqanVector = new ASN1EncodableVector() ;
for( int f = 0 ; f < fqans.length ; f ++ )
{
DERGeneralString fqan = new DERGeneralString( fqans[f] ) ;
ASN1OctetString fqanOctetString = ASN1OctetString.getInstance( new DEROctetString( fqan.getOctets() ) ) ;
fqanVector.add( fqanOctetString ) ;
}
ASN1Sequence fqanSequence = ASN1Sequence.getInstance( new DERSequence( fqanVector ) ) ;
//--------------------------------------------------------------------------
// put something into the undocumented TaggedObject
DERGeneralString origin = new DERGeneralString( "gridportal://newvoms:15000" ) ;
ASN1OctetString originOctetString = ASN1OctetString.getInstance( new DEROctetString( origin.getOctets() ) ) ;
/*
ASN1TaggedObject taggedObject2 = ASN1TaggedObject.getInstance( new DERTaggedObject( 6 , originOctetString ) , true ) ;
ASN1TaggedObject taggedObject = ASN1TaggedObject.getInstance( new DERTaggedObject( 0 , taggedObject2 ) , true ) ;
DEROctetString originOctetString = new DEROctetString( origin.getOctets() ) ;
*/
DERTaggedObject taggedObject2 = new DERTaggedObject( 6 , originOctetString ) ;
DERTaggedObject taggedObject = new DERTaggedObject( 0 , taggedObject2 ) ;
//--------------------------------------------------------------------------
// put the taggedObject and then the fqanSequence into sequence2
DEREncodableVector sequence2Vector = new ASN1EncodableVector() ;
sequence2Vector.add( taggedObject ) ;
sequence2Vector.add( fqanSequence ) ;
ASN1Sequence sequence2 = ASN1Sequence.getInstance( new DERSequence( sequence2Vector ) ) ;
//--------------------------------------------------------------------------
// the SET has one member - sequence2
ASN1Set set = ASN1Set.getInstance( new DERSet( sequence2 ) ) ;
//--------------------------------------------------------------------------
// SEQUENCE sequence has an OID and the set
DERObjectIdentifier voms4oid = new DERObjectIdentifier( "1.3.6.1.4.1.8005.100.100.4" ) ;
DEREncodableVector sequenceVector = new ASN1EncodableVector() ;
sequenceVector.add( voms4oid ) ;
sequenceVector.add( set ) ;
ASN1Sequence sequence = ASN1Sequence.getInstance( new DERSequence( sequenceVector ) ) ;
//--------------------------------------------------------------------------
this.attributes = ASN1Sequence.getInstance( new DERSequence( sequence ) ) ;
}
catch( Exception e )
{
throw e ;
}
}
开发者ID:NLeSC,项目名称:vbrowser,代码行数:72,代码来源:VOMSAttributeCertificate.java
注:本文中的org.bouncycastle.asn1.DERGeneralString类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论