Package: X509CredentialImpl

X509CredentialImpl

nameinstructionbranchcomplexitylinemethod
X509CredentialImpl(BigInteger, BigInteger)
M: 23 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
X509CredentialImpl(X509Certificate)
M: 16 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
getCRLs()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getCredentalContextSet()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getCredentialType()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getEntityCertificate()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getEntityCertificateChain()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getEntityId()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getKeyNames()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getPrivateKey()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getPublicKey()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getSecretKey()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getSigningCert()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getUsageType()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
3: *
4: * WSO2 Inc. licenses this file to you under the Apache License,
5: * Version 2.0 (the "License"); you may not use this file except
6: * in compliance with the License.
7: * You may obtain a copy of the License at
8: *
9: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing,
12: * software distributed under the License is distributed on an
13: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14: * KIND, either express or implied. See the License for the
15: * specific language governing permissions and limitations
16: * under the License.
17: */
18: package org.wso2.carbon.identity.entitlement.wsxacml;
19:
20: import org.opensaml.xml.security.credential.Credential;
21: import org.opensaml.xml.security.credential.CredentialContextSet;
22: import org.opensaml.xml.security.credential.UsageType;
23: import org.opensaml.xml.security.x509.X509Credential;
24:
25: import javax.crypto.SecretKey;
26: import java.math.BigInteger;
27: import java.security.KeyFactory;
28: import java.security.NoSuchAlgorithmException;
29: import java.security.PrivateKey;
30: import java.security.PublicKey;
31: import java.security.cert.X509CRL;
32: import java.security.cert.X509Certificate;
33: import java.security.spec.InvalidKeySpecException;
34: import java.security.spec.RSAPublicKeySpec;
35: import java.util.Collection;
36:
37: /**
38: * X509Credential implementation for signature verification of self issued tokens. The key is
39: * constructed from modulus and exponent
40: */
41: public class X509CredentialImpl implements X509Credential {
42:
43: private PublicKey publicKey = null;
44: private X509Certificate signingCert = null;
45:
46: /**
47: * The key is constructed from modulus and exponent.
48: *
49: * @param modulus
50: * @param publicExponent
51: * @throws NoSuchAlgorithmException
52: * @throws InvalidKeySpecException
53: */
54: public X509CredentialImpl(BigInteger modulus, BigInteger publicExponent)
55: throws NoSuchAlgorithmException, InvalidKeySpecException {
56: RSAPublicKeySpec spec = new RSAPublicKeySpec(modulus, publicExponent);
57: KeyFactory keyFactory = KeyFactory.getInstance("RSA");
58: publicKey = keyFactory.generatePublic(spec);
59: }
60:
61: public X509CredentialImpl(X509Certificate cert) {
62: publicKey = cert.getPublicKey();
63: signingCert = cert;
64: }
65:
66: /**
67: * Retrieves the publicKey
68: */
69: public PublicKey getPublicKey() {
70: return publicKey;
71: }
72:
73: public X509Certificate getSigningCert() {
74: return signingCert;
75: }
76:
77: // ********** Not implemented **************************************************************
78:
79: public X509Certificate getEntityCertificate() {
80: // TODO Auto-generated method stub
81: return null;
82: }
83:
84: public Collection<X509CRL> getCRLs() {
85: // TODO Auto-generated method stub
86: return null;
87: }
88:
89: public Collection<X509Certificate> getEntityCertificateChain() {
90: // TODO Auto-generated method stub
91: return null;
92: }
93:
94: public CredentialContextSet getCredentalContextSet() {
95: // TODO Auto-generated method stub
96: return null;
97: }
98:
99: public Class<? extends Credential> getCredentialType() {
100: // TODO Auto-generated method stub
101: return null;
102: }
103:
104: public String getEntityId() {
105: // TODO Auto-generated method stub
106: return null;
107: }
108:
109: public Collection<String> getKeyNames() {
110: // TODO Auto-generated method stub
111: return null;
112: }
113:
114: public PrivateKey getPrivateKey() {
115: // TODO Auto-generated method stub
116: return null;
117: }
118:
119: public SecretKey getSecretKey() {
120: // TODO Auto-generated method stub
121: return null;
122: }
123:
124: public UsageType getUsageType() {
125: // TODO Auto-generated method stub
126: return null;
127: }
128: }