1 8 package org.codehaus.loom.xmlpolicy.builder; 9 10 import java.security.KeyStoreSpi ; 11 import java.security.Key ; 12 import java.security.NoSuchAlgorithmException ; 13 import java.security.UnrecoverableKeyException ; 14 import java.security.KeyStoreException ; 15 import java.security.cert.Certificate ; 16 import java.security.cert.CertificateException ; 17 import java.util.Date ; 18 import java.util.Enumeration ; 19 import java.util.HashMap ; 20 import java.io.OutputStream ; 21 import java.io.IOException ; 22 import java.io.InputStream ; 23 24 29 class MockKeyStoreSpi 30 extends KeyStoreSpi 31 { 32 private final HashMap m_certs; 33 34 public MockKeyStoreSpi( HashMap certs ) 35 { 36 m_certs = certs; 37 } 38 39 public Key engineGetKey( String alias, char[] password ) 40 throws NoSuchAlgorithmException , UnrecoverableKeyException 41 { 42 return null; 43 } 44 45 public Certificate [] engineGetCertificateChain( String alias ) 46 { 47 return new Certificate [ 0 ]; 48 } 49 50 public Certificate engineGetCertificate( String alias ) 51 { 52 return (Certificate )m_certs.get( alias ); 53 } 54 55 public Date engineGetCreationDate( String alias ) 56 { 57 return null; 58 } 59 60 public void engineSetKeyEntry( String alias, Key key, 61 char[] password, 62 Certificate [] chain ) 63 throws KeyStoreException 64 { 65 } 66 67 public void engineSetKeyEntry( String alias, byte[] key, 68 Certificate [] chain ) 69 throws KeyStoreException 70 { 71 } 72 73 public void engineSetCertificateEntry( String alias, 74 Certificate cert ) 75 throws KeyStoreException 76 { 77 } 78 79 public void engineDeleteEntry( String alias ) 80 throws KeyStoreException 81 { 82 } 83 84 public Enumeration engineAliases() 85 { 86 return null; 87 } 88 89 public boolean engineContainsAlias( String alias ) 90 { 91 return false; 92 } 93 94 public int engineSize() 95 { 96 return 0; 97 } 98 99 public boolean engineIsKeyEntry( String alias ) 100 { 101 return false; 102 } 103 104 public boolean engineIsCertificateEntry( String alias ) 105 { 106 return false; 107 } 108 109 public String engineGetCertificateAlias( Certificate cert ) 110 { 111 return null; 112 } 113 114 public void engineStore( OutputStream stream, char[] password ) 115 throws IOException , NoSuchAlgorithmException , CertificateException 116 { 117 } 118 119 public void engineLoad( InputStream stream, char[] password ) 120 throws IOException , NoSuchAlgorithmException , CertificateException 121 { 122 } 123 } 124 | Popular Tags |