Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added onPendingCoinsReceived to bitcoinj, updates immediately on coin…

…s received now
  • Loading branch information...
commit 568768b90289860703876f2833a21d53325f652b 1 parent fbedfa7
Brian Armstrong authored
Showing with 1 addition and 30,872 deletions.
  1. +1 −0  .classpath
  2. BIN  assets/testnet.blockchain
  3. +0 −63 bitcoin-old/bouncycastle/LICENSE.java
  4. +0 −10 bitcoin-old/bouncycastle/asn1/ASN1ApplicationSpecificParser.java
  5. +0 −14 bitcoin-old/bouncycastle/asn1/ASN1Choice.java
  6. +0 −102 bitcoin-old/bouncycastle/asn1/ASN1Encodable.java
  7. +0 −14 bitcoin-old/bouncycastle/asn1/ASN1EncodableVector.java
  8. +0 −15 bitcoin-old/bouncycastle/asn1/ASN1Generator.java
  9. +0 −386 bitcoin-old/bouncycastle/asn1/ASN1InputStream.java
  10. +0 −38 bitcoin-old/bouncycastle/asn1/ASN1Null.java
  11. +0 −38 bitcoin-old/bouncycastle/asn1/ASN1Object.java
  12. +0 −19 bitcoin-old/bouncycastle/asn1/ASN1ObjectParser.java
  13. +0 −135 bitcoin-old/bouncycastle/asn1/ASN1OctetString.java
  14. +0 −9 bitcoin-old/bouncycastle/asn1/ASN1OctetStringParser.java
  15. +0 −36 bitcoin-old/bouncycastle/asn1/ASN1OutputStream.java
  16. +0 −23 bitcoin-old/bouncycastle/asn1/ASN1ParsingException.java
  17. +0 −217 bitcoin-old/bouncycastle/asn1/ASN1Sequence.java
  18. +0 −10 bitcoin-old/bouncycastle/asn1/ASN1SequenceParser.java
  19. +0 −343 bitcoin-old/bouncycastle/asn1/ASN1Set.java
  20. +0 −10 bitcoin-old/bouncycastle/asn1/ASN1SetParser.java
  21. +0 −174 bitcoin-old/bouncycastle/asn1/ASN1StreamParser.java
  22. +0 −210 bitcoin-old/bouncycastle/asn1/ASN1TaggedObject.java
  23. +0 −12 bitcoin-old/bouncycastle/asn1/ASN1TaggedObjectParser.java
  24. +0 −10 bitcoin-old/bouncycastle/asn1/BERApplicationSpecific.java
  25. +0 −34 bitcoin-old/bouncycastle/asn1/BERApplicationSpecificParser.java
  26. +0 −144 bitcoin-old/bouncycastle/asn1/BERConstructedOctetString.java
  27. +0 −37 bitcoin-old/bouncycastle/asn1/BERConstructedSequence.java
  28. +0 −22 bitcoin-old/bouncycastle/asn1/BERFactory.java
  29. +0 −100 bitcoin-old/bouncycastle/asn1/BERGenerator.java
  30. +0 −209 bitcoin-old/bouncycastle/asn1/BERInputStream.java
  31. +0 −30 bitcoin-old/bouncycastle/asn1/BERNull.java
  32. +0 −102 bitcoin-old/bouncycastle/asn1/BEROctetStringGenerator.java
  33. +0 −44 bitcoin-old/bouncycastle/asn1/BEROctetStringParser.java
  34. +0 −36 bitcoin-old/bouncycastle/asn1/BEROutputStream.java
  35. +0 −59 bitcoin-old/bouncycastle/asn1/BERSequence.java
  36. +0 −41 bitcoin-old/bouncycastle/asn1/BERSequenceGenerator.java
  37. +0 −32 bitcoin-old/bouncycastle/asn1/BERSequenceParser.java
  38. +0 −69 bitcoin-old/bouncycastle/asn1/BERSet.java
  39. +0 −32 bitcoin-old/bouncycastle/asn1/BERSetParser.java
  40. +0 −107 bitcoin-old/bouncycastle/asn1/BERTaggedObject.java
  41. +0 −123 bitcoin-old/bouncycastle/asn1/BERTaggedObjectParser.java
  42. +0 −111 bitcoin-old/bouncycastle/asn1/ConstructedOctetStream.java
  43. +0 −225 bitcoin-old/bouncycastle/asn1/DERApplicationSpecific.java
  44. +0 −126 bitcoin-old/bouncycastle/asn1/DERBMPString.java
  45. +0 −266 bitcoin-old/bouncycastle/asn1/DERBitString.java
  46. +0 −113 bitcoin-old/bouncycastle/asn1/DERBoolean.java
  47. +0 −53 bitcoin-old/bouncycastle/asn1/DERConstructedSequence.java
  48. +0 −79 bitcoin-old/bouncycastle/asn1/DERConstructedSet.java
  49. +0 −6 bitcoin-old/bouncycastle/asn1/DEREncodable.java
  50. +0 −38 bitcoin-old/bouncycastle/asn1/DEREncodableVector.java
  51. +0 −102 bitcoin-old/bouncycastle/asn1/DEREnumerated.java
  52. +0 −267 bitcoin-old/bouncycastle/asn1/DERExternal.java
  53. +0 −39 bitcoin-old/bouncycastle/asn1/DERExternalParser.java
  54. +0 −22 bitcoin-old/bouncycastle/asn1/DERFactory.java
  55. +0 −92 bitcoin-old/bouncycastle/asn1/DERGeneralString.java
  56. +0 −314 bitcoin-old/bouncycastle/asn1/DERGeneralizedTime.java
  57. +0 −119 bitcoin-old/bouncycastle/asn1/DERGenerator.java
  58. +0 −174 bitcoin-old/bouncycastle/asn1/DERIA5String.java
  59. +0 −272 bitcoin-old/bouncycastle/asn1/DERInputStream.java
  60. +0 −123 bitcoin-old/bouncycastle/asn1/DERInteger.java
  61. +0 −25 bitcoin-old/bouncycastle/asn1/DERNull.java
  62. +0 −177 bitcoin-old/bouncycastle/asn1/DERNumericString.java
  63. +0 −20 bitcoin-old/bouncycastle/asn1/DERObject.java
  64. +0 −293 bitcoin-old/bouncycastle/asn1/DERObjectIdentifier.java
  65. +0 −37 bitcoin-old/bouncycastle/asn1/DEROctetString.java
  66. +0 −33 bitcoin-old/bouncycastle/asn1/DEROctetStringParser.java
  67. +0 −134 bitcoin-old/bouncycastle/asn1/DEROutputStream.java
  68. +0 −204 bitcoin-old/bouncycastle/asn1/DERPrintableString.java
  69. +0 −80 bitcoin-old/bouncycastle/asn1/DERSequence.java
  70. +0 −45 bitcoin-old/bouncycastle/asn1/DERSequenceGenerator.java
  71. +0 −32 bitcoin-old/bouncycastle/asn1/DERSequenceParser.java
  72. +0 −100 bitcoin-old/bouncycastle/asn1/DERSet.java
  73. +0 −32 bitcoin-old/bouncycastle/asn1/DERSetParser.java
  74. +0 −9 bitcoin-old/bouncycastle/asn1/DERString.java
  75. +0 −126 bitcoin-old/bouncycastle/asn1/DERT61String.java
  76. +0 −85 bitcoin-old/bouncycastle/asn1/DERTaggedObject.java
  77. +0 −36 bitcoin-old/bouncycastle/asn1/DERTags.java
  78. +0 −254 bitcoin-old/bouncycastle/asn1/DERUTCTime.java
  79. +0 −109 bitcoin-old/bouncycastle/asn1/DERUTF8String.java
  80. +0 −120 bitcoin-old/bouncycastle/asn1/DERUniversalString.java
  81. +0 −79 bitcoin-old/bouncycastle/asn1/DERUnknownTag.java
  82. +0 −126 bitcoin-old/bouncycastle/asn1/DERVisibleString.java
  83. +0 −105 bitcoin-old/bouncycastle/asn1/DefiniteLengthInputStream.java
  84. +0 −110 bitcoin-old/bouncycastle/asn1/IndefiniteLengthInputStream.java
  85. +0 −43 bitcoin-old/bouncycastle/asn1/LazyDERConstructionEnumeration.java
  86. +0 −75 bitcoin-old/bouncycastle/asn1/LazyDERSequence.java
  87. +0 −23 bitcoin-old/bouncycastle/asn1/LimitedInputStream.java
  88. +0 −48 bitcoin-old/bouncycastle/asn1/OIDTokenizer.java
  89. +0 −51 bitcoin-old/bouncycastle/asn1/bc/BCObjectIdentifiers.java
  90. +0 −73 bitcoin-old/bouncycastle/asn1/cmp/CAKeyUpdAnnContent.java
  91. +0 −62 bitcoin-old/bouncycastle/asn1/cmp/CMPCertificate.java
  92. +0 −55 bitcoin-old/bouncycastle/asn1/cmp/CRLAnnContent.java
  93. +0 −54 bitcoin-old/bouncycastle/asn1/cmp/CertConfirmContent.java
  94. +0 −76 bitcoin-old/bouncycastle/asn1/cmp/CertOrEncCert.java
  95. +0 −96 bitcoin-old/bouncycastle/asn1/cmp/CertRepMessage.java
  96. +0 −112 bitcoin-old/bouncycastle/asn1/cmp/CertResponse.java
  97. +0 −81 bitcoin-old/bouncycastle/asn1/cmp/CertStatus.java
  98. +0 −105 bitcoin-old/bouncycastle/asn1/cmp/CertifiedKeyPair.java
  99. +0 −96 bitcoin-old/bouncycastle/asn1/cmp/Challenge.java
  100. +0 −100 bitcoin-old/bouncycastle/asn1/cmp/ErrorMsgContent.java
  101. +0 −54 bitcoin-old/bouncycastle/asn1/cmp/GenMsgContent.java
  102. +0 −54 bitcoin-old/bouncycastle/asn1/cmp/GenRepContent.java
  103. +0 −116 bitcoin-old/bouncycastle/asn1/cmp/InfoTypeAndValue.java
  104. +0 −141 bitcoin-old/bouncycastle/asn1/cmp/KeyRecRepContent.java
  105. +0 −99 bitcoin-old/bouncycastle/asn1/cmp/OOBCertHash.java
  106. +0 −89 bitcoin-old/bouncycastle/asn1/cmp/PBMParameter.java
  107. +0 −163 bitcoin-old/bouncycastle/asn1/cmp/PKIBody.java
  108. +0 −42 bitcoin-old/bouncycastle/asn1/cmp/PKIConfirmContent.java
  109. +0 −104 bitcoin-old/bouncycastle/asn1/cmp/PKIFailureInfo.java
  110. +0 −91 bitcoin-old/bouncycastle/asn1/cmp/PKIFreeText.java
  111. +0 −176 bitcoin-old/bouncycastle/asn1/cmp/PKIHeader.java
  112. +0 −101 bitcoin-old/bouncycastle/asn1/cmp/PKIMessage.java
  113. +0 −54 bitcoin-old/bouncycastle/asn1/cmp/PKIMessages.java
  114. +0 −57 bitcoin-old/bouncycastle/asn1/cmp/PKIStatus.java
  115. +0 −164 bitcoin-old/bouncycastle/asn1/cmp/PKIStatusInfo.java
  116. +0 −54 bitcoin-old/bouncycastle/asn1/cmp/POPODecKeyChallContent.java
  117. +0 −55 bitcoin-old/bouncycastle/asn1/cmp/POPODecKeyRespContent.java
  118. +0 −82 bitcoin-old/bouncycastle/asn1/cmp/PollRepContent.java
  119. +0 −69 bitcoin-old/bouncycastle/asn1/cmp/PollReqContent.java
  120. +0 −64 bitcoin-old/bouncycastle/asn1/cmp/ProtectedPart.java
  121. +0 −103 bitcoin-old/bouncycastle/asn1/cmp/RevAnnContent.java
  122. +0 −77 bitcoin-old/bouncycastle/asn1/cmp/RevDetails.java
  123. +0 −136 bitcoin-old/bouncycastle/asn1/cmp/RevRepContent.java
  124. +0 −54 bitcoin-old/bouncycastle/asn1/cmp/RevReqContent.java
  125. +0 −82 bitcoin-old/bouncycastle/asn1/cms/Attribute.java
  126. +0 −173 bitcoin-old/bouncycastle/asn1/cms/AttributeTable.java
  127. +0 −218 bitcoin-old/bouncycastle/asn1/cms/AuthEnvelopedData.java
  128. +0 −157 bitcoin-old/bouncycastle/asn1/cms/AuthEnvelopedDataParser.java
  129. +0 −288 bitcoin-old/bouncycastle/asn1/cms/AuthenticatedData.java
  130. +0 −178 bitcoin-old/bouncycastle/asn1/cms/AuthenticatedDataParser.java
  131. +0 −13 bitcoin-old/bouncycastle/asn1/cms/CMSAttributes.java
  132. +0 −17 bitcoin-old/bouncycastle/asn1/cms/CMSObjectIdentifiers.java
  133. +0 −110 bitcoin-old/bouncycastle/asn1/cms/CompressedData.java
  134. +0 −48 bitcoin-old/bouncycastle/asn1/cms/CompressedDataParser.java
  135. +0 −90 bitcoin-old/bouncycastle/asn1/cms/ContentInfo.java
  136. +0 −48 bitcoin-old/bouncycastle/asn1/cms/ContentInfoParser.java
  137. +0 −106 bitcoin-old/bouncycastle/asn1/cms/EncryptedContentInfo.java
  138. +0 −51 bitcoin-old/bouncycastle/asn1/cms/EncryptedContentInfoParser.java
  139. +0 −94 bitcoin-old/bouncycastle/asn1/cms/EncryptedData.java
  140. +0 −179 bitcoin-old/bouncycastle/asn1/cms/EnvelopedData.java
  141. +0 −118 bitcoin-old/bouncycastle/asn1/cms/EnvelopedDataParser.java
  142. +0 −77 bitcoin-old/bouncycastle/asn1/cms/IssuerAndSerialNumber.java
  143. +0 −139 bitcoin-old/bouncycastle/asn1/cms/KEKIdentifier.java
  144. +0 −121 bitcoin-old/bouncycastle/asn1/cms/KEKRecipientInfo.java
  145. +0 −103 bitcoin-old/bouncycastle/asn1/cms/KeyAgreeRecipientIdentifier.java
  146. +0 −151 bitcoin-old/bouncycastle/asn1/cms/KeyAgreeRecipientInfo.java
  147. +0 −114 bitcoin-old/bouncycastle/asn1/cms/KeyTransRecipientInfo.java
  148. +0 −165 bitcoin-old/bouncycastle/asn1/cms/OriginatorIdentifierOrKey.java
  149. +0 −129 bitcoin-old/bouncycastle/asn1/cms/OriginatorInfo.java
  150. +0 −100 bitcoin-old/bouncycastle/asn1/cms/OriginatorPublicKey.java
  151. +0 −82 bitcoin-old/bouncycastle/asn1/cms/OtherKeyAttribute.java
  152. +0 −98 bitcoin-old/bouncycastle/asn1/cms/OtherRecipientInfo.java
  153. +0 −143 bitcoin-old/bouncycastle/asn1/cms/PasswordRecipientInfo.java
  154. +0 −99 bitcoin-old/bouncycastle/asn1/cms/RecipientEncryptedKey.java
  155. +0 −98 bitcoin-old/bouncycastle/asn1/cms/RecipientIdentifier.java
  156. +0 −154 bitcoin-old/bouncycastle/asn1/cms/RecipientInfo.java
  157. +0 −139 bitcoin-old/bouncycastle/asn1/cms/RecipientKeyIdentifier.java
  158. +0 −306 bitcoin-old/bouncycastle/asn1/cms/SignedData.java
  159. +0 −139 bitcoin-old/bouncycastle/asn1/cms/SignedDataParser.java
  160. +0 −98 bitcoin-old/bouncycastle/asn1/cms/SignerIdentifier.java
  161. +0 −183 bitcoin-old/bouncycastle/asn1/cms/SignerInfo.java
  162. +0 −128 bitcoin-old/bouncycastle/asn1/cms/Time.java
  163. +0 −112 bitcoin-old/bouncycastle/asn1/cms/ecc/MQVuserKeyingMaterial.java
  164. +0 −64 bitcoin-old/bouncycastle/asn1/crmf/AttributeTypeAndValue.java
  165. +0 −71 bitcoin-old/bouncycastle/asn1/crmf/CertId.java
  166. +0 −54 bitcoin-old/bouncycastle/asn1/crmf/CertReqMessages.java
  167. +0 −110 bitcoin-old/bouncycastle/asn1/crmf/CertReqMsg.java
  168. +0 −80 bitcoin-old/bouncycastle/asn1/crmf/CertRequest.java
  169. +0 −134 bitcoin-old/bouncycastle/asn1/crmf/CertTemplate.java
  170. +0 −54 bitcoin-old/bouncycastle/asn1/crmf/Controls.java
  171. +0 −113 bitcoin-old/bouncycastle/asn1/crmf/EncryptedValue.java
  172. +0 −77 bitcoin-old/bouncycastle/asn1/crmf/OptionalValidity.java
  173. +0 −81 bitcoin-old/bouncycastle/asn1/crmf/PKIPublicationInfo.java
  174. +0 −41 bitcoin-old/bouncycastle/asn1/crmf/POPOPrivKey.java
  175. +0 −84 bitcoin-old/bouncycastle/asn1/crmf/POPOSigningKey.java
  176. +0 −67 bitcoin-old/bouncycastle/asn1/crmf/POPOSigningKeyInput.java
  177. +0 −78 bitcoin-old/bouncycastle/asn1/crmf/ProofOfPossession.java
  178. +0 −72 bitcoin-old/bouncycastle/asn1/crmf/SinglePubInfo.java
  179. +0 −45 bitcoin-old/bouncycastle/asn1/cryptopro/CryptoProObjectIdentifiers.java
  180. +0 −168 bitcoin-old/bouncycastle/asn1/cryptopro/ECGOST3410NamedCurves.java
  181. +0 −99 bitcoin-old/bouncycastle/asn1/cryptopro/ECGOST3410ParamSetParameters.java
  182. +0 −72 bitcoin-old/bouncycastle/asn1/cryptopro/GOST28147Parameters.java
  183. +0 −116 bitcoin-old/bouncycastle/asn1/cryptopro/GOST3410NamedParameters.java
  184. +0 −105 bitcoin-old/bouncycastle/asn1/cryptopro/GOST3410ParamSetParameters.java
  185. +0 −101 bitcoin-old/bouncycastle/asn1/cryptopro/GOST3410PublicKeyAlgParameters.java
  186. +0 −55 bitcoin-old/bouncycastle/asn1/eac/EACObjectIdentifiers.java
  187. +0 −14 bitcoin-old/bouncycastle/asn1/esf/CommitmentTypeIdentifier.java
  188. +0 −83 bitcoin-old/bouncycastle/asn1/esf/CommitmentTypeIndication.java
  189. +0 −108 bitcoin-old/bouncycastle/asn1/esf/CommitmentTypeQualifier.java
  190. +0 −21 bitcoin-old/bouncycastle/asn1/esf/ESFAttributes.java
  191. +0 −78 bitcoin-old/bouncycastle/asn1/esf/OtherHashAlgAndValue.java
  192. +0 −94 bitcoin-old/bouncycastle/asn1/esf/SPUserNotice.java
  193. +0 −47 bitcoin-old/bouncycastle/asn1/esf/SPuri.java
  194. +0 −71 bitcoin-old/bouncycastle/asn1/esf/SigPolicyQualifierInfo.java
  195. +0 −75 bitcoin-old/bouncycastle/asn1/esf/SigPolicyQualifiers.java
  196. +0 −100 bitcoin-old/bouncycastle/asn1/esf/SignaturePolicyId.java
  197. +0 −74 bitcoin-old/bouncycastle/asn1/esf/SignaturePolicyIdentifier.java
  198. +0 −97 bitcoin-old/bouncycastle/asn1/esf/SignerAttribute.java
  199. +0 −159 bitcoin-old/bouncycastle/asn1/esf/SignerLocation.java
  200. +0 −96 bitcoin-old/bouncycastle/asn1/ess/ContentHints.java
  201. +0 −65 bitcoin-old/bouncycastle/asn1/ess/ContentIdentifier.java
  202. +0 −97 bitcoin-old/bouncycastle/asn1/ess/ESSCertID.java
  203. +0 −138 bitcoin-old/bouncycastle/asn1/ess/ESSCertIDv2.java
  204. +0 −138 bitcoin-old/bouncycastle/asn1/ess/OtherCertID.java
  205. +0 −111 bitcoin-old/bouncycastle/asn1/ess/OtherSigningCertificate.java
  206. +0 −111 bitcoin-old/bouncycastle/asn1/ess/SigningCertificate.java
  207. +0 −132 bitcoin-old/bouncycastle/asn1/ess/SigningCertificateV2.java
  208. +0 −30 bitcoin-old/bouncycastle/asn1/gnu/GNUObjectIdentifiers.java
  209. +0 −20 bitcoin-old/bouncycastle/asn1/iana/IANAObjectIdentifiers.java
  210. +0 −100 bitcoin-old/bouncycastle/asn1/icao/DataGroupHash.java
  211. +0 −15 bitcoin-old/bouncycastle/asn1/icao/ICAOObjectIdentifiers.java
  212. +0 −125 bitcoin-old/bouncycastle/asn1/icao/LDSSecurityObject.java
  213. +0 −180 bitcoin-old/bouncycastle/asn1/isismtt/ISISMTTObjectIdentifiers.java
  214. +0 −124 bitcoin-old/bouncycastle/asn1/isismtt/ocsp/CertHash.java
  215. +0 −183 bitcoin-old/bouncycastle/asn1/isismtt/ocsp/RequestedCertificate.java
  216. +0 −70 bitcoin-old/bouncycastle/asn1/isismtt/x509/AdditionalInformationSyntax.java
  217. +0 −280 bitcoin-old/bouncycastle/asn1/isismtt/x509/AdmissionSyntax.java
  218. +0 −188 bitcoin-old/bouncycastle/asn1/isismtt/x509/Admissions.java
  219. +0 −164 bitcoin-old/bouncycastle/asn1/isismtt/x509/DeclarationOfMajority.java
  220. +0 −131 bitcoin-old/bouncycastle/asn1/isismtt/x509/MonetaryLimit.java
  221. +0 −225 bitcoin-old/bouncycastle/asn1/isismtt/x509/NamingAuthority.java
  222. +0 −240 bitcoin-old/bouncycastle/asn1/isismtt/x509/ProcurationSyntax.java
  223. +0 −407 bitcoin-old/bouncycastle/asn1/isismtt/x509/ProfessionInfo.java
  224. +0 −82 bitcoin-old/bouncycastle/asn1/isismtt/x509/Restriction.java
  225. +0 −9 bitcoin-old/bouncycastle/asn1/kisa/KISAObjectIdentifiers.java
  226. +0 −17 bitcoin-old/bouncycastle/asn1/microsoft/MicrosoftObjectIdentifiers.java
  227. +0 −71 bitcoin-old/bouncycastle/asn1/misc/CAST5CBCParameters.java
  228. +0 −75 bitcoin-old/bouncycastle/asn1/misc/IDEACBCPar.java
  229. +0 −46 bitcoin-old/bouncycastle/asn1/misc/MiscObjectIdentifiers.java
  230. +0 −54 bitcoin-old/bouncycastle/asn1/misc/NetscapeCertType.java
  231. +0 −18 bitcoin-old/bouncycastle/asn1/misc/NetscapeRevocationURL.java
  232. +0 −18 bitcoin-old/bouncycastle/asn1/misc/VerisignCzagExtension.java
  233. +0 −63 bitcoin-old/bouncycastle/asn1/mozilla/PublicKeyAndChallenge.java
  234. +0 −96 bitcoin-old/bouncycastle/asn1/nist/NISTNamedCurves.java
  235. +0 −56 bitcoin-old/bouncycastle/asn1/nist/NISTObjectIdentifiers.java
  236. +0 −17 bitcoin-old/bouncycastle/asn1/ntt/NTTObjectIdentifiers.java
  237. +0 −112 bitcoin-old/bouncycastle/asn1/ocsp/BasicOCSPResponse.java
  238. +0 −105 bitcoin-old/bouncycastle/asn1/ocsp/CertID.java
  239. +0 −105 bitcoin-old/bouncycastle/asn1/ocsp/CertStatus.java
  240. +0 −86 bitcoin-old/bouncycastle/asn1/ocsp/CrlID.java
  241. +0 −22 bitcoin-old/bouncycastle/asn1/ocsp/OCSPObjectIdentifiers.java
  242. +0 −90 bitcoin-old/bouncycastle/asn1/ocsp/OCSPRequest.java
  243. +0 −92 bitcoin-old/bouncycastle/asn1/ocsp/OCSPResponse.java
  244. +0 −40 bitcoin-old/bouncycastle/asn1/ocsp/OCSPResponseStatus.java
  245. +0 −91 bitcoin-old/bouncycastle/asn1/ocsp/Request.java
  246. +0 −83 bitcoin-old/bouncycastle/asn1/ocsp/ResponderID.java
  247. +0 −82 bitcoin-old/bouncycastle/asn1/ocsp/ResponseBytes.java
  248. +0 −164 bitcoin-old/bouncycastle/asn1/ocsp/ResponseData.java
  249. +0 −92 bitcoin-old/bouncycastle/asn1/ocsp/RevokedInfo.java
  250. +0 −36 bitcoin-old/bouncycastle/asn1/ocsp/ServiceLocator.java
  251. +0 −111 bitcoin-old/bouncycastle/asn1/ocsp/Signature.java
  252. +0 −143 bitcoin-old/bouncycastle/asn1/ocsp/SingleResponse.java
  253. +0 −154 bitcoin-old/bouncycastle/asn1/ocsp/TBSRequest.java
  254. +0 −49 bitcoin-old/bouncycastle/asn1/oiw/ElGamalParameter.java
  255. +0 −31 bitcoin-old/bouncycastle/asn1/oiw/OIWObjectIdentifiers.java
  256. +0 −82 bitcoin-old/bouncycastle/asn1/pkcs/Attribute.java
  257. +0 −47 bitcoin-old/bouncycastle/asn1/pkcs/AuthenticatedSafe.java
  258. +0 −53 bitcoin-old/bouncycastle/asn1/pkcs/CertBag.java
  259. +0 −91 bitcoin-old/bouncycastle/asn1/pkcs/CertificationRequest.java
  260. +0 −129 bitcoin-old/bouncycastle/asn1/pkcs/CertificationRequestInfo.java
  261. +0 −90 bitcoin-old/bouncycastle/asn1/pkcs/ContentInfo.java
  262. +0 −88 bitcoin-old/bouncycastle/asn1/pkcs/DHParameter.java
  263. +0 −104 bitcoin-old/bouncycastle/asn1/pkcs/EncryptedData.java
  264. +0 −86 bitcoin-old/bouncycastle/asn1/pkcs/EncryptedPrivateKeyInfo.java
  265. +0 −38 bitcoin-old/bouncycastle/asn1/pkcs/EncryptionScheme.java
  266. +0 −76 bitcoin-old/bouncycastle/asn1/pkcs/IssuerAndSerialNumber.java
  267. +0 −23 bitcoin-old/bouncycastle/asn1/pkcs/KeyDerivationFunc.java
  268. +0 −106 bitcoin-old/bouncycastle/asn1/pkcs/MacData.java
  269. +0 −77 bitcoin-old/bouncycastle/asn1/pkcs/PBES2Algorithms.java
  270. +0 −55 bitcoin-old/bouncycastle/asn1/pkcs/PBES2Parameters.java
  271. +0 −98 bitcoin-old/bouncycastle/asn1/pkcs/PBKDF2Params.java
  272. +0 −69 bitcoin-old/bouncycastle/asn1/pkcs/PKCS12PBEParams.java
  273. +0 −248 bitcoin-old/bouncycastle/asn1/pkcs/PKCSObjectIdentifiers.java
  274. +0 −71 bitcoin-old/bouncycastle/asn1/pkcs/Pfx.java
  275. +0 −144 bitcoin-old/bouncycastle/asn1/pkcs/PrivateKeyInfo.java
  276. +0 −89 bitcoin-old/bouncycastle/asn1/pkcs/RC2CBCParameter.java
  277. +0 −151 bitcoin-old/bouncycastle/asn1/pkcs/RSAESOAEPparams.java
  278. +0 −186 bitcoin-old/bouncycastle/asn1/pkcs/RSAPrivateKeyStructure.java
  279. +0 −170 bitcoin-old/bouncycastle/asn1/pkcs/RSASSAPSSparams.java
  280. +0 −78 bitcoin-old/bouncycastle/asn1/pkcs/SafeBag.java
  281. +0 −166 bitcoin-old/bouncycastle/asn1/pkcs/SignedData.java
  282. +0 −168 bitcoin-old/bouncycastle/asn1/pkcs/SignerInfo.java
  283. +0 −128 bitcoin-old/bouncycastle/asn1/sec/ECPrivateKeyStructure.java
  284. +0 −1,029 bitcoin-old/bouncycastle/asn1/sec/SECNamedCurves.java
  285. +0 −50 bitcoin-old/bouncycastle/asn1/sec/SECObjectIdentifiers.java
  286. +0 −10 bitcoin-old/bouncycastle/asn1/smime/SMIMEAttributes.java
  287. +0 −115 bitcoin-old/bouncycastle/asn1/smime/SMIMECapabilities.java
  288. +0 −16 bitcoin-old/bouncycastle/asn1/smime/SMIMECapabilitiesAttribute.java
  289. +0 −103 bitcoin-old/bouncycastle/asn1/smime/SMIMECapability.java
  290. +0 −51 bitcoin-old/bouncycastle/asn1/smime/SMIMECapabilityVector.java
  291. +0 −48 bitcoin-old/bouncycastle/asn1/smime/SMIMEEncryptionKeyPreferenceAttribute.java
  292. +0 −351 bitcoin-old/bouncycastle/asn1/teletrust/TeleTrusTNamedCurves.java
  293. +0 −42 bitcoin-old/bouncycastle/asn1/teletrust/TeleTrusTObjectIdentifiers.java
  294. +0 −174 bitcoin-old/bouncycastle/asn1/tsp/Accuracy.java
  295. +0 −77 bitcoin-old/bouncycastle/asn1/tsp/MessageImprint.java
  296. +0 −254 bitcoin-old/bouncycastle/asn1/tsp/TSTInfo.java
  297. +0 −181 bitcoin-old/bouncycastle/asn1/tsp/TimeStampReq.java
  298. +0 −86 bitcoin-old/bouncycastle/asn1/tsp/TimeStampResp.java
  299. +0 −473 bitcoin-old/bouncycastle/asn1/util/ASN1Dump.java
  300. +0 −41 bitcoin-old/bouncycastle/asn1/util/DERDump.java
Sorry, we could not display the entire diff because too many files (824) changed.
View
1  .classpath
@@ -2,6 +2,7 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
+ <classpathentry kind="src" path="assets"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="lib" path="external-libs/zxing-1.6/core.jar"/>
<classpathentry kind="lib" path="external-libs/commons-io-2.0.1.jar"/>
View
BIN  assets/testnet.blockchain
Binary file not shown
View
63 bitcoin-old/bouncycastle/LICENSE.java
@@ -1,63 +0,0 @@
-package com.google.bitcoin.bouncycastle;
-
-/**
- * The Bouncy Castle License
- *
- * Copyright (c) 2000-2008 The Legion Of The Bouncy Castle (http://www.bouncycastle.org)
- * <p>
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
- * and associated documentation files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- * <p>
- * The above copyright notice and this permission notice shall be included in all copies or substantial
- * portions of the Software.
- * <p>
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
- * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-public class LICENSE
-{
- public static String licenseText =
- "Copyright (c) 2000-2008 The Legion Of The Bouncy Castle (http://www.bouncycastle.org) "
- + System.getProperty("line.separator")
- + System.getProperty("line.separator")
- + "Permission is hereby granted, free of charge, to any person obtaining a copy of this software "
- + System.getProperty("line.separator")
- + "and associated documentation files (the \"Software\"), to deal in the Software without restriction, "
- + System.getProperty("line.separator")
- + "including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, "
- + System.getProperty("line.separator")
- + "and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,"
- + System.getProperty("line.separator")
- + "subject to the following conditions:"
- + System.getProperty("line.separator")
- + System.getProperty("line.separator")
- + "The above copyright notice and this permission notice shall be included in all copies or substantial"
- + System.getProperty("line.separator")
- + "portions of the Software."
- + System.getProperty("line.separator")
- + System.getProperty("line.separator")
- + "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,"
- + System.getProperty("line.separator")
- + "INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR"
- + System.getProperty("line.separator")
- + "PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE"
- + System.getProperty("line.separator")
- + "LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR"
- + System.getProperty("line.separator")
- + "OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER"
- + System.getProperty("line.separator")
- + "DEALINGS IN THE SOFTWARE.";
-
- public static void main(
- String[] args)
- {
- System.out.println(licenseText);
- }
-}
View
10 bitcoin-old/bouncycastle/asn1/ASN1ApplicationSpecificParser.java
@@ -1,10 +0,0 @@
-package com.google.bitcoin.bouncycastle.asn1;
-
-import java.io.IOException;
-
-public interface ASN1ApplicationSpecificParser
- extends DEREncodable
-{
- DEREncodable readObject()
- throws IOException;
-}
View
14 bitcoin-old/bouncycastle/asn1/ASN1Choice.java
@@ -1,14 +0,0 @@
-package com.google.bitcoin.bouncycastle.asn1;
-
-/**
- * Marker interface for CHOICE objects - if you implement this in a role your
- * own object any attempt to tag the object implicitly will convert the tag to
- * an explicit one as the encoding rules require.
- * <p>
- * If you use this interface your class should also implement the getInstance
- * pattern which takes a tag object and the tagging mode used.
- */
-public interface ASN1Choice
-{
- // marker interface
-}
View
102 bitcoin-old/bouncycastle/asn1/ASN1Encodable.java
@@ -1,102 +0,0 @@
-package com.google.bitcoin.bouncycastle.asn1;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-/**
- * Base class for objects which can be written directly to ASN.1 output streams.
- */
-public abstract class ASN1Encodable
- implements DEREncodable
-{
- public static final String DER = "DER";
- public static final String BER = "BER";
-
- /**
- * Return the default BER or DER encoding for this object.
- *
- * @return BER/DER byte encoded object.
- * @throws IOException on encoding error.
- */
- public byte[] getEncoded()
- throws IOException
- {
- ByteArrayOutputStream bOut = new ByteArrayOutputStream();
- ASN1OutputStream aOut = new ASN1OutputStream(bOut);
-
- aOut.writeObject(this);
-
- return bOut.toByteArray();
- }
-
- /**
- * Return either the default for "BER" or a DER encoding if "DER" is specified.
- *
- * @param encoding name of encoding to use.
- * @return byte encoded object.
- * @throws IOException on encoding error.
- */
- public byte[] getEncoded(
- String encoding)
- throws IOException
- {
- if (encoding.equals(DER))
- {
- ByteArrayOutputStream bOut = new ByteArrayOutputStream();
- DEROutputStream dOut = new DEROutputStream(bOut);
-
- dOut.writeObject(this);
-
- return bOut.toByteArray();
- }
-
- return this.getEncoded();
- }
-
- /**
- * Return the DER encoding of the object, null if the DER encoding can not be made.
- *
- * @return a DER byte array, null otherwise.
- */
- public byte[] getDEREncoded()
- {
- try
- {
- return this.getEncoded(DER);
- }
- catch (IOException e)
- {
- return null;
- }
- }
-
- public int hashCode()
- {
- return this.toASN1Object().hashCode();
- }
-
- public boolean equals(
- Object o)
- {
- if (this == o)
- {
- return true;
- }
-
- if (!(o instanceof DEREncodable))
- {
- return false;
- }
-
- DEREncodable other = (DEREncodable)o;
-
- return this.toASN1Object().equals(other.getDERObject());
- }
-
- public DERObject getDERObject()
- {
- return this.toASN1Object();
- }
-
- public abstract DERObject toASN1Object();
-}
View
14 bitcoin-old/bouncycastle/asn1/ASN1EncodableVector.java
@@ -1,14 +0,0 @@
-package com.google.bitcoin.bouncycastle.asn1;
-
-/**
- * the parent class for this will eventually disappear. Use this one!
- */
-public class ASN1EncodableVector
- extends DEREncodableVector
-{
- // migrating from DEREncodeableVector
- public ASN1EncodableVector()
- {
-
- }
-}
View
15 bitcoin-old/bouncycastle/asn1/ASN1Generator.java
@@ -1,15 +0,0 @@
-package com.google.bitcoin.bouncycastle.asn1;
-
-import java.io.OutputStream;
-
-public abstract class ASN1Generator
-{
- protected OutputStream _out;
-
- public ASN1Generator(OutputStream out)
- {
- _out = out;
- }
-
- public abstract OutputStream getRawOutputStream();
-}
View
386 bitcoin-old/bouncycastle/asn1/ASN1InputStream.java
@@ -1,386 +0,0 @@
-package com.google.bitcoin.bouncycastle.asn1;
-
-import java.io.ByteArrayInputStream;
-import java.io.EOFException;
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import com.google.bitcoin.bouncycastle.util.io.Streams;
-
-/**
- * a general purpose ASN.1 decoder - note: this class differs from the
- * others in that it returns null after it has read the last object in
- * the stream. If an ASN.1 NULL is encountered a DER/BER Null object is
- * returned.
- */
-public class ASN1InputStream
- extends FilterInputStream
- implements DERTags
-{
- private final int limit;
- private final boolean lazyEvaluate;
-
- public ASN1InputStream(
- InputStream is)
- {
- this(is, Integer.MAX_VALUE);
- }
-
- /**
- * Create an ASN1InputStream based on the input byte array. The length of DER objects in
- * the stream is automatically limited to the length of the input array.
- *
- * @param input array containing ASN.1 encoded data.
- */
- public ASN1InputStream(
- byte[] input)
- {
- this(new ByteArrayInputStream(input), input.length);
- }
-
- /**
- * Create an ASN1InputStream based on the input byte array. The length of DER objects in
- * the stream is automatically limited to the length of the input array.
- *
- * @param input array containing ASN.1 encoded data.
- * @param lazyEvaluate true if parsing inside constructed objects can be delayed.
- */
- public ASN1InputStream(
- byte[] input,
- boolean lazyEvaluate)
- {
- this(new ByteArrayInputStream(input), input.length, lazyEvaluate);
- }
-
- /**
- * Create an ASN1InputStream where no DER object will be longer than limit.
- *
- * @param input stream containing ASN.1 encoded data.
- * @param limit maximum size of a DER encoded object.
- */
- public ASN1InputStream(
- InputStream input,
- int limit)
- {
- this(input, limit, false);
- }
-
- /**
- * Create an ASN1InputStream where no DER object will be longer than limit, and constructed
- * objects such as sequences will be parsed lazily.
- *
- * @param input stream containing ASN.1 encoded data.
- * @param limit maximum size of a DER encoded object.
- * @param lazyEvaluate true if parsing inside constructed objects can be delayed.
- */
- public ASN1InputStream(
- InputStream input,
- int limit,
- boolean lazyEvaluate)
- {
- super(input);
- this.limit = limit;
- this.lazyEvaluate = lazyEvaluate;
- }
-
- protected int readLength()
- throws IOException
- {
- return readLength(this, limit);
- }
-
- protected void readFully(
- byte[] bytes)
- throws IOException
- {
- if (Streams.readFully(this, bytes) != bytes.length)
- {
- throw new EOFException("EOF encountered in middle of object");
- }
- }
-
- /**
- * build an object given its tag and the number of bytes to construct it from.
- */
- protected DERObject buildObject(
- int tag,
- int tagNo,
- int length)
- throws IOException
- {
- boolean isConstructed = (tag & CONSTRUCTED) != 0;
-
- DefiniteLengthInputStream defIn = new DefiniteLengthInputStream(this, length);
-
- if ((tag & APPLICATION) != 0)
- {
- return new DERApplicationSpecific(isConstructed, tagNo, defIn.toByteArray());
- }
-
- if ((tag & TAGGED) != 0)
- {
- return new BERTaggedObjectParser(tag, tagNo, defIn).getDERObject();
- }
-
- if (isConstructed)
- {
- // TODO There are other tags that may be constructed (e.g. BIT_STRING)
- switch (tagNo)
- {
- case OCTET_STRING:
- //
- // yes, people actually do this...
- //
- return new BERConstructedOctetString(buildDEREncodableVector(defIn).v);
- case SEQUENCE:
- if (lazyEvaluate)
- {
- return new LazyDERSequence(defIn.toByteArray());
- }
- else
- {
- return DERFactory.createSequence(buildDEREncodableVector(defIn));
- }
- case SET:
- return DERFactory.createSet(buildDEREncodableVector(defIn), false);
- case EXTERNAL:
- return new DERExternal(buildDEREncodableVector(defIn));
- default:
- return new DERUnknownTag(true, tagNo, defIn.toByteArray());
- }
- }
-
- return createPrimitiveDERObject(tagNo, defIn.toByteArray());
- }
-
- ASN1EncodableVector buildEncodableVector()
- throws IOException
- {
- ASN1EncodableVector v = new ASN1EncodableVector();
- DERObject o;
-
- while ((o = readObject()) != null)
- {
- v.add(o);
- }
-
- return v;
- }
-
- ASN1EncodableVector buildDEREncodableVector(
- DefiniteLengthInputStream dIn) throws IOException
- {
- return new ASN1InputStream(dIn).buildEncodableVector();
- }
-
- public DERObject readObject()
- throws IOException
- {
- int tag = read();
- if (tag <= 0)
- {
- if (tag == 0)
- {
- throw new IOException("unexpected end-of-contents marker");
- }
-
- return null;
- }
-
- //
- // calculate tag number
- //
- int tagNo = readTagNumber(this, tag);
-
- boolean isConstructed = (tag & CONSTRUCTED) != 0;
-
- //
- // calculate length
- //
- int length = readLength();
-
- if (length < 0) // indefinite length method
- {
- if (!isConstructed)
- {
- throw new IOException("indefinite length primitive encoding encountered");
- }
-
- IndefiniteLengthInputStream indIn = new IndefiniteLengthInputStream(this);
-
- if ((tag & APPLICATION) != 0)
- {
- ASN1StreamParser sp = new ASN1StreamParser(indIn, limit);
-
- return new BERApplicationSpecificParser(tagNo, sp).getDERObject();
- }
- if ((tag & TAGGED) != 0)
- {
- return new BERTaggedObjectParser(tag, tagNo, indIn).getDERObject();
- }
-
- ASN1StreamParser sp = new ASN1StreamParser(indIn, limit);
-
- // TODO There are other tags that may be constructed (e.g. BIT_STRING)
- switch (tagNo)
- {
- case OCTET_STRING:
- return new BEROctetStringParser(sp).getDERObject();
- case SEQUENCE:
- return new BERSequenceParser(sp).getDERObject();
- case SET:
- return new BERSetParser(sp).getDERObject();
- case EXTERNAL:
- return new DERExternalParser(sp).getDERObject();
- default:
- throw new IOException("unknown BER object encountered");
- }
- }
- else
- {
- return buildObject(tag, tagNo, length);
- }
- }
-
- static int readTagNumber(InputStream s, int tag)
- throws IOException
- {
- int tagNo = tag & 0x1f;
-
- //
- // with tagged object tag number is bottom 5 bits, or stored at the start of the content
- //
- if (tagNo == 0x1f)
- {
- tagNo = 0;
-
- int b = s.read();
-
- // X.690-0207 8.1.2.4.2
- // "c) bits 7 to 1 of the first subsequent octet shall not all be zero."
- if ((b & 0x7f) == 0) // Note: -1 will pass
- {
- throw new IOException("corrupted stream - invalid high tag number found");
- }
-
- while ((b >= 0) && ((b & 0x80) != 0))
- {
- tagNo |= (b & 0x7f);
- tagNo <<= 7;
- b = s.read();
- }
-
- if (b < 0)
- {
- throw new EOFException("EOF found inside tag value.");
- }
-
- tagNo |= (b & 0x7f);
- }
-
- return tagNo;
- }
-
- static int readLength(InputStream s, int limit)
- throws IOException
- {
- int length = s.read();
- if (length < 0)
- {
- throw new EOFException("EOF found when length expected");
- }
-
- if (length == 0x80)
- {
- return -1; // indefinite-length encoding
- }
-
- if (length > 127)
- {
- int size = length & 0x7f;
-
- if (size > 4)
- {
- throw new IOException("DER length more than 4 bytes: " + size);
- }
-
- length = 0;
- for (int i = 0; i < size; i++)
- {
- int next = s.read();
-
- if (next < 0)
- {
- throw new EOFException("EOF found reading length");
- }
-
- length = (length << 8) + next;
- }
-
- if (length < 0)
- {
- throw new IOException("corrupted stream - negative length found");
- }
-
- if (length >= limit) // after all we must have read at least 1 byte
- {
- throw new IOException("corrupted stream - out of bounds length found");
- }
- }
-
- return length;
- }
-
- static DERObject createPrimitiveDERObject(
- int tagNo,
- byte[] bytes)
- {
- switch (tagNo)
- {
- case BIT_STRING:
- {
- int padBits = bytes[0];
- byte[] data = new byte[bytes.length - 1];
- System.arraycopy(bytes, 1, data, 0, bytes.length - 1);
- return new DERBitString(data, padBits);
- }
- case BMP_STRING:
- return new DERBMPString(bytes);
- case BOOLEAN:
- return new DERBoolean(bytes);
- case ENUMERATED:
- return new DEREnumerated(bytes);
- case GENERALIZED_TIME:
- return new DERGeneralizedTime(bytes);
- case GENERAL_STRING:
- return new DERGeneralString(bytes);
- case IA5_STRING:
- return new DERIA5String(bytes);
- case INTEGER:
- return new DERInteger(bytes);
- case NULL:
- return DERNull.INSTANCE; // actual content is ignored (enforce 0 length?)
- case NUMERIC_STRING:
- return new DERNumericString(bytes);
- case OBJECT_IDENTIFIER:
- return new DERObjectIdentifier(bytes);
- case OCTET_STRING:
- return new DEROctetString(bytes);
- case PRINTABLE_STRING:
- return new DERPrintableString(bytes);
- case T61_STRING:
- return new DERT61String(bytes);
- case UNIVERSAL_STRING:
- return new DERUniversalString(bytes);
- case UTC_TIME:
- return new DERUTCTime(bytes);
- case UTF8_STRING:
- return new DERUTF8String(bytes);
- case VISIBLE_STRING:
- return new DERVisibleString(bytes);
- default:
- return new DERUnknownTag(false, tagNo, bytes);
- }
- }
-}
View
38 bitcoin-old/bouncycastle/asn1/ASN1Null.java
@@ -1,38 +0,0 @@
-package com.google.bitcoin.bouncycastle.asn1;
-
-import java.io.IOException;
-
-/**
- * A NULL object.
- */
-public abstract class ASN1Null
- extends ASN1Object
-{
- public ASN1Null()
- {
- }
-
- public int hashCode()
- {
- return -1;
- }
-
- boolean asn1Equals(
- DERObject o)
- {
- if (!(o instanceof ASN1Null))
- {
- return false;
- }
-
- return true;
- }
-
- abstract void encode(DEROutputStream out)
- throws IOException;
-
- public String toString()
- {
- return "NULL";
- }
-}
View
38 bitcoin-old/bouncycastle/asn1/ASN1Object.java
@@ -1,38 +0,0 @@
-package com.google.bitcoin.bouncycastle.asn1;
-
-import java.io.IOException;
-
-public abstract class ASN1Object
- extends DERObject
-{
- /**
- * Create a base ASN.1 object from a byte stream.
- *
- * @param data the byte stream to parse.
- * @return the base ASN.1 object represented by the byte stream.
- * @exception IOException if there is a problem parsing the data.
- */
- public static ASN1Object fromByteArray(byte[] data)
- throws IOException
- {
- ASN1InputStream aIn = new ASN1InputStream(data);
-
- return (ASN1Object)aIn.readObject();
- }
-
- public final boolean equals(Object o)
- {
- if (this == o)
- {
- return true;
- }
-
- return (o instanceof DEREncodable) && asn1Equals(((DEREncodable)o).getDERObject());
- }
-
- public abstract int hashCode();
-
- abstract void encode(DEROutputStream out) throws IOException;
-
- abstract boolean asn1Equals(DERObject o);
-}
View
19 bitcoin-old/bouncycastle/asn1/ASN1ObjectParser.java
@@ -1,19 +0,0 @@
-package com.google.bitcoin.bouncycastle.asn1;
-
-import java.io.InputStream;
-
-/**
- * @deprecated will be removed
- */
-public class ASN1ObjectParser
-{
- ASN1StreamParser _aIn;
-
- protected ASN1ObjectParser(
- int baseTag,
- int tagNumber,
- InputStream contentStream)
- {
- _aIn = new ASN1StreamParser(contentStream);
- }
-}
View
135 bitcoin-old/bouncycastle/asn1/ASN1OctetString.java
@@ -1,135 +0,0 @@
-package com.google.bitcoin.bouncycastle.asn1;
-
-import com.google.bitcoin.bouncycastle.util.Arrays;
-import com.google.bitcoin.bouncycastle.util.encoders.Hex;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Enumeration;
-import java.util.Vector;
-
-public abstract class ASN1OctetString
- extends ASN1Object
- implements ASN1OctetStringParser
-{
- byte[] string;
-
- /**
- * return an Octet String from a tagged object.
- *
- * @param obj the tagged object holding the object we want.
- * @param explicit true if the object is meant to be explicitly
- * tagged false otherwise.
- * @exception IllegalArgumentException if the tagged object cannot
- * be converted.
- */
- public static ASN1OctetString getInstance(
- ASN1TaggedObject obj,
- boolean explicit)
- {
- return getInstance(obj.getObject());
- }
-
- /**
- * return an Octet String from the given object.
- *
- * @param obj the object we want converted.
- * @exception IllegalArgumentException if the object cannot be converted.
- */
- public static ASN1OctetString getInstance(
- Object obj)
- {
- if (obj == null || obj instanceof ASN1OctetString)
- {
- return (ASN1OctetString)obj;
- }
-
- if (obj instanceof ASN1TaggedObject)
- {
- return getInstance(((ASN1TaggedObject)obj).getObject());
- }
-
- if (obj instanceof ASN1Sequence)
- {
- Vector v = new Vector();
- Enumeration e = ((ASN1Sequence)obj).getObjects();
-
- while (e.hasMoreElements())
- {
- v.addElement(e.nextElement());
- }
-
- return new BERConstructedOctetString(v);
- }
-
- throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
- }
-
- /**
- * @param string the octets making up the octet string.
- */
- public ASN1OctetString(
- byte[] string)
- {
- if (string == null)
- {
- throw new NullPointerException("string cannot be null");
- }
- this.string = string;
- }
-
- public ASN1OctetString(
- DEREncodable obj)
- {
- try
- {
- this.string = obj.getDERObject().getEncoded(ASN1Encodable.DER);
- }
- catch (IOException e)
- {
- throw new IllegalArgumentException("Error processing object : " + e.toString());
- }
- }
-
- public InputStream getOctetStream()
- {
- return new ByteArrayInputStream(string);
- }
-
- public ASN1OctetStringParser parser()
- {
- return this;
- }
-
- public byte[] getOctets()
- {
- return string;
- }
-
- public int hashCode()
- {
- return Arrays.hashCode(this.getOctets());
- }
-
- boolean asn1Equals(
- DERObject o)
- {
- if (!(o instanceof ASN1OctetString))
- {
- return false;
- }
-
- ASN1OctetString other = (ASN1OctetString)o;
-
- return Arrays.areEqual(string, other.string);
- }
-
- abstract void encode(DEROutputStream out)
- throws IOException;
-
- public String toString()
- {
- return "#"+new String(Hex.encode(string));
- }
-}
View
9 bitcoin-old/bouncycastle/asn1/ASN1OctetStringParser.java
@@ -1,9 +0,0 @@
-package com.google.bitcoin.bouncycastle.asn1;
-
-import java.io.InputStream;
-
-public interface ASN1OctetStringParser
- extends DEREncodable
-{
- public InputStream getOctetStream();
-}
View
36 bitcoin-old/bouncycastle/asn1/ASN1OutputStream.java
@@ -1,36 +0,0 @@
-package com.google.bitcoin.bouncycastle.asn1;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-public class ASN1OutputStream
- extends DEROutputStream
-{
- public ASN1OutputStream(
- OutputStream os)
- {
- super(os);
- }
-
- public void writeObject(
- Object obj)
- throws IOException
- {
- if (obj == null)
- {
- writeNull();
- }
- else if (obj instanceof DERObject)
- {
- ((DERObject)obj).encode(this);
- }
- else if (obj instanceof DEREncodable)
- {
- ((DEREncodable)obj).getDERObject().encode(this);
- }
- else
- {
- throw new IOException("object not ASN1Encodable");
- }
- }
-}
View
23 bitcoin-old/bouncycastle/asn1/ASN1ParsingException.java
@@ -1,23 +0,0 @@
-package com.google.bitcoin.bouncycastle.asn1;
-
-public class ASN1ParsingException
- extends IllegalStateException
-{
- private Throwable cause;
-
- ASN1ParsingException(String message)
- {
- super(message);
- }
-
- ASN1ParsingException(String message, Throwable cause)
- {
- super(message);
- this.cause = cause;
- }
-
- public Throwable getCause()
- {
- return cause;
- }
-}
View
217 bitcoin-old/bouncycastle/asn1/ASN1Sequence.java
@@ -1,217 +0,0 @@
-package com.google.bitcoin.bouncycastle.asn1;
-
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Vector;
-
-public abstract class ASN1Sequence
- extends ASN1Object
-{
- private Vector seq = new Vector();
-
- /**
- * return an ASN1Sequence from the given object.
- *
- * @param obj the object we want converted.
- * @exception IllegalArgumentException if the object cannot be converted.
- */
- public static ASN1Sequence getInstance(
- Object obj)
- {
- if (obj == null || obj instanceof ASN1Sequence)
- {
- return (ASN1Sequence)obj;
- }
-
- throw new IllegalArgumentException("unknown object in getInstance: " + obj.getClass().getName());
- }
-
- /**
- * Return an ASN1 sequence from a tagged object. There is a special
- * case here, if an object appears to have been explicitly tagged on
- * reading but we were expecting it to be implicitly tagged in the
- * normal course of events it indicates that we lost the surrounding
- * sequence - so we need to add it back (this will happen if the tagged
- * object is a sequence that contains other sequences). If you are
- * dealing with implicitly tagged sequences you really <b>should</b>
- * be using this method.
- *
- * @param obj the tagged object.
- * @param explicit true if the object is meant to be explicitly tagged,
- * false otherwise.
- * @exception IllegalArgumentException if the tagged object cannot
- * be converted.
- */
- public static ASN1Sequence getInstance(
- ASN1TaggedObject obj,
- boolean explicit)
- {
- if (explicit)
- {
- if (!obj.isExplicit())
- {
- throw new IllegalArgumentException("object implicit - explicit expected.");
- }
-
- return (ASN1Sequence)obj.getObject();
- }
- else
- {
- //
- // constructed object which appears to be explicitly tagged
- // when it should be implicit means we have to add the
- // surrounding sequence.
- //
- if (obj.isExplicit())
- {
- if (obj instanceof BERTaggedObject)
- {
- return new BERSequence(obj.getObject());
- }
- else
- {
- return new DERSequence(obj.getObject());
- }
- }
- else
- {
- if (obj.getObject() instanceof ASN1Sequence)
- {
- return (ASN1Sequence)obj.getObject();
- }
- }
- }
-
- throw new IllegalArgumentException("unknown object in getInstance: " + obj.getClass().getName());
- }
-
- public Enumeration getObjects()
- {
- return seq.elements();
- }
-
- public ASN1SequenceParser parser()
- {
- final ASN1Sequence outer = this;
-
- return new ASN1SequenceParser()
- {
- private final int max = size();
-
- private int index;
-
- public DEREncodable readObject() throws IOException
- {
- if (index == max)
- {
- return null;
- }
-
- DEREncodable obj = getObjectAt(index++);
- if (obj instanceof ASN1Sequence)
- {
- return ((ASN1Sequence)obj).parser();
- }
- if (obj instanceof ASN1Set)
- {
- return ((ASN1Set)obj).parser();
- }
-
- return obj;
- }
-
- public DERObject getDERObject()
- {
- return outer;
- }
- };
- }
-
- /**
- * return the object at the sequence position indicated by index.
- *
- * @param index the sequence number (starting at zero) of the object
- * @return the object at the sequence position indicated by index.
- */
- public DEREncodable getObjectAt(
- int index)
- {
- return (DEREncodable)seq.elementAt(index);
- }
-
- /**
- * return the number of objects in this sequence.
- *
- * @return the number of objects in this sequence.
- */
- public int size()
- {
- return seq.size();
- }
-
- public int hashCode()
- {
- Enumeration e = this.getObjects();
- int hashCode = size();
-
- while (e.hasMoreElements())
- {
- Object o = e.nextElement();
- hashCode *= 17;
- if (o != null)
- {
- hashCode ^= o.hashCode();
- }
- }
-
- return hashCode;
- }
-
- boolean asn1Equals(
- DERObject o)
- {
- if (!(o instanceof ASN1Sequence))
- {
- return false;
- }
-
- ASN1Sequence other = (ASN1Sequence)o;
-
- if (this.size() != other.size())
- {
- return false;
- }
-
- Enumeration s1 = this.getObjects();
- Enumeration s2 = other.getObjects();
-
- while (s1.hasMoreElements())
- {
- DERObject o1 = ((DEREncodable)s1.nextElement()).getDERObject();
- DERObject o2 = ((DEREncodable)s2.nextElement()).getDERObject();
-
- if (o1 == o2 || (o1 != null && o1.equals(o2)))
- {
- continue;
- }
-
- return false;
- }
-
- return true;
- }
-
- protected void addObject(
- DEREncodable obj)
- {
- seq.addElement(obj);
- }
-
- abstract void encode(DEROutputStream out)
- throws IOException;
-
- public String toString()
- {
- return seq.toString();
- }
-}
View
10 bitcoin-old/bouncycastle/asn1/ASN1SequenceParser.java
@@ -1,10 +0,0 @@
-package com.google.bitcoin.bouncycastle.asn1;
-
-import java.io.IOException;
-
-public interface ASN1SequenceParser
- extends DEREncodable
-{
- DEREncodable readObject()
- throws IOException;
-}
View
343 bitcoin-old/bouncycastle/asn1/ASN1Set.java
@@ -1,343 +0,0 @@
-package com.google.bitcoin.bouncycastle.asn1;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Vector;
-
-abstract public class ASN1Set
- extends ASN1Object
-{
- protected Vector set = new Vector();
-
- /**
- * return an ASN1Set from the given object.
- *
- * @param obj the object we want converted.
- * @exception IllegalArgumentException if the object cannot be converted.
- */
- public static ASN1Set getInstance(
- Object obj)
- {
- if (obj == null || obj instanceof ASN1Set)
- {
- return (ASN1Set)obj;
- }
-
- throw new IllegalArgumentException("unknown object in getInstance: " + obj.getClass().getName());
- }
-
- /**
- * Return an ASN1 set from a tagged object. There is a special
- * case here, if an object appears to have been explicitly tagged on
- * reading but we were expecting it to be implicitly tagged in the
- * normal course of events it indicates that we lost the surrounding
- * set - so we need to add it back (this will happen if the tagged
- * object is a sequence that contains other sequences). If you are
- * dealing with implicitly tagged sets you really <b>should</b>
- * be using this method.
- *
- * @param obj the tagged object.
- * @param explicit true if the object is meant to be explicitly tagged
- * false otherwise.
- * @exception IllegalArgumentException if the tagged object cannot
- * be converted.
- */
- public static ASN1Set getInstance(
- ASN1TaggedObject obj,
- boolean explicit)
- {
- if (explicit)
- {
- if (!obj.isExplicit())
- {
- throw new IllegalArgumentException("object implicit - explicit expected.");
- }
-
- return (ASN1Set)obj.getObject();
- }
- else
- {
- //
- // constructed object which appears to be explicitly tagged
- // and it's really implicit means we have to add the
- // surrounding sequence.
- //
- if (obj.isExplicit())
- {
- ASN1Set set = new DERSet(obj.getObject());
-
- return set;
- }
- else
- {
- if (obj.getObject() instanceof ASN1Set)
- {
- return (ASN1Set)obj.getObject();
- }
-
- //
- // in this case the parser returns a sequence, convert it
- // into a set.
- //
- ASN1EncodableVector v = new ASN1EncodableVector();
-
- if (obj.getObject() instanceof ASN1Sequence)
- {
- ASN1Sequence s = (ASN1Sequence)obj.getObject();
- Enumeration e = s.getObjects();
-
- while (e.hasMoreElements())
- {
- v.add((DEREncodable)e.nextElement());
- }
-
- return new DERSet(v, false);
- }
- }
- }
-
- throw new IllegalArgumentException("unknown object in getInstance: " + obj.getClass().getName());
- }
-
- public ASN1Set()
- {
- }
-
- public Enumeration getObjects()
- {
- return set.elements();
- }
-
- /**
- * return the object at the set position indicated by index.
- *
- * @param index the set number (starting at zero) of the object
- * @return the object at the set position indicated by index.
- */
- public DEREncodable getObjectAt(
- int index)
- {
- return (DEREncodable)set.elementAt(index);
- }
-
- /**
- * return the number of objects in this set.
- *
- * @return the number of objects in this set.
- */
- public int size()
- {
- return set.size();
- }
-
- public ASN1SetParser parser()
- {
- final ASN1Set outer = this;
-
- return new ASN1SetParser()
- {
- private final int max = size();
-
- private int index;
-
- public DEREncodable readObject() throws IOException
- {
- if (index == max)
- {
- return null;
- }
-
- DEREncodable obj = getObjectAt(index++);
- if (obj instanceof ASN1Sequence)
- {
- return ((ASN1Sequence)obj).parser();
- }
- if (obj instanceof ASN1Set)
- {
- return ((ASN1Set)obj).parser();
- }
-
- return obj;
- }
-
- public DERObject getDERObject()
- {
- return outer;
- }
- };
- }
-
- public int hashCode()
- {
- Enumeration e = this.getObjects();
- int hashCode = size();
-
- while (e.hasMoreElements())
- {
- Object o = e.nextElement();
- hashCode *= 17;
- if (o != null)
- {
- hashCode ^= o.hashCode();
- }
- }
-
- return hashCode;
- }
-
- boolean asn1Equals(
- DERObject o)
- {
- if (!(o instanceof ASN1Set))
- {
- return false;
- }
-
- ASN1Set other = (ASN1Set)o;
-
- if (this.size() != other.size())
- {
- return false;
- }
-
- Enumeration s1 = this.getObjects();
- Enumeration s2 = other.getObjects();
-
- while (s1.hasMoreElements())
- {
- DERObject o1 = ((DEREncodable)s1.nextElement()).getDERObject();
- DERObject o2 = ((DEREncodable)s2.nextElement()).getDERObject();
-
- if (o1 == o2 || (o1 != null && o1.equals(o2)))
- {
- continue;
- }
-
- return false;
- }
-
- return true;
- }
-
- /**
- * return true if a <= b (arrays are assumed padded with zeros).
- */
- private boolean lessThanOrEqual(
- byte[] a,
- byte[] b)
- {
- if (a.length <= b.length)
- {
- for (int i = 0; i != a.length; i++)
- {
- int l = a[i] & 0xff;
- int r = b[i] & 0xff;
-
- if (r > l)
- {
- return true;
- }
- else if (l > r)
- {
- return false;
- }
- }
-
- return true;
- }
- else
- {
- for (int i = 0; i != b.length; i++)
- {
- int l = a[i] & 0xff;
- int r = b[i] & 0xff;
-
- if (r > l)
- {
- return true;
- }
- else if (l > r)
- {
- return false;
- }
- }
-
- return false;
- }
- }
-
- private byte[] getEncoded(
- DEREncodable obj)
- {
- ByteArrayOutputStream bOut = new ByteArrayOutputStream();
- ASN1OutputStream aOut = new ASN1OutputStream(bOut);
-
- try
- {
- aOut.writeObject(obj);
- }
- catch (IOException e)
- {
- throw new IllegalArgumentException("cannot encode object added to SET");
- }
-
- return bOut.toByteArray();
- }
-
- protected void sort()
- {
- if (set.size() > 1)
- {
- boolean swapped = true;
- int lastSwap = set.size() - 1;
-
- while (swapped)
- {
- int index = 0;
- int swapIndex = 0;
- byte[] a = getEncoded((DEREncodable)set.elementAt(0));
-
- swapped = false;
-
- while (index != lastSwap)
- {
- byte[] b = getEncoded((DEREncodable)set.elementAt(index + 1));
-
- if (lessThanOrEqual(a, b))
- {
- a = b;
- }
- else
- {
- Object o = set.elementAt(index);
-
- set.setElementAt(set.elementAt(index + 1), index);
- set.setElementAt(o, index + 1);
-
- swapped = true;
- swapIndex = index;
- }
-
- index++;
- }
-
- lastSwap = swapIndex;
- }
- }
- }
-
- protected void addObject(
- DEREncodable obj)
- {
- set.addElement(obj);
- }
-
- abstract void encode(DEROutputStream out)
- throws IOException;
-
- public String toString()
- {
- return set.toString();
- }
-}
View
10 bitcoin-old/bouncycastle/asn1/ASN1SetParser.java
@@ -1,10 +0,0 @@
-package com.google.bitcoin.bouncycastle.asn1;
-
-import java.io.IOException;
-
-public interface ASN1SetParser
- extends DEREncodable
-{
- public DEREncodable readObject()
- throws IOException;
-}
View
174 bitcoin-old/bouncycastle/asn1/ASN1StreamParser.java
@@ -1,174 +0,0 @@
-package com.google.bitcoin.bouncycastle.asn1;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-public class ASN1StreamParser
-{
- private final InputStream _in;
- private final int _limit;
-
- private static int findLimit(InputStream in)
- {
- if (in instanceof DefiniteLengthInputStream)
- {
- return ((DefiniteLengthInputStream)in).getRemaining();
- }
-
- return Integer.MAX_VALUE;
- }
-
- public ASN1StreamParser(
- InputStream in)
- {
- this(in, findLimit(in));
- }
-
- public ASN1StreamParser(
- InputStream in,
- int limit)
- {
- this._in = in;
- this._limit = limit;
- }
-
- public ASN1StreamParser(
- byte[] encoding)
- {
- this(new ByteArrayInputStream(encoding), encoding.length);
- }
-
- public DEREncodable readObject()
- throws IOException
- {
- int tag = _in.read();
- if (tag == -1)
- {
- return null;
- }
-
- //
- // turn of looking for "00" while we resolve the tag
- //
- set00Check(false);
-
- //
- // calculate tag number
- //
- int tagNo = ASN1InputStream.readTagNumber(_in, tag);
-
- boolean isConstructed = (tag & DERTags.CONSTRUCTED) != 0;
-
- //
- // calculate length
- //
- int length = ASN1InputStream.readLength(_in, _limit);
-
- if (length < 0) // indefinite length method
- {
- if (!isConstructed)
- {
- throw new IOException("indefinite length primitive encoding encountered");
- }
-
- IndefiniteLengthInputStream indIn = new IndefiniteLengthInputStream(_in);
-
- if ((tag & DERTags.APPLICATION) != 0)
- {
- ASN1StreamParser sp = new ASN1StreamParser(indIn, _limit);
-
- return new BERApplicationSpecificParser(tagNo, sp);
- }
-
- if ((tag & DERTags.TAGGED) != 0)
- {
- return new BERTaggedObjectParser(tag, tagNo, indIn);
- }
-
- ASN1StreamParser sp = new ASN1StreamParser(indIn, _limit);
-
- // TODO There are other tags that may be constructed (e.g. BIT_STRING)
- switch (tagNo)
- {
- case DERTags.OCTET_STRING:
- return new BEROctetStringParser(sp);
- case DERTags.SEQUENCE:
- return new BERSequenceParser(sp);
- case DERTags.SET:
- return new BERSetParser(sp);
- case DERTags.EXTERNAL:{
- return new DERExternalParser(sp);
- }
- default:
- throw new IOException("unknown BER object encountered: 0x" + Integer.toHexString(tagNo));
- }
- }
- else
- {
- DefiniteLengthInputStream defIn = new DefiniteLengthInputStream(_in, length);
-
- if ((tag & DERTags.APPLICATION) != 0)
- {
- return new DERApplicationSpecific(isConstructed, tagNo, defIn.toByteArray());
- }
-
- if ((tag & DERTags.TAGGED) != 0)
- {
- return new BERTaggedObjectParser(tag, tagNo, defIn);
- }
-
- if (isConstructed)
- {
- // TODO There are other tags that may be constructed (e.g. BIT_STRING)
- switch (tagNo)
- {
- case DERTags.OCTET_STRING:
- //
- // yes, people actually do this...
- //
- return new BEROctetStringParser(new ASN1StreamParser(defIn));
- case DERTags.SEQUENCE:
- return new DERSequenceParser(new ASN1StreamParser(defIn));
- case DERTags.SET:
- return new DERSetParser(new ASN1StreamParser(defIn));
- case DERTags.EXTERNAL:
- return new DERExternalParser(new ASN1StreamParser(defIn));
- default:
- // TODO Add DERUnknownTagParser class?
- return new DERUnknownTag(true, tagNo, defIn.toByteArray());
- }
- }
-
- // Some primitive encodings can be handled by parsers too...
- switch (tagNo)
- {
- case DERTags.OCTET_STRING:
- return new DEROctetStringParser(defIn);
- }
-
- return ASN1InputStream.createPrimitiveDERObject(tagNo, defIn.toByteArray());
- }
- }
-
- private void set00Check(boolean enabled)
- {
- if (_in instanceof IndefiniteLengthInputStream)
- {
- ((IndefiniteLengthInputStream)_in).setEofOn00(enabled);
- }
- }
-
- ASN1EncodableVector readVector() throws IOException
- {
- ASN1EncodableVector v = new ASN1EncodableVector();
-
- DEREncodable obj;
- while ((obj = readObject()) != null)
- {
- v.add(obj.getDERObject());
- }
-
- return v;
- }
-}
View
210 bitcoin-old/bouncycastle/asn1/ASN1TaggedObject.java
@@ -1,210 +0,0 @@
-package com.google.bitcoin.bouncycastle.asn1;
-
-import java.io.IOException;
-
-/**
- * ASN.1 TaggedObject - in ASN.1 notation this is any object preceded by
- * a [n] where n is some number - these are assumed to follow the construction
- * rules (as with sequences).
- */
-public abstract class ASN1TaggedObject
- extends ASN1Object
- implements ASN1TaggedObjectParser
-{
- int tagNo;
- boolean empty = false;
- boolean explicit = true;
- DEREncodable obj = null;
-
- static public ASN1TaggedObject getInstance(
- ASN1TaggedObject obj,
- boolean explicit)
- {
- if (explicit)
- {
- return (ASN1TaggedObject)obj.getObject();
- }
-
- throw new IllegalArgumentException("implicitly tagged tagged object");
- }
-
- static public ASN1TaggedObject getInstance(
- Object obj)
- {
- if (obj == null || obj instanceof ASN1TaggedObject)
- {
- return (ASN1TaggedObject)obj;
- }
-
- throw new IllegalArgumentException("unknown object in getInstance: " + obj.getClass().getName());
- }
-
- /**
- * Create a tagged object in the explicit style.
- *
- * @param tagNo the tag number for this object.
- * @param obj the tagged object.
- */
- public ASN1TaggedObject(
- int tagNo,
- DEREncodable obj)
- {
- this.explicit = true;
- this.tagNo = tagNo;
- this.obj = obj;
- }
-
- /**
- * Create a tagged object with the style given by the value of explicit.
- * <p>
- * If the object implements ASN1Choice the tag style will always be changed
- * to explicit in accordance with the ASN.1 encoding rules.
- * </p>
- * @param explicit true if the object is explicitly tagged.
- * @param tagNo the tag number for this object.
- * @param obj the tagged object.
- */
- public ASN1TaggedObject(
- boolean explicit,
- int tagNo,
- DEREncodable obj)
- {
- if (obj instanceof ASN1Choice)
- {
- this.explicit = true;
- }
- else
- {
- this.explicit = explicit;
- }
-
- this.tagNo = tagNo;
- this.obj = obj;
- }
-
- boolean asn1Equals(
- DERObject o)
- {
- if (!(o instanceof ASN1TaggedObject))
- {
- return false;
- }
-
- ASN1TaggedObject other = (ASN1TaggedObject)o;
-
- if (tagNo != other.tagNo || empty != other.empty || explicit != other.explicit)
- {
- return false;
- }
-
- if(obj == null)
- {
- if (other.obj != null)
- {
- return false;
- }
- }
- else
- {
- if (!(obj.getDERObject().equals(other.obj.getDERObject())))
- {
- return false;
- }
- }
-
- return true;
- }
-
- public int hashCode()
- {
- int code = tagNo;
-
- // TODO: actually this is wrong - the problem is that a re-encoded
- // object may end up with a different hashCode due to implicit
- // tagging. As implicit tagging is ambiguous if a sequence is involved
- // it seems the only correct method for both equals and hashCode is to
- // compare the encodings...
- if (obj != null)
- {
- code ^= obj.hashCode();
- }
-
- return code;
- }
-
- public int getTagNo()
- {
- return tagNo;
- }
-
- /**
- * return whether or not the object may be explicitly tagged.
- * <p>
- * Note: if the object has been read from an input stream, the only
- * time you can be sure if isExplicit is returning the true state of
- * affairs is if it returns false. An implicitly tagged object may appear
- * to be explicitly tagged, so you need to understand the context under
- * which the reading was done as well, see getObject below.
- */
- public boolean isExplicit()
- {
- return explicit;
- }
-
- public boolean isEmpty()
- {
- return empty;
- }
-
- /**
- * return whatever was following the tag.
- * <p>
- * Note: tagged objects are generally context dependent if you're
- * trying to extract a tagged object you should be going via the
- * appropriate getInstance method.
- */
- public DERObject getObject()