Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit105ff88

Browse files
author
Wolfgang Glas
committed
PinAttributes and AuthObjectAtributes.
1 parent68fd879 commit105ff88

File tree

4 files changed

+835
-0
lines changed

4 files changed

+835
-0
lines changed
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
/***********************************************************
2+
* $Id$
3+
*
4+
* PKCS#15 cryptographic provider of the opensc project.
5+
* http://www.opensc-project.org
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*
19+
* Created: 30.12.2007
20+
*
21+
***********************************************************/
22+
23+
packageorg.opensc.pkcs15.asn1.attr;
24+
25+
importjava.util.Enumeration;
26+
27+
importorg.bouncycastle.asn1.ASN1Encodable;
28+
importorg.bouncycastle.asn1.ASN1EncodableVector;
29+
importorg.bouncycastle.asn1.ASN1OctetString;
30+
importorg.bouncycastle.asn1.ASN1Sequence;
31+
importorg.bouncycastle.asn1.DERInteger;
32+
importorg.bouncycastle.asn1.DERObject;
33+
importorg.bouncycastle.asn1.DERSequence;
34+
35+
/**
36+
* <PRE>
37+
* CommonAuthenticationObjectAttributes ::= SEQUENCE {
38+
* authId Identifier,
39+
* ... -- For future extensions
40+
* }
41+
* </PRE>
42+
*
43+
* @author wglas
44+
*/
45+
publicclassCommonAuthenticationObjectAttributesextendsASN1Encodable {
46+
47+
privateASN1OctetStringidentifier;
48+
49+
/**
50+
* Default constructor.
51+
*/
52+
publicCommonAuthenticationObjectAttributes() {
53+
super();
54+
}
55+
56+
/**
57+
* @param obj The ASN.1 object to decode.
58+
* @return An instance of CommonSecretKeyAttributes.
59+
*/
60+
publicstaticCommonAuthenticationObjectAttributesgetInstance (Objectobj)
61+
{
62+
if (objinstanceofCommonAuthenticationObjectAttributes)
63+
return (CommonAuthenticationObjectAttributes)obj;
64+
65+
if (objinstanceofASN1Sequence)
66+
{
67+
ASN1Sequenceseq = (ASN1Sequence)obj;
68+
69+
Enumeration<Object>objs =seq.getObjects();
70+
71+
CommonAuthenticationObjectAttributesret =newCommonAuthenticationObjectAttributes();
72+
73+
while (objs.hasMoreElements()) {
74+
75+
Objecto =objs.nextElement();
76+
77+
if (oinstanceofDERInteger) {
78+
ret.setIdentifier(ASN1OctetString.getInstance(o));
79+
}else
80+
thrownewIllegalArgumentException("Invalid member ["+o+"] in CommonAuthenticationObjectAttributes ASN.1 SEQUENCE.");
81+
}
82+
83+
returnret;
84+
}
85+
86+
thrownewIllegalArgumentException("CommonAuthenticationObjectAttributes must be encoded as an ASN.1 SEQUENCE.");
87+
}
88+
89+
/* (non-Javadoc)
90+
* @see org.bouncycastle.asn1.ASN1Encodable#toASN1Object()
91+
*/
92+
@Override
93+
publicDERObjecttoASN1Object() {
94+
95+
ASN1EncodableVectorv =newASN1EncodableVector();
96+
97+
if (this.identifier !=null)
98+
v.add(this.identifier);
99+
100+
returnnewDERSequence(v);
101+
}
102+
103+
/**
104+
* @return the identifier
105+
*/
106+
publicASN1OctetStringgetIdentifier() {
107+
returnthis.identifier;
108+
}
109+
110+
/**
111+
* @param identifier the identifier to set
112+
*/
113+
publicvoidsetIdentifier(ASN1OctetStringidentifier) {
114+
this.identifier =identifier;
115+
}
116+
117+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp