AS3Crypto and PFX credential files

35 views
Skip to first unread message

bcomer

unread,
Aug 7, 2009, 10:53:48 AM8/7/09
to As3Crypto Discussion List
Good day:

I am writing a Flex application that needs to read X.509 credential
files, extract
the public key then add that key to a web service for authentication.

I have the AS3crypto library but have no success in extracting the
key.

In an attempt to better understand the AS3crypto X509Certificate class
I found the
follow example on the web. The certificate it is using was generated
via Internet
Explorer's credential export option. This is not the same as reading
the actual PFX
file contents and extracting the public key.

var x509:X509Certificate = new X509Certificate(PEM.readCertIntoArray
("—–BEGIN CERTIFICATE—"+
"MIICOzCCAaQCAxAAATANBgkqhkiG9w0BAQQFADCBgDEQMA4GA1UEChMHT3BlbklU"+
"eTEhMB8GCSqGSIb3DQEJARYSb3Blbml0eUBvcGVuaXR5Lmh1MQ0wCwYDVQQHEwRH"+
"eW9yMRMwEQYDVQQIEwpHeW9yLU1vc29uMQswCQYDVQQGEwJIVTEYMBYGA1UEAxMP"+
"T3BlbklUeSBDQSBSb290MB4XDTA4MDQxNzIzMDU1N1oXDTA5MDQxNzIzMDU1N1ow"+
"STELMAkGA1UEBhMCSFUxEzARBgNVBAgTCkd5b3ItTW9zb24xEDAOBgNVBAoTB09w"+
"ZW5JVHkxEzARBgNVBAMTCm9wZW5zc2xzcnYwgZ8wDQYJKoZIhvcNAQEBBQADgY0A"+
"MIGJAoGBALy2QYbD1eUevQeZ69P3oSDs76ubfszBLCaMRrofgGhQiuLTjomSN6Fh"+
"bAxbYya+AkqVBx61F4AP1+c/a6n4FkgBjiPVLwL4I+YHdLq04h5tzA0zZuuiUKAF"+
"nHOhZq/yxeQuYajGV1KfHOukD41PMdI/XgsEJlYMxOL9Gkc8hwJ7AgMBAAEwDQYJ"+
"KoZIhvcNAQEEBQADgYEAdGiZjLr2lbtMdn+iDf5WrorLJeFZIek8nTfmEPHEmOy6"+
"2DiVS4BpvFpzFiHeg54neEEdCFBjl68mwtjhtazMdQb28SZPxjxrYo2Tdj1hz7jV"+
"y8oySz5gvQM7tzRw27moeHQV4sTwaooHvggiIglVDz6OafZihoRC92y1lcrvh1s="+
"—–END CERTIFICATE—–"));
var commonName:Date = x509.getNotBefore();

This results in the following error:

Error #1009: Cannot access a property or method of a null object
reference.

Do anyone have any experience using the AS3crypto library and PFX
files?

Thanks
Barry Comer
Reply all
Reply to author
Forward
0 new messages