22
Cryptographic Smart Card Driver Development Guide
RSACryptoToken token = new MyRSACryptoToken();
RSACryptoSystem cryptoSystem = new RSACryptoSystem( token, 1024 );
RSAPrivateKey privateKey;
CryptoSmartCardKeyStoreData[] keyStoreDataArray = new
CryptoSmartCardKeyStoreData[ 3 ];
// This encoding would be extracted from the card using a series of APDU
commands.
Certificate certificate = null;
// Extract the certificate encoding from the card.
byte [] certificateEncoding = new byte[0];
try {
certificate = new X509Certificate( certificateEncoding );
}
catch( CertificateParsingException e )
{ // invalid X509 certificate }
}
stepProgressDialog( 1 );
privateKey = new RSAPrivateKey( cryptoSystem, new MyCryptoTokenData(
smartCardID, ID_PKI ) );
keyStoreDataArray[ 0 ] = new CryptoSmartCardKeyStoreData( null, ID_CERT,
privateKey, null, KeyStore.SECURITY_LEVEL_HIGH, certificate, null, null, 0 );
stepProgressDialog( 1 );
privateKey = new RSAPrivateKey( cryptoSystem, new MyCryptoTokenData(
smartCardID, SIGNING_PKI ) );
keyStoreDataArray[ 1 ] = new CryptoSmartCardKeyStoreData( null, SIGNING_CERT,
privateKey, null, KeyStore.SECURITY_LEVEL_HIGH, certificate, null, null, 0 );
stepProgressDialog( 1 );
privateKey = new RSAPrivateKey( cryptoSystem, new MyCryptoTokenData(
smartCardID, ENCRYPTION_PKI ) );
keyStoreDataArray[ 2 ] = new CryptoSmartCardKeyStoreData( null, ENCRYPTION_CERT,
privateKey, null, KeyStore.SECURITY_LEVEL_HIGH, certificate, null, null, 0 );
stepProgressDialog( 1 );
// Sleep so the user sees the last step of the progress dialog move to 100%
try {Thread.sleep( 250 );
} catch ( InterruptedException e ) {
}
dismissProgressDialog();
return keyStoreDataArray;
} catch ( CryptoUnsupportedOperationException e ) {
} catch ( UnsupportedCryptoSystemException e ) {
} catch ( CryptoTokenException e ) {
}
throw new SmartCardException();
}
Содержание JAVA DEVELOPMENT ENVIRONMENT - - CRYPTOGRAPHIC SMART CARD DRIVER - DEVELOPMENT GUIDE
Страница 4: ......
Страница 6: ......
Страница 14: ...10 Cryptographic Smart Card Driver Development Guide...
Страница 17: ...13 2 Testing a cryptographic smart card driver...
Страница 18: ...14 Cryptographic Smart Card Driver Development Guide...
Страница 34: ...30 Cryptographic Smart Card Driver Development Guide...
Страница 35: ......
Страница 36: ...2007 Research In Motion Limited Published in Canada...