All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javax.xml.crypto.KeySelector Maven / Gradle / Ivy

The newest version!
/*     */ package javax.xml.crypto;
/*     */ 
/*     */ import java.security.Key;
/*     */ import javax.xml.crypto.dsig.keyinfo.KeyInfo;
/*     */ 
/*     */ public abstract class KeySelector
/*     */ {
/*     */   public abstract KeySelectorResult select(KeyInfo paramKeyInfo, Purpose paramPurpose, AlgorithmMethod paramAlgorithmMethod, XMLCryptoContext paramXMLCryptoContext)
/*     */     throws KeySelectorException;
/*     */ 
/*     */   public static KeySelector singletonKeySelector(Key key)
/*     */   {
/* 106 */     return new SingletonKeySelector(key);
/*     */   }
/*     */ 
/*     */   public static class Purpose
/*     */   {
/*     */     private final String name;
/*  47 */     public static final Purpose SIGN = new Purpose("sign");
/*     */ 
/*  51 */     public static final Purpose VERIFY = new Purpose("verify");
/*     */ 
/*  55 */     public static final Purpose ENCRYPT = new Purpose("encrypt");
/*     */ 
/*  59 */     public static final Purpose DECRYPT = new Purpose("decrypt");
/*     */ 
/*     */     private Purpose(String name)
/*     */     {
/*  34 */       this.name = name;
/*     */     }
/*     */ 
/*     */     public String toString()
/*     */     {
/*  42 */       return this.name;
/*     */     }
/*     */   }
/*     */ 
/*     */   private static class SingletonKeySelector extends KeySelector
/*     */   {
/*     */     private final Key key;
/*     */ 
/*     */     SingletonKeySelector(Key key)
/*     */     {
/* 113 */       if (key == null) {
/* 114 */         throw new NullPointerException();
/*     */       }
/* 116 */       this.key = key;
/*     */     }
/*     */ 
/*     */     public KeySelectorResult select(KeyInfo keyInfo, KeySelector.Purpose purpose, AlgorithmMethod method, XMLCryptoContext context)
/*     */       throws KeySelectorException
/*     */     {
/* 123 */       return new KeySelectorResult() {
/*     */         public Key getKey() {
/* 125 */           return KeySelector.SingletonKeySelector.this.key;
/*     */         }
/*     */       };
/*     */     }
/*     */   }
/*     */ }

/* Location:           E:\HYN\Java\trunk\ref\lib-dep\xmldsig\xmldsig.jar
 * Qualified Name:     javax.xml.crypto.KeySelector
 * JD-Core Version:    0.6.2
 */




© 2015 - 2024 Weber Informatics LLC | Privacy Policy