1 23 24 package com.sun.enterprise.security.jauth.callback; 25 26 import java.math.BigInteger ; 27 import java.security.PrivateKey ; 28 import java.security.cert.Certificate ; 29 import javax.security.auth.callback.Callback ; 30 import javax.security.auth.x500.X500Principal ; 31 32 37 public class PrivateKeyCallback implements Callback { 38 39 private Request request; 40 private PrivateKey key; 41 private Certificate [] chain; 42 43 46 public static interface Request { }; 47 48 51 public static class AliasRequest implements Request { 52 private String alias; 53 54 66 public AliasRequest(String alias) { 67 this.alias = alias; 68 } 69 70 75 public String getAlias() { 76 return alias; 77 } 78 } 79 80 83 public static class SubjectKeyIDRequest implements Request { 84 private byte[] id; 85 86 98 public SubjectKeyIDRequest(byte[] subjectKeyID) { 99 if (subjectKeyID != null) { 100 this.id = (byte[])subjectKeyID.clone(); 101 } 102 } 103 104 109 public byte[] getSubjectKeyID() { 110 return id; 111 } 112 } 113 114 118 public static class IssuerSerialNumRequest implements Request { 119 private X500Principal issuer; 120 private BigInteger serialNum; 121 122 139 public IssuerSerialNumRequest(X500Principal issuer, 140 BigInteger serialNumber) { 141 this.issuer = issuer; 142 this.serialNum = serialNumber; 143 } 144 145 150 public X500Principal getIssuer() { 151 return issuer; 152 } 153 154 159 public BigInteger getSerialNum() { 160 return serialNum; 161 } 162 } 163 164 176 public PrivateKeyCallback(Request request) { 177 this.request = request; 178 } 179 180 187 public Request getRequest() { 188 return request; 189 } 190 191 200 public void setKey(PrivateKey key, Certificate [] chain) { 201 this.key = key; 202 this.chain = chain; 203 } 204 205 210 public PrivateKey getKey() { 211 return key; 212 } 213 214 219 public Certificate [] getChain() { 220 return chain; 221 } 222 } 223 | Popular Tags |